32#include <itertools/itertools.hpp>
42namespace triqs::det_manip {
44 namespace blas = nda::blas;
70 static_assert(f_tr::arity == 2,
"det_manip_basic : the function must take two arguments !");
72 using int_type = std::ptrdiff_t;
73 using range = itertools::range;
76 using x_type =
typename f_tr::template decay_arg_t<0>;
77 using y_type =
typename f_tr::template decay_arg_t<1>;
78 using value_type =
typename f_tr::result_type;
79 using det_type = value_type;
80 static_assert(std::is_floating_point_v<value_type> || nda::is_complex_v<value_type>,
81 "det_manip_basic : the function must return a floating number or a complex number");
83 using matrix_type = nda::matrix<value_type>;
114 std::vector<x_type> x_values;
115 std::vector<y_type> y_values;
119 det_type det_new = 1.0;
121 mutable matrix_type mat_inverse;
122 mutable bool mat_inverse_is_valid =
false;
127 struct work_data_type1 {
135 struct work_data_type2 {
136 std::array<x_type, 2> x;
137 std::array<y_type, 2> y;
138 std::array<long, 2> i, j;
142 struct work_data_typek {
143 std::vector<x_type> x;
144 std::vector<y_type> y;
145 std::vector<long> i, j;
147 void resize(
long new_k) {
157 struct work_data_type_refill {
158 std::vector<x_type> x_values;
159 std::vector<y_type> y_values;
181 auto gr = fg.create_group(subgroup_name);
186 h5_write(gr,
"x_values", g.x_values);
187 h5_write(gr,
"y_values", g.y_values);
198 auto gr = fg.open_group(subgroup_name);
199 h5_read(gr,
"n_opts", g.n_opts);
202 g.Nmax = first_dim(g.mat);
205 h5_read(gr,
"x_values", g.x_values);
206 h5_read(gr,
"y_values", g.y_values);
222 if (new_size <= Nmax)
return;
223 matrix_type Mcopy(mat);
226 mat.resize(Nmax, Nmax);
227 mat_new.resize(Nmax, Nmax);
228 mat_inverse.resize(Nmax, Nmax);
229 mat(range(0, N0), range(0, N0)) = Mcopy;
230 x_values.reserve(Nmax);
231 y_values.reserve(Nmax);
232 mat_inverse_is_valid =
false;
260 template <
typename ArgumentContainer1,
typename ArgumentContainer2>
261 det_manip_basic(FunctionType F, ArgumentContainer1
const &X, ArgumentContainer2
const &Y) : f(std::move(F)) {
270 std::copy(X.begin(), X.end(), std::back_inserter(x_values));
271 std::copy(Y.begin(), Y.end(), std::back_inserter(y_values));
274 compute_determinant();
303 matrix_type res(N, N);
305 for (
long i = 0; i < N; i++) {
306 for (
long j = 0; j < N; j++) { res(i, j) = f(x_values[i], y_values[j]); }
314 void build_matrix() {
319 for (
long i = 0; i < N; i++) {
320 for (
long j = 0; j < N; j++) { mat(i, j) = f(x_values[i], y_values[j]); }
325 void compute_determinant() {
327 det = nda::linalg::det(mat(R, R));
331 void compute_inverse()
const {
332 if (mat_inverse_is_valid)
return;
334 mat_inverse_is_valid =
true;
338 mat_inverse(R, R) = nda::linalg::inv(mat(R, R));
339 mat_inverse_is_valid =
true;
348 auto size()
const {
return N; }
354 auto get_x()
const {
return x_values; }
360 auto get_y()
const {
return y_values; }
367 x_type
const &
get_x(
long i)
const {
return x_values[i]; }
374 y_type
const &
get_y(
long j)
const {
return y_values[j]; }
412 return mat_inverse(R, R);
423 return mat_inverse(i, j);
459 value_type
matrix(
int i,
int j)
const {
return mat(i, j); }
472 template <
typename LambdaType>
friend void foreach (
det_manip_basic const &d, LambdaType
const &func) {
474 nda::for_each(std::array{long(d.N), long(d.N)}, [&func, &d](
int i,
int j) {
return func(d.x_values[i], d.y_values[j], d.mat_inverse(j, i)); });
497 value_type
try_insert(
long i,
long j, x_type
const &x, y_type
const &y) {
510 if (N == Nmax)
reserve(2 * Nmax);
515 range Row_B_1 = Row_B_0 + std::ptrdiff_t{1};
519 range Col_B_1 = Col_B_0 + std::ptrdiff_t{1};
521 mat_new(Row_A, Col_A) = mat(Row_A, Col_A);
522 mat_new(Row_A, Col_B_1) = mat(Row_A, Col_B_0);
523 mat_new(Row_B_1, Col_A) = mat(Row_B_0, Col_A);
524 mat_new(Row_B_1, Col_B_1) = mat(Row_B_0, Col_B_0);
526 for (
auto k : Row_A) { mat_new(k, j) = f(x_values[k], y); }
527 for (
auto k : Row_B_0) { mat_new(k + 1, j) = f(x_values[k], y); }
529 for (
auto k : Col_A) { mat_new(i, k) = f(x, y_values[k]); }
530 for (
auto k : Col_B_0) { mat_new(i, k + 1) = f(x, y_values[k]); }
532 mat_new(i, j) = f(x, y);
535 det_new = nda::linalg::det(mat_new(R, R));
537 return det_new / det;
543 void complete_insert() {
545 x_values.insert(
begin(x_values) + w1.i, w1.x);
546 y_values.insert(
begin(y_values) + w1.j, w1.y);
547 std::swap(mat, mat_new);
574 value_type
try_insert2(
long i0,
long i1,
long j0,
long j1, x_type
const &x0_, x_type
const &x1_, y_type
const &y0_, y_type
const &y1_) {
577 x_type
const &x0((i0 < i1) ? x0_ : x1_);
578 x_type
const &x1((i0 < i1) ? x1_ : x0_);
579 y_type
const &y0((j0 < j1) ? y0_ : y1_);
580 y_type
const &y1((j0 < j1) ? y1_ : y0_);
581 if (i0 > i1) std::swap(i0, i1);
582 if (j0 > j1) std::swap(j0, j1);
600 if (N >= Nmax - 1)
reserve(2 * Nmax);
614 range Row_B_0(i0, i1);
615 range Row_B_1 = Row_B_0 + std::ptrdiff_t{1};
616 range Row_C_0(i1, N);
617 range Row_C_1 = Row_C_0 + std::ptrdiff_t{2};
620 range Col_B_0(j0, j1);
621 range Col_B_1 = Col_B_0 + std::ptrdiff_t{1};
622 range Col_C_0(j1, N);
623 range Col_C_1 = Col_C_0 + std::ptrdiff_t{2};
625 mat_new(Row_A, Col_A) = mat(Row_A, Col_A);
626 mat_new(Row_A, Col_B_1) = mat(Row_A, Col_B_0);
627 mat_new(Row_A, Col_C_1) = mat(Row_A, Col_C_0);
629 mat_new(Row_B_1, Col_A) = mat(Row_B_0, Col_A);
630 mat_new(Row_B_1, Col_B_1) = mat(Row_B_0, Col_B_0);
631 mat_new(Row_B_1, Col_C_1) = mat(Row_B_0, Col_C_0);
633 mat_new(Row_C_1, Col_A) = mat(Row_C_0, Col_A);
634 mat_new(Row_C_1, Col_B_1) = mat(Row_C_0, Col_B_0);
635 mat_new(Row_C_1, Col_C_1) = mat(Row_C_0, Col_C_0);
639 for (
auto k : Row_A) {
640 mat_new(k, j0) = f(x_values[k], y0);
641 mat_new(k, j1 + 1) = f(x_values[k], y1);
643 for (
auto k : Row_B_0) {
644 mat_new(k + 1, j0) = f(x_values[k], y0);
645 mat_new(k + 1, j1 + 1) = f(x_values[k], y1);
648 for (
auto k : Row_C_0) {
649 mat_new(k + 2, j0) = f(x_values[k], y0);
650 mat_new(k + 2, j1 + 1) = f(x_values[k], y1);
653 for (
auto k : Col_A) {
654 mat_new(i0, k) = f(x0, y_values[k]);
655 mat_new(i1 + 1, k) = f(x1, y_values[k]);
657 for (
auto k : Col_B_0) {
658 mat_new(i0, k + 1) = f(x0, y_values[k]);
659 mat_new(i1 + 1, k + 1) = f(x1, y_values[k]);
661 for (
auto k : Col_C_0) {
662 mat_new(i0, k + 2) = f(x0, y_values[k]);
663 mat_new(i1 + 1, k + 2) = f(x1, y_values[k]);
666 mat_new(i0, j0) = f(x0, y0);
667 mat_new(i0, j1 + 1) = f(x0, y1);
668 mat_new(i1 + 1, j0) = f(x1, y0);
669 mat_new(i1 + 1, j1 + 1) = f(x1, y1);
672 det_new = nda::linalg::det(mat_new(R, R));
674 return det_new / det;
680 void complete_insert2() {
682 x_values.insert(
begin(x_values) + w2.i[1], w2.x[1]);
683 x_values.insert(
begin(x_values) + w2.i[0], w2.x[0]);
684 y_values.insert(
begin(y_values) + w2.j[1], w2.y[1]);
685 y_values.insert(
begin(y_values) + w2.j[0], w2.y[0]);
686 std::swap(mat, mat_new);
693 template <nda::Array A>
static auto flatten_array(A
const &a) {
694 auto v = std::vector<typename A::value_type>(a.size());
696 nda::for_each(a.shape(), [&](
auto... idx) { v[flat++] = a(idx...); });
716 template <nda::Array X, nda::Array Y>
717 requires(nda::get_rank<X> == nda::get_rank<Y>)
718 auto insert_ratios(
long i,
long j, X
const &xs, Y
const &ys)
const -> nda::array<value_type, nda::get_rank<X>> {
719 constexpr int Rk = nda::get_rank<X>;
724 long nbatch = xs.size();
725 nda::array<value_type, Rk> result(xs.shape());
726 auto xs_flat = flatten_array(xs);
727 auto ys_flat = flatten_array(ys);
729 for (
long m = 0; m < nbatch; ++m) result.data()[m] = compute_insert_ratio(i, j, xs_flat[m], ys_flat[m]);
735 auto compute_insert_ratio(
long i,
long j, x_type
const &x, y_type
const &y)
const -> value_type {
736 matrix_type aug(N + 1, N + 1);
737 for (
long r = 0; r < N; ++r)
738 for (
long c = 0; c < N; ++c) aug(r < i ? r : r + 1, c < j ? c : c + 1) = mat(r, c);
739 for (
long c = 0; c < N; ++c) aug(i, c < j ? c : c + 1) = f(x, y_values[c]);
740 for (
long r = 0; r < N; ++r) aug(r < i ? r : r + 1, j) = f(x_values[r], y);
742 return nda::linalg::det(aug) / det;
763 value_type
try_insert_k(std::vector<long> i, std::vector<long> j, std::vector<x_type> x, std::vector<y_type> y) {
769 long k =
static_cast<long>(i.size());
773 auto argsort = [](
auto const &vec) {
774 std::vector<long> idx(vec.size());
775 std::iota(idx.begin(), idx.end(), 0L);
776 std::stable_sort(idx.begin(), idx.end(), [&vec](
long lhs,
long rhs) { return vec[lhs] < vec[rhs]; });
779 std::vector<long> idx = argsort(i);
780 std::vector<long> idy = argsort(j);
783 for (
long l = 0; l < k; ++l) {
792 for (
long l = 0; l < k; ++l) {
796 for (
long l = 0; l < k - 1; ++l) {
801 if (N + k > Nmax)
reserve(2 * (N + k));
806 std::vector<long> row_map(N), col_map(N);
810 for (
long old_idx = 0; old_idx < N; ++old_idx) {
811 while (insert_idx < k && wk.i[insert_idx] <= old_idx + offset) {
815 row_map[old_idx] = old_idx + offset;
821 for (
long old_idx = 0; old_idx < N; ++old_idx) {
822 while (insert_idx < k && wk.j[insert_idx] <= old_idx + offset) {
826 col_map[old_idx] = old_idx + offset;
831 for (
long old_i = 0; old_i < N; ++old_i) {
832 for (
long old_j = 0; old_j < N; ++old_j) { mat_new(row_map[old_i], col_map[old_j]) = mat(old_i, old_j); }
836 for (
long l = 0; l < k; ++l) {
837 long new_row = wk.i[l];
839 for (
long old_j = 0; old_j < N; ++old_j) { mat_new(new_row, col_map[old_j]) = f(wk.x[l], y_values[old_j]); }
841 for (
long m = 0; m < k; ++m) { mat_new(new_row, wk.j[m]) = f(wk.x[l], wk.y[m]); }
845 for (
long l = 0; l < k; ++l) {
846 long new_col = wk.j[l];
847 for (
long old_i = 0; old_i < N; ++old_i) { mat_new(row_map[old_i], new_col) = f(x_values[old_i], wk.y[l]); }
851 det_new = nda::linalg::det(mat_new(R, R));
853 return det_new / det;
859 void complete_insert_k() {
863 for (
long l = 0; l < k; ++l) {
864 x_values.insert(
begin(x_values) + wk.i[l], wk.x[l]);
865 y_values.insert(
begin(y_values) + wk.j[l], wk.y[l]);
867 std::swap(mat, mat_new);
898 return det_new / det;
902 range Row_B_0(i + 1, N);
903 range Row_B_1 = Row_B_0 + std::ptrdiff_t{-1};
906 range Col_B_0(j + 1, N);
907 range Col_B_1 = Col_B_0 + std::ptrdiff_t{-1};
909 mat_new(Row_A, Col_A) = mat(Row_A, Col_A);
910 mat_new(Row_A, Col_B_1) = mat(Row_A, Col_B_0);
911 mat_new(Row_B_1, Col_A) = mat(Row_B_0, Col_A);
912 mat_new(Row_B_1, Col_B_1) = mat(Row_B_0, Col_B_0);
915 det_new = nda::linalg::det(mat_new(R, R));
917 return det_new / det;
922 void complete_remove() {
924 x_values.erase(
begin(x_values) + w1.i);
925 y_values.erase(
begin(y_values) + w1.j);
926 std::swap(mat, mat_new);
949 if (i0 > i1) std::swap(i0, i1);
950 if (j0 > j1) std::swap(j0, j1);
967 w2.i[0] = std::min(i0, i1);
968 w2.i[1] = std::max(i0, i1);
969 w2.j[0] = std::min(j0, j1);
970 w2.j[1] = std::max(j0, j1);
975 return det_new / det;
979 range Row_B_0(i0 + 1, i1);
980 range Row_B_1 = Row_B_0 + std::ptrdiff_t{-1};
981 range Row_C_0(i1 + 1, N);
982 range Row_C_1 = Row_C_0 + std::ptrdiff_t{-2};
985 range Col_B_0(j0 + 1, j1);
986 range Col_B_1 = Col_B_0 + std::ptrdiff_t{-1};
987 range Col_C_0(j1 + 1, N);
988 range Col_C_1 = Col_C_0 + std::ptrdiff_t{-2};
990 mat_new(Row_A, Col_A) = mat(Row_A, Col_A);
991 mat_new(Row_A, Col_B_1) = mat(Row_A, Col_B_0);
992 mat_new(Row_A, Col_C_1) = mat(Row_A, Col_C_0);
994 mat_new(Row_B_1, Col_A) = mat(Row_B_0, Col_A);
995 mat_new(Row_B_1, Col_B_1) = mat(Row_B_0, Col_B_0);
996 mat_new(Row_B_1, Col_C_1) = mat(Row_B_0, Col_C_0);
998 mat_new(Row_C_1, Col_A) = mat(Row_C_0, Col_A);
999 mat_new(Row_C_1, Col_B_1) = mat(Row_C_0, Col_B_0);
1000 mat_new(Row_C_1, Col_C_1) = mat(Row_C_0, Col_C_0);
1003 det_new = nda::linalg::det(mat_new(R, R));
1005 return det_new / det;
1010 void complete_remove2() {
1014 x_values.erase(
begin(x_values) + w2.i[1]);
1015 x_values.erase(
begin(x_values) + w2.i[0]);
1016 y_values.erase(
begin(y_values) + w2.j[1]);
1017 y_values.erase(
begin(y_values) + w2.j[0]);
1019 std::swap(mat, mat_new);
1043 long k =
static_cast<long>(i.size());
1047 std::ranges::sort(i);
1048 std::ranges::sort(j);
1051 for (
long l = 0; l < k - 1; ++l) {
1052 TRIQS_ASSERT(i[l] != i[l + 1] && 0 <= i[l] && i[l] < N);
1053 TRIQS_ASSERT(j[l] != j[l + 1] && 0 <= j[l] && j[l] < N);
1061 for (
long l = 0; l < k; ++l) {
1071 return det_new / det;
1075 std::vector<long> row_keep, col_keep;
1076 row_keep.reserve(N - k);
1077 col_keep.reserve(N - k);
1079 long remove_idx = 0;
1080 for (
long idx = 0; idx < N; ++idx) {
1081 if (remove_idx < k && idx == wk.i[remove_idx]) {
1084 row_keep.push_back(idx);
1089 long remove_idx = 0;
1090 for (
long idx = 0; idx < N; ++idx) {
1091 if (remove_idx < k && idx == wk.j[remove_idx]) {
1094 col_keep.push_back(idx);
1100 for (
long new_i = 0; new_i < static_cast<long>(row_keep.size()); ++new_i) {
1101 for (
long new_j = 0; new_j < static_cast<long>(col_keep.size()); ++new_j) { mat_new(new_i, new_j) = mat(row_keep[new_i], col_keep[new_j]); }
1105 det_new = nda::linalg::det(mat_new(R, R));
1107 return det_new / det;
1113 void complete_remove_k() {
1118 for (
long l = k - 1; l >= 0; --l) {
1119 x_values.erase(
begin(x_values) + wk.i[l]);
1120 y_values.erase(
begin(y_values) + wk.j[l]);
1123 std::swap(mat, mat_new);
1145 last_try = ChangeCol;
1149 mat_new(R, R) = mat(R, R);
1150 for (
auto k : R) { mat_new(k, j) = f(x_values[k], y); }
1152 det_new = nda::linalg::det(mat_new(R, R));
1154 return det_new / det;
1160 void complete_change_col() {
1161 y_values[w1.j] = w1.y;
1162 std::swap(mat, mat_new);
1184 last_try = ChangeRow;
1188 mat_new(R, R) = mat(R, R);
1189 for (
auto k : R) { mat_new(i, k) = f(x, y_values[k]); }
1191 det_new = nda::linalg::det(mat_new(R, R));
1193 return det_new / det;
1198 void complete_change_row() {
1199 x_values[w1.i] = w1.x;
1200 std::swap(mat, mat_new);
1227 last_try = ChangeRowCol;
1234 mat_new(R, R) = mat(R, R);
1237 mat_new(i, k) = f(x, y_values[k]);
1238 mat_new(k, j) = f(x_values[k], y);
1240 mat_new(i, j) = f(x, y);
1242 det_new = nda::linalg::det(mat_new(R, R));
1244 return det_new / det;
1250 void complete_change_col_row() {
1251 x_values[w1.i] = w1.x;
1252 y_values[w1.j] = w1.y;
1253 std::swap(mat, mat_new);
1273 template <
typename ArgumentContainer1,
typename ArgumentContainer2>
1274 value_type
try_refill(ArgumentContainer1
const &X, ArgumentContainer2
const &Y) {
1280 w_refill.reserve(2 * s);
1289 std::copy(X.begin(), X.end(), std::back_inserter(w_refill.x_values));
1290 std::copy(Y.begin(), Y.end(), std::back_inserter(w_refill.y_values));
1291 for (
long i = 0; i < s; ++i)
1292 for (
long j = 0; j < s; ++j) mat_new(i, j) = f(w_refill.x_values[i], w_refill.y_values[j]);
1295 det_new = nda::linalg::det(mat_new(R, R));
1298 return det_new / det;
1304 void complete_refill() {
1305 N = w_refill.x_values.size();
1313 std::swap(x_values, w_refill.x_values);
1314 std::swap(y_values, w_refill.y_values);
1315 std::swap(mat, mat_new);
1329 case (Insert): complete_insert();
break;
1330 case (Remove): complete_remove();
break;
1331 case (ChangeCol): complete_change_col();
break;
1332 case (ChangeRow): complete_change_row();
break;
1333 case (ChangeRowCol): complete_change_col_row();
break;
1334 case (Insert2): complete_insert2();
break;
1335 case (Remove2): complete_remove2();
break;
1336 case (InsertK): complete_insert_k();
break;
1337 case (RemoveK): complete_remove_k();
break;
1338 case (Refill): complete_refill();
break;
1339 case (NoTry):
return;
break;
1343 mat_inverse_is_valid =
false;
1368 value_type
insert(
long i,
long j, x_type
const &x, y_type
const &y) {
1392 value_type
insert2(
long i0,
long i1,
long j0,
long j1, x_type
const &x0, x_type
const &x1, y_type
const &y0, y_type
const &y1) {
1393 auto r =
try_insert2(i0, i1, j0, j1, x0, x1, y0, y1);
1405 value_type
insert2_at_end(x_type
const &x0, x_type
const &x1, y_type
const &y0, y_type
const &y1) {
1406 return insert2(N, N + 1, N, N + 1, x0, x1, y0, y1);
1436 value_type
remove2(
long i0,
long i1,
long j0,
long j1) {
1520 case (None):
return 1;
1521 case (Down): std::rotate(
begin(x_values),
end(x_values) - 1,
end(x_values));
break;
1522 case (Up): std::rotate(
begin(x_values),
begin(x_values) + 1,
end(x_values));
break;
1523 case (Right): std::rotate(
begin(y_values),
end(y_values) - 1,
end(y_values));
break;
1524 case (Left): std::rotate(
begin(y_values),
begin(y_values) + 1,
end(y_values));
break;
1527 for (
long i = 0; i < N; ++i)
1528 for (
long j = 0; j < N; ++j) mat(i, j) = f(x_values[i], y_values[j]);
1530 if ((N - 1) % 2 == 1) {
iterator end()
Get an iterator past the last block.
iterator begin()
Get an iterator to the first block.
Backward-compatibility umbrella header pulling in the nda array library.
Provides a trait inspecting the operator() of a callable type.
Simple reference implementation of determinant manipulation for CTQMC solvers.
value_type change_col(long j, y_type const &y)
Change one column.
x_type const & get_x(long i) const
Get the matrix builder argument that determines the elements of the ith row.
value_type change_row(long i, x_type const &x)
Change one row.
friend void h5_read(h5::group fg, std::string subgroup_name, det_manip_basic &g)
Read a triqs::det_manip::det_manip_basic object from HDF5.
value_type try_change_row(long i, x_type const &x)
Try to change one row in the matrix .
matrix_type matrix() const
Get the matrix .
value_type try_remove_k(std::vector< long > i, std::vector< long > j)
Try to remove rows and columns.
value_type try_insert2(long i0, long i1, long j0, long j1, x_type const &x0_, x_type const &x1_, y_type const &y0_, y_type const &y1_)
Try to insert two rows and columns.
value_type try_insert(long i, long j, x_type const &x, y_type const &y)
Try to insert one row and column.
auto insert_ratios(long i, long j, X const &xs, Y const &ys) const -> nda::array< value_type, nda::get_rank< X > >
Compute independent single-insertion determinant ratios at position for paired elements of xs and ys...
value_type try_insert_k(std::vector< long > i, std::vector< long > j, std::vector< x_type > x, std::vector< y_type > y)
Try to insert rows and columns.
value_type matrix(int i, int j) const
Get an element of the matrix .
value_type try_change_col(long j, y_type const &y)
Try to change one column in the matrix .
det_manip_basic(FunctionType F, ArgumentContainer1 const &X, ArgumentContainer2 const &Y)
Construct a det_manip_basic object with a callable FunctionType and two containers holding the argume...
value_type remove_at_end()
Remove the last row and column of the matrix.
value_type try_refill(ArgumentContainer1 const &X, ArgumentContainer2 const &Y)
Try to fill the matrix with new elements.
value_type inverse_matrix(int i, int j) const
Get an element of the inverse matrix .
void clear()
Clear the data storages and reset the matrix to size zero.
value_type try_remove2(long i0, long i1, long j0, long j1)
Try to remove two rows and two columns.
auto determinant()
Get the determinant of the matrix .
int roll_matrix(RollDirection roll)
Perform a circular shift permutation on the rows or columns of the matrix .
value_type insert2(long i0, long i1, long j0, long j1, x_type const &x0, x_type const &x1, y_type const &y0, y_type const &y1)
Insert two rows and columns.
FunctionType const & get_function() const
Get the callable FunctionType object used as the matrix builder.
friend void h5_write(h5::group fg, std::string subgroup_name, det_manip_basic const &g)
Write a triqs::det_manip::det_manip_basic object to HDF5.
auto get_y() const
Get a vector with all matrix builder arguments .
value_type try_remove(long i, long j)
Try to remove one row and column.
auto const & get_x_internal_order() const
Get the matrix builder arguments in internal storage order.
det_manip_basic(FunctionType F, long init_size)
Construct a det_manip_basic object with a callable FunctionType and an initial capacity for the data ...
value_type inverse_matrix_internal_order(int i, int j) const
Get an element of the inverse matrix in internal storage order.
void complete_operation()
Complete the last try-operation.
value_type try_change_col_row(long i, long j, x_type const &x, y_type const &y)
Try to change one column and one row in the matrix .
matrix_type build_matrix_scratch()
Build the matrix from scratch from the stored arguments.
auto get_x() const
Get a vector with all matrix builder arguments .
value_type remove(long i, long j)
Remove one row and column.
RollDirection
Direction of the roll_matrix() operation.
nda::matrix_const_view< value_type > inverse_matrix() const
Get the full inverse matrix .
y_type const & get_y(long j) const
Get the matrix builder argument that determines the elements of the jth column.
auto size() const
Get the current size of the matrix.
auto const & get_y_internal_order() const
Get the matrix builder arguments in internal storage order.
value_type remove2(long i0, long i1, long j0, long j1)
Remove two rows and columns.
value_type change_one_row_and_one_col(long i, long j, x_type const &x, y_type const &y)
Change one row and one column.
value_type remove2_at_end()
Remove the last two rows and columns of the matrix.
nda::matrix_const_view< value_type > inverse_matrix_internal_order() const
Get the full inverse matrix in internal storage order.
value_type insert2_at_end(x_type const &x0, x_type const &x1, y_type const &y0, y_type const &y1)
Insert two rows and columns at the end of the matrix.
void reject_last_try()
Reject the last try-operation.
value_type insert_at_end(x_type const &x, y_type const &y)
Insert one row and column at the end of the matrix.
value_type insert(long i, long j, x_type const &x, y_type const &y)
Insert one row and column.
void reserve(long new_size, long new_k=1)
Reserve memory to increase the capacity of the data storages.
Compiler / platform glue and the dcomplex alias (must be included before any Boost header).
#define TRIQS_RUNTIME_ERROR
Throw a triqs::runtime_error with the current source location.
#define TRIQS_ASSERT(X)
Throw a triqs::runtime_error if the boolean expression X evaluates to false.
Type trait for a callable type with a single, non-overloaded operator().