Skip to content

Commit

Permalink
resolve some sonar-cloud issues
Browse files Browse the repository at this point in the history
Signed-off-by: Martijn Govers <[email protected]>
  • Loading branch information
mgovers committed Jan 23, 2025
1 parent d58735e commit 7b67212
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ inline ObservabilityResult necessary_observability_check(MeasuredValues<sym> con
if (topo.is_radial && n_voltage_phasor_sensor == 0) {
detail::assign_injection_sensor_radial(y_bus_structure, flow_sensors);
// count flow sensors again
Idx const n_flow_sensor_new = std::reduce(flow_sensors.cbegin(), flow_sensors.cend(), Idx{}, std::plus<Idx>{});
if (n_flow_sensor_new < n_bus - 1) {
if (Idx const n_flow_sensor_new =
std::reduce(flow_sensors.cbegin(), flow_sensors.cend(), Idx{}, std::plus<Idx>{});
n_flow_sensor_new < n_bus - 1) {
throw NotObservableError{"The number of power sensors appears sufficient, but they are not independent "
"enough. The system is still not observable.\n"};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,14 @@ template <rk2_tensor Matrix> class DenseLUFactor {
assert(col_biggest_eigen + pivot < size);

// check absolute singular matrix
if (biggest_score == 0.0) {
if (biggest_score == 0.0 && !use_pivot_perturbation) {
// pivot perturbation not possible, cannot proceed
// set identity permutation and break the loop
if (!use_pivot_perturbation) {
for (int8_t remaining_rows_cols = pivot; remaining_rows_cols != size; ++remaining_rows_cols) {
row_transpositions[remaining_rows_cols] = remaining_rows_cols;
col_transpositions[remaining_rows_cols] = remaining_rows_cols;
}
break;
for (int8_t remaining_rows_cols = pivot; remaining_rows_cols != size; ++remaining_rows_cols) {
row_transpositions[remaining_rows_cols] = remaining_rows_cols;
col_transpositions[remaining_rows_cols] = remaining_rows_cols;
}
break;
}

// perturb pivot if needed
Expand Down Expand Up @@ -571,7 +569,7 @@ template <class Tensor, class RHSVector, class XVector> class SparseLUSolver {

void solve_once(std::vector<Tensor> const& data, // pre-factoirzed data, const ref
BlockPermArray const& block_perm_array, // pre-calculated permutation, const ref
std::vector<RHSVector> const& rhs, std::vector<XVector>& x) {
std::vector<RHSVector> const& rhs, std::vector<XVector>& x) const {
// local reference
auto const& row_indptr = *row_indptr_;
auto const& col_indices = *col_indices_;
Expand Down

0 comments on commit 7b67212

Please sign in to comment.