Skip to content

Commit

Permalink
Remove unnecessary/unused members, simplify logic and general clean u…
Browse files Browse the repository at this point in the history
…p in det_manip

- remove change_col_row operation
- remove old working data
- do not keep track of the size and capacity explicitly
- remove short cut functions
- remove/update old tests
  • Loading branch information
Thoemi09 committed Dec 4, 2024
1 parent 5da019f commit 46f8766
Show file tree
Hide file tree
Showing 15 changed files with 412 additions and 1,540 deletions.
493 changes: 181 additions & 312 deletions c++/triqs/det_manip/det_manip.hpp

Large diffs are not rendered by default.

72 changes: 0 additions & 72 deletions c++/triqs/det_manip/work_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,78 +26,6 @@

namespace triqs::det_manip::detail {

// ================ Work Data Types =====================

// For single-row/column operations
template <typename x_type, typename y_type, typename value_type> struct work_data_type1 {
x_type x;
y_type y;
long i, j, ireal, jreal;
// MB = A^(-1)*B,
// MC = C*A^(-1)
nda::vector<value_type> MB, MC, B, C;
// ksi = newdet/det
value_type ksi;
void resize(long N) {
MB.resize(N);
MC.resize(N);
B.resize(N);
C.resize(N);
}
};

// For multiple-row/column operations
template <typename x_type, typename y_type, typename value_type> struct work_data_typek {
std::vector<x_type> x;
std::vector<y_type> y;
std::vector<long> i, j, ireal, jreal;
// MB = A^(-1)*B,
// MC = C*A^(-1)
nda::matrix<value_type> MB, MC, B, C, ksi;
void resize(long N, long k) {
if (k < 2) return;
x.resize(k);
y.resize(k);
i.resize(k);
j.resize(k);
ireal.resize(k);
jreal.resize(k);
MB.resize(N, k);
MC.resize(k, N);
B.resize(N, k);
C.resize(k, N);
ksi.resize(k, k);
}
value_type det_ksi(long k) const {
if (k == 2) {
return ksi(0, 0) * ksi(1, 1) - ksi(1, 0) * ksi(0, 1);
} else if (k == 3) {
return // Rule of Sarrus
ksi(0, 0) * ksi(1, 1) * ksi(2, 2) + //
ksi(0, 1) * ksi(1, 2) * ksi(2, 0) + //
ksi(0, 2) * ksi(1, 0) * ksi(2, 1) - //
ksi(2, 0) * ksi(1, 1) * ksi(0, 2) - //
ksi(2, 1) * ksi(1, 2) * ksi(0, 0) - //
ksi(2, 2) * ksi(1, 0) * ksi(0, 1); //
} else {
auto Rk = nda::range(k);
return nda::determinant(ksi(Rk, Rk));
};
}
};

// For refill operations
template <typename x_type, typename y_type, typename value_type> struct work_data_type_refill {
std::vector<x_type> x_values;
std::vector<y_type> y_values;
nda::matrix<value_type> M;
void reserve(long N) {
x_values.reserve(N);
y_values.reserve(N);
M.resize(N, N);
}
};

// Data storage for temporary data used in the det_manip class when inserting a new row and column.
//
// - x and y: MatrixBuilder arguments for the new row and column.
Expand Down
190 changes: 0 additions & 190 deletions test/c++/det_manip/det_manip1.cpp

This file was deleted.

125 changes: 0 additions & 125 deletions test/c++/det_manip/det_manip2.cpp

This file was deleted.

Loading

0 comments on commit 46f8766

Please sign in to comment.