TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
triqs::det_manip::det_manip< FunctionType >

#include <triqs/det_manip/det_manip.hpp>

Detailed Description

template<typename FunctionType>
class triqs::det_manip::det_manip< FunctionType >

Manipulate determinants and ratios of determinants for CTQMC solvers.

The code and the following documentation uses the notation introduced in Determinant manipulation.

The determinant \( \det(F^{(n)}) \) or the underlying matrix \( F^{(n)} \) is manipulated by performing operations. Most of those operations are split into a try and a complete function. While the try functions only produce intermediate results that are necessary to calculate the ratio of the new to the old determinant, the complete functions actually perform the operation and update the matrix and the determinant.

The following operations are supported:

Template Parameters
FunctionTypeCallable object \( f \) that takes two arguments and returns a real or complex value. It determines the elements of the matrix via \( F^{(n)}_{ij} = f(x_i, y_j) \).

Definition at line 166 of file det_manip.hpp.

Public Types

enum  RollDirection
 Direction of the roll_matrix() operation. More...

Public Member Functions

template<typename ArgumentContainer1, typename ArgumentContainer2>
 det_manip (FunctionType F, ArgumentContainer1 const &X, ArgumentContainer2 const &Y)
 Construct a det_manip object with a callable FunctionType and two containers holding the arguments for the matrix builder.
 det_manip (FunctionType F, long init_size)
 Construct a det_manip object with a callable FunctionType and an initial capacity for the data storages.
value_type change_col (long j, y_type const &y)
 Change one column.
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 change_row (long i, x_type const &x)
 Change one row.
void clear ()
 Clear the data storages and reset the matrix to size zero.
void complete_operation ()
 Complete the last try-operation.
det_type determinant ()
 Get the determinant of the original matrix \( F^{(n)} \).
FunctionType const & get_function () const
 Get the callable FunctionType object \( f \) used as the matrix builder.
double get_n_operations_before_check () const
 Get the number of operations before a consistency check is performed.
double get_precision_error () const
 Get the precision threshold that determines when to throw an exception.
double get_precision_warning () const
 Get the precision threshold that determines when to print a warning.
double get_singular_threshold () const
 Get the threshold being used when testing for a singular matrix.
std::vector< x_type > get_x () const
 Get a vector with all matrix builder arguments \( \mathbf{x} \).
x_type const & get_x (long i) const
 Get the matrix builder argument \( x_i \) that determines the elements of the ith row in the original matrix \( F^{(n)} \).
std::vector< x_type > const & get_x_internal_order () const
 Get the matrix builder arguments \( \mathbf{x} \) in the order of the matrix \( G^{(n)} \).
std::vector< y_type > get_y () const
 Get a vector with all matrix builder arguments \( \mathbf{y} \).
y_type const & get_y (long j) const
 Get the matrix builder argument \( y_j \) that determines the elements of the jth column in the original matrix \( F^{(n)} \).
std::vector< y_type > const & get_y_internal_order () const
 Get the matrix builder arguments \( \mathbf{y} \) in the order of the matrix \( G^{(n)} \).
value_type insert (long i, long j, x_type const &x, y_type const &y)
 Insert one row and column.
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.
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.
value_type insert_at_end (x_type const &x, y_type const &y)
 Insert one row and column at the end of the matrix.
template<nda::Array X, nda::Array Y>
requires (nda::get_rank<X> == nda::get_rank<Y>)
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 \( (i, j) \) for paired elements of xs and ys.
matrix_type inverse_matrix () const
 Get the full inverse matrix \( [F^{(n)}]^{-1} \).
value_type inverse_matrix (int i, int j) const
 Get an element of the inverse matrix.
nda::matrix_const_view< value_type > inverse_matrix_internal_order () const
 Get the full inverse matrix \( M^{(n)} = [G^{(n)}]^{-1} \).
value_type inverse_matrix_internal_order (int i, int j) const
 Get an element of the matrix \( M^{(n)} = [G^{(n)}]^{-1} \).
matrix_type matrix () const
 Get the original matrix \( F^{(n)} \).
void regenerate ()
 Regenerate the inverse matrix \( M^{(n)} \), the determinant \( \det(G^{(n)}) \) and the sign \( s^{(n)} \) from scratch using the matrix builder.
void reject_last_try ()
 Reject the last try-operation.
value_type remove (long i, long j)
 Remove one row and column.
value_type remove2 (long i0, long i1, long j0, long j1)
 Remove two rows and columns.
value_type remove2_at_end ()
 Remove the last two rows and columns of the matrix.
value_type remove_at_end ()
 Remove the last row and column of the matrix.
void reserve (long new_N, long new_k=1)
 Reserve memory and resize the data storages.
int roll_matrix (RollDirection roll)
 Perform a circular shift permutation on the rows or columns of the matrix \( F^{(n)} \).
void set_n_operations_before_check (uint64_t n)
 Set the number of operations before a consistency check is performed (default: 100).
void set_precision_error (double threshold)
 Set the precision threshold that determines when to throw an exception (default: 1e-5).
void set_precision_warning (double threshold)
 Set the precision threshold that determines when to print a warning (default: 1e-8).
void set_singular_threshold (double threshold)
 Set the threshold being used when testing for a singular matrix (default: -1).
long size () const
 Get the current size of the matrix.
void swap_col (long i, long j)
 Swap two columns.
void swap_row (long i, long j)
 Swap two rows.
value_type try_change_col (long j, y_type const &y)
 Try to change one column in the original matrix \( F^{(n)} \).
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 original matrix \( F^{(n)} \).
value_type try_change_row (long i, x_type const &x)
 Try to change one row in the original matrix \( F^{(n)} \).
value_type try_insert (long i, long j, x_type const &x, y_type const &y)
 Try to insert one row and column.
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.
template<typename Fx, typename Fy>
value_type try_insert_from_function (long i, long j, Fx fx, Fy fy, value_type const ksi)
 Try to insert one row and column, providing the new elements through callables instead of the matrix builder.
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 \( k \) rows and columns.
template<typename ArgumentContainer1, typename ArgumentContainer2>
value_type try_refill (ArgumentContainer1 const &X, ArgumentContainer2 const &Y)
 Try to fill the original matrix \( F^{(n)} \) with new elements.
value_type try_remove (long i, long j)
 Try to remove one row and column.
value_type try_remove2 (long i0, long i1, long j0, long j1)
 Try to remove two rows and two columns.
value_type try_remove_k (std::vector< long > i, std::vector< long > j)
 Try to remove \( k \) rows and columns.

Friends

template<typename LambdaType>
void foreach (det_manip const &d, LambdaType const &fn)
 For-each implementation for triqs::det_manip::det_manip objects.
void h5_read (h5::group fg, std::string subgroup_name, det_manip &g)
 Read a triqs::det_manip::det_manip object from HDF5.
void h5_write (h5::group fg, std::string subgroup_name, det_manip const &g)
 Write a triqs::det_manip::det_manip object to HDF5.

Member Enumeration Documentation

◆ RollDirection

template<typename FunctionType>
enum triqs::det_manip::det_manip::RollDirection

Direction of the roll_matrix() operation.

It specifies the direction of the circular shift performed on either the rows or columns of the matrix \( F^{(n)} \). The following directions are supported:

  • None: No roll operation is performed.
  • Up: Roll the rows up (move the first row to the last, cyclically).
  • Down: Roll the rows down (move the last row to the first, cyclically).
  • Left: Roll the columns to the left (move the first column to the last, cyclically).
  • Right: Roll the columns to the right (move the last column to the first, cyclically).

Definition at line 1950 of file det_manip.hpp.

Constructor & Destructor Documentation

◆ det_manip() [1/2]

template<typename FunctionType>
triqs::det_manip::det_manip< FunctionType >::det_manip ( FunctionType F,
long init_size )
inline

Construct a det_manip object with a callable FunctionType and an initial capacity for the data storages.

Like for std::vector, the capacity grows automatically (by a factor of 2) when needed, but this can yield a performance penalty if it happens too often.

Parameters
FCallable FunctionType object (a copy is stored in the class).
init_sizeInitial capacity for the size of the matrix, i.e. the maximum number of rows and columns.

Definition at line 403 of file det_manip.hpp.

◆ det_manip() [2/2]

template<typename FunctionType>
template<typename ArgumentContainer1, typename ArgumentContainer2>
triqs::det_manip::det_manip< FunctionType >::det_manip ( FunctionType F,
ArgumentContainer1 const & X,
ArgumentContainer2 const & Y )
inline

Construct a det_manip object with a callable FunctionType and two containers holding the arguments for the matrix builder.

Template Parameters
ArgumentContainer1Container type holding the first arguments.
ArgumentContainer2Container type holding the second arguments.
Parameters
FCallable FunctionType object (a copy is stored in the class).
XContainer holding the first arguments \( \mathbf{x} \).
YContainer holding the second arguments \( \mathbf{y} \).

Definition at line 419 of file det_manip.hpp.

Member Function Documentation

◆ change_col()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::change_col ( long j,
y_type const & y )
inline

Change one column.

Wrapper for try_change_col() followed by a complete_operation() call. See try_change_col() for details.

Parameters
jPosition of the column to be changed in the original matrix \( F^{(n)} \).
yArgument to the matrix builder that determines the new elements of the column.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1903 of file det_manip.hpp.

◆ change_one_row_and_one_col()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::change_one_row_and_one_col ( long i,
long j,
x_type const & x,
y_type const & y )
inline

Change one row and one column.

Wrapper for try_change_col_row() followed by a complete_operation() call. See try_change_col_row() for details.

Parameters
iPosition of the row to be changed in the original matrix \( F^{(n)} \).
jPosition of the column to be changed in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the new elements of the row.
yArgument to the matrix builder that determines the new elements of the column.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1932 of file det_manip.hpp.

◆ change_row()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::change_row ( long i,
x_type const & x )
inline

Change one row.

Wrapper for try_change_row() followed by a complete_operation() call. See try_change_row() for details.

Parameters
iPosition of the row to be changed in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the new elements of the row.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1916 of file det_manip.hpp.

◆ complete_operation()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::complete_operation ( )
inline

Complete the last try-operation.

It completes the last try-operation by calling the correct completion function depending on the try tag set in the last try function call.

If the number of operations exceeds a certain threshold (see set_n_operations_before_check()), the inverse matrix \( M^{(n)} \), the determinant \( \det(G^{(n)}) \) and the sign \( s^{(n)} \) are regenerated using the matrix builder and checked against the stored values.

A possible warning is emitted or an exception is thrown if the current objects are not consistent with the regenerated ones (see set_precision_warning() and set_precision_error()).

Definition at line 1776 of file det_manip.hpp.

◆ determinant()

template<typename FunctionType>
det_type triqs::det_manip::det_manip< FunctionType >::determinant ( )
inline

Get the determinant of the original matrix \( F^{(n)} \).

Returns
Determinant \( \det(F^{(n)}) = s^{(n)} \det(G^{(n)}) \).

Definition at line 544 of file det_manip.hpp.

◆ get_function()

template<typename FunctionType>
FunctionType const & triqs::det_manip::det_manip< FunctionType >::get_function ( ) const
inline

Get the callable FunctionType object \( f \) used as the matrix builder.

Returns
Const reference to the stored callable.

Definition at line 538 of file det_manip.hpp.

◆ get_n_operations_before_check()

template<typename FunctionType>
double triqs::det_manip::det_manip< FunctionType >::get_n_operations_before_check ( ) const
inlinenodiscard

Get the number of operations before a consistency check is performed.

See set_n_operations_before_check() for details.

Returns
Number of operations.

Definition at line 350 of file det_manip.hpp.

◆ get_precision_error()

template<typename FunctionType>
double triqs::det_manip::det_manip< FunctionType >::get_precision_error ( ) const
inlinenodiscard

Get the precision threshold that determines when to throw an exception.

See set_precision_warning() for details.

Returns
Threshold value.

Definition at line 385 of file det_manip.hpp.

◆ get_precision_warning()

template<typename FunctionType>
double triqs::det_manip::det_manip< FunctionType >::get_precision_warning ( ) const
inlinenodiscard

Get the precision threshold that determines when to print a warning.

See set_precision_warning() for details.

Returns
Threshold value.

Definition at line 364 of file det_manip.hpp.

◆ get_singular_threshold()

template<typename FunctionType>
double triqs::det_manip::det_manip< FunctionType >::get_singular_threshold ( ) const
inlinenodiscard

Get the threshold being used when testing for a singular matrix.

See set_singular_threshold() for details.

Returns
Threshold value.

Definition at line 331 of file det_manip.hpp.

◆ get_x() [1/2]

template<typename FunctionType>
std::vector< x_type > triqs::det_manip::det_manip< FunctionType >::get_x ( ) const
inline

Get a vector with all matrix builder arguments \( \mathbf{x} \).

Warning: this is slow, since it creates a new copy and reorders the rows.

Returns
std::vector containing the arguments \( x_i \) in the order of the original matrix \( F^{(n)} \).

Definition at line 497 of file det_manip.hpp.

◆ get_x() [2/2]

template<typename FunctionType>
x_type const & triqs::det_manip::det_manip< FunctionType >::get_x ( long i) const
inline

Get the matrix builder argument \( x_i \) that determines the elements of the ith row in the original matrix \( F^{(n)} \).

Parameters
iArgument index.
Returns
Argument value \( x_i \).

Definition at line 482 of file det_manip.hpp.

◆ get_x_internal_order()

template<typename FunctionType>
std::vector< x_type > const & triqs::det_manip::det_manip< FunctionType >::get_x_internal_order ( ) const
inline

Get the matrix builder arguments \( \mathbf{x} \) in the order of the matrix \( G^{(n)} \).

Advanced: this is the internal storage order, which differs by some permutation from the order given by the user. Useful for some performance-critical loops, to be used together with the other *_internal_order functions.

Returns
std::vector containing the arguments \( x_i \).

Definition at line 525 of file det_manip.hpp.

◆ get_y() [1/2]

template<typename FunctionType>
std::vector< y_type > triqs::det_manip::det_manip< FunctionType >::get_y ( ) const
inline

Get a vector with all matrix builder arguments \( \mathbf{y} \).

Warning: this is slow, since it creates a new copy and reorders the columns.

Returns
std::vector containing the arguments \( y_j \) in the order of the original matrix \( F^{(n)} \).

Definition at line 509 of file det_manip.hpp.

◆ get_y() [2/2]

template<typename FunctionType>
y_type const & triqs::det_manip::det_manip< FunctionType >::get_y ( long j) const
inline

Get the matrix builder argument \( y_j \) that determines the elements of the jth column in the original matrix \( F^{(n)} \).

Parameters
jArgument index.
Returns
Argument value \( y_j \).

Definition at line 490 of file det_manip.hpp.

◆ get_y_internal_order()

template<typename FunctionType>
std::vector< y_type > const & triqs::det_manip::det_manip< FunctionType >::get_y_internal_order ( ) const
inline

Get the matrix builder arguments \( \mathbf{y} \) in the order of the matrix \( G^{(n)} \).

See get_x_internal_order() for details.

Returns
std::vector containing the arguments \( y_j \).

Definition at line 532 of file det_manip.hpp.

◆ insert()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::insert ( long i,
long j,
x_type const & x,
y_type const & y )
inline

Insert one row and column.

Wrapper for try_insert() followed by a complete_operation() call. See try_insert() for details.

Parameters
iPosition of the row to be inserted in the original matrix \( F^{(n)} \).
jPosition of the column to be inserted in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the elements of the new row.
yArgument to the matrix builder that determines the elements of the new column.
Returns
Determinant ratio \( \det(F^{(n+1)}) / \det(F^{(n)}) \).

Definition at line 1815 of file det_manip.hpp.

◆ insert2()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::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 )
inline

Insert two rows and columns.

Wrapper for try_insert2() followed by a complete_operation() call. See try_insert2() for details.

Parameters
i0,i1Positions of the rows to be inserted in the original matrix \( F^{(n)} \).
j0,j1Positions of the columns to be inserted in the original matrix \( F^{(n)} \).
x0,x1Arguments to the matrix builder that determine the elements of the new rows.
y0,y1Arguments to the matrix builder that determine the elements of the new columns.
Returns
Determinant ratio \( \det(F^{(n+2)}) / \det(F^{(n)}) \).

Definition at line 1839 of file det_manip.hpp.

◆ insert2_at_end()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::insert2_at_end ( x_type const & x0,
x_type const & x1,
y_type const & y0,
y_type const & y1 )
inline

Insert two rows and columns at the end of the matrix.

Same as insert2() but with i0 and j0 set to size() and i1 and j1 set to size() + 1.

Parameters
x0,x1Arguments to the matrix builder that determine the elements of the new rows.
y0,y1Arguments to the matrix builder that determine the elements of the new columns.
Returns
Determinant ratio \( \det(F^{(n+2)}) / \det(F^{(n)}) \).

Definition at line 1852 of file det_manip.hpp.

◆ insert_at_end()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::insert_at_end ( x_type const & x,
y_type const & y )
inline

Insert one row and column at the end of the matrix.

Same as insert() but with i and j set to size().

Parameters
xArgument to the matrix builder that determines the elements of the new row.
yArgument to the matrix builder that determines the elements of the new column.
Returns
Determinant ratio \( \det(F^{(n+1)}) / \det(F^{(n)}) \).

Definition at line 1828 of file det_manip.hpp.

◆ insert_ratios()

template<typename FunctionType>
template<nda::Array X, nda::Array Y>
requires (nda::get_rank<X> == nda::get_rank<Y>)
auto triqs::det_manip::det_manip< FunctionType >::insert_ratios ( long i,
long j,
X const & xs,
Y const & ys ) const->nda::array< value_type, nda::get_rank< X > >
inline

Compute independent single-insertion determinant ratios at position \( (i, j) \) for paired elements of xs and ys.

For each pair (xs[m], ys[m]) it computes the determinant ratio that a single try_insert() at position \( (i, j) \) would produce, without modifying the internal state. The inputs must be nda::Array objects with the same rank and shape, and the result has the same shape.

Template Parameters
Xnda::Array type of the first arguments.
Ynda::Array type of the second arguments.
Parameters
iPosition of the row to be inserted in the original matrix \( F^{(n)} \).
jPosition of the column to be inserted in the original matrix \( F^{(n)} \).
xsArray of first arguments to the matrix builder.
ysArray of second arguments to the matrix builder.
Returns
Array of determinant ratios with the same shape as xs and ys.

Definition at line 975 of file det_manip.hpp.

◆ inverse_matrix() [1/2]

template<typename FunctionType>
matrix_type triqs::det_manip::det_manip< FunctionType >::inverse_matrix ( ) const
inline

Get the full inverse matrix \( [F^{(n)}]^{-1} \).

See inverse_matrix(int, int) for details. Warning: this is slow, since it creates a new copy and reorders the rows/columns.

Returns
The inverse matrix \( [F^{(n)}]^{-1} \).

Definition at line 570 of file det_manip.hpp.

◆ inverse_matrix() [2/2]

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::inverse_matrix ( int i,
int j ) const
inline

Get an element of the inverse matrix.

The inverse matrix is given by

\[ [F^{(n)}]^{-1} = (P^{(n)}_r G^{(n)} P^{(n)}_c)^{-1} = [P^{(n)}_c]^T [G^{(n)}]^{-1} [P^{(n)}_r]^T \; . \]

Parameters
iRow index.
jColumn index.
Returns
The matrix element \( [F^{(n)}]^{-1}_{ij} \).

Definition at line 562 of file det_manip.hpp.

◆ inverse_matrix_internal_order() [1/2]

template<typename FunctionType>
nda::matrix_const_view< value_type > triqs::det_manip::det_manip< FunctionType >::inverse_matrix_internal_order ( ) const
inline

Get the full inverse matrix \( M^{(n)} = [G^{(n)}]^{-1} \).

Advanced: uses the internal storage order, see get_x_internal_order().

Returns
The inverse matrix \( M^{(n)} \).

Definition at line 591 of file det_manip.hpp.

◆ inverse_matrix_internal_order() [2/2]

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::inverse_matrix_internal_order ( int i,
int j ) const
inline

Get an element of the matrix \( M^{(n)} = [G^{(n)}]^{-1} \).

Advanced: uses the internal storage order, see get_x_internal_order().

Parameters
iRow index.
jColumn index.
Returns
The matrix element \( M^{(n)}_{ij} \).

Definition at line 584 of file det_manip.hpp.

◆ matrix()

template<typename FunctionType>
matrix_type triqs::det_manip::det_manip< FunctionType >::matrix ( ) const
inline

Get the original matrix \( F^{(n)} \).

Warning: this is slow, since it creates a new matrix and re-evaluates the matrix builder.

Returns
The original matrix \( F^{(n)} \).

Definition at line 598 of file det_manip.hpp.

◆ regenerate()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::regenerate ( )
inline

Regenerate the inverse matrix \( M^{(n)} \), the determinant \( \det(G^{(n)}) \) and the sign \( s^{(n)} \) from scratch using the matrix builder.

It uses the matrix builder to rebuild the matrix \( G^{(n)} \), then computes its inverse \( M^{(n)} \) and its determinant \( \det(G^{(n)}) \), and recomputes the sign \( s^{(n)} \) associated with the permutation matrices. This is used to counteract the accumulation of numerical errors after many try/complete operations.

The consistency check against the stored values (see set_precision_warning(), set_precision_error() and set_singular_threshold()) is performed automatically in complete_operation() after a configurable number of operations (see set_n_operations_before_check()); this function itself does not perform that check.

Definition at line 1760 of file det_manip.hpp.

◆ reject_last_try()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::reject_last_try ( )
inline

Reject the last try-operation.

All try_* operations have to be either accepted (via complete_operation()) or rejected.

Definition at line 1801 of file det_manip.hpp.

◆ remove()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::remove ( long i,
long j )
inline

Remove one row and column.

Wrapper for try_remove() followed by a complete_operation() call. See try_remove() for details.

Parameters
iPosition of the row to be removed in the original matrix \( F^{(n)} \).
jPosition of the column to be removed in the original matrix \( F^{(n)} \).
Returns
Determinant ratio \( \det(F^{(n-1)}) / \det(F^{(n)}) \).

Definition at line 1863 of file det_manip.hpp.

◆ remove2()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::remove2 ( long i0,
long i1,
long j0,
long j1 )
inline

Remove two rows and columns.

Wrapper for try_remove2() followed by a complete_operation() call. See try_remove2() for details.

Parameters
i0,i1Positions of the rows to be removed in the original matrix \( F^{(n)} \).
j0,j1Positions of the columns to be removed in the original matrix \( F^{(n)} \).
Returns
Determinant ratio \( \det(F^{(n-2)}) / \det(F^{(n)}) \).

Definition at line 1883 of file det_manip.hpp.

◆ remove2_at_end()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::remove2_at_end ( )
inline

Remove the last two rows and columns of the matrix.

Same as remove2() but with i0 and j0 set to size() - 1 and i1 and j1 set to size() - 2.

Returns
Determinant ratio \( \det(F^{(n-2)}) / \det(F^{(n)}) \).

Definition at line 1894 of file det_manip.hpp.

◆ remove_at_end()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::remove_at_end ( )
inline

Remove the last row and column of the matrix.

Same as remove() but with i and j set to size() - 1.

Returns
Determinant ratio \( \det(F^{(n-1)}) / \det(F^{(n)}) \).

Definition at line 1874 of file det_manip.hpp.

◆ reserve()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::reserve ( long new_N,
long new_k = 1 )
inline

Reserve memory and resize the data storages.

Like for std::vector, this reserves memory for a bigger matrix size. It only reserves/resizes if the requested capacity is larger than the current one. It preserves the matrix \( M^{(n)} \) but not the temporary working data, so it must NOT be called between a try_* function and the corresponding complete_operation().

Parameters
new_NNew capacity for the size of the matrix, i.e. the maximum number of rows and columns.
new_kMaximum number of rows and columns inserted or removed in a single operation. It sizes the working data used by the try_*_k functions.

Definition at line 303 of file det_manip.hpp.

◆ roll_matrix()

template<typename FunctionType>
int triqs::det_manip::det_manip< FunctionType >::roll_matrix ( RollDirection roll)
inline

Perform a circular shift permutation on the rows or columns of the matrix \( F^{(n)} \).

See RollDirection for the supported directions. This routine is not a try_* operation: it does make the modification and does not need to be completed.

A circular shift permutation of a finite set is equivalent to \( N \) transpositions, where \( N \) is the size of the set. The sign of the permutation is therefore given by \( (-1)^{N-1} \).

Parameters
rollDirection of the roll operation.
Returns
-1 if the roll changes the sign of the determinant, 1 otherwise.

Definition at line 1964 of file det_manip.hpp.

◆ set_n_operations_before_check()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::set_n_operations_before_check ( uint64_t n)
inline

Set the number of operations before a consistency check is performed (default: 100).

See complete_operation(), which triggers the check once the counter exceeds this number.

Parameters
nNumber of operations.

Definition at line 357 of file det_manip.hpp.

◆ set_precision_error()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::set_precision_error ( double threshold)
inline

Set the precision threshold that determines when to throw an exception (default: 1e-5).

See set_precision_warning() for details.

Parameters
thresholdThreshold value.

Definition at line 392 of file det_manip.hpp.

◆ set_precision_warning()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::set_precision_warning ( double threshold)
inline

Set the precision threshold that determines when to print a warning (default: 1e-8).

In case we compare two matrices \( A \) and \( B \), a warning is printed when \( 2 \lVert A - B \rVert >= \epsilon \left( \lVert A \rVert + \lVert B \rVert \right) \), where \( \lVert \cdot \rVert \) is the max norm.

In case we compare two scalar values \( a \) and \( b \), a warning is printed when \( 2 |a - b| >= \epsilon (|a| + |b|) \).

Parameters
thresholdThreshold value.

Definition at line 378 of file det_manip.hpp.

◆ set_singular_threshold()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::set_singular_threshold ( double threshold)
inline

Set the threshold being used when testing for a singular matrix (default: -1).

The threshold \( \epsilon \) determines when a matrix \( M \) is considered singular. A matrix is considered to be singular if \( |\det(M)| < \epsilon \).

If \( \epsilon \) is negative, it simply checks if the determinant is not std::isnormal.

Parameters
thresholdThreshold value.

Definition at line 343 of file det_manip.hpp.

◆ size()

template<typename FunctionType>
long triqs::det_manip::det_manip< FunctionType >::size ( ) const
inlinenodiscard

Get the current size of the matrix.

Returns
Number of rows/columns of the matrix.

Definition at line 474 of file det_manip.hpp.

◆ swap_col()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::swap_col ( long i,
long j )
inline

Swap two columns.

It simply performs the transposition in the column permutation vector and changes the sign \( s^{(n)} \) associated with the permutation matrices. It is very quick: we just change the permutation table internally, and this operation is so simple that it has no try/complete step.

Since we are only changing the matrix \( P^{(n)}_c \), the matrix \( G^{(n)} \) and its determinant remain unchanged.

Parameters
iIndex of the first column to swap.
jIndex of the second column to swap.

Definition at line 655 of file det_manip.hpp.

◆ swap_row()

template<typename FunctionType>
void triqs::det_manip::det_manip< FunctionType >::swap_row ( long i,
long j )
inline

Swap two rows.

It simply performs the transposition in the row permutation vector and changes the sign \( s^{(n)} \) associated with the permutation matrices. It is very quick: we just change the permutation table internally, and this operation is so simple that it has no try/complete step.

Since we are only changing the matrix \( P^{(n)}_r \), the matrix \( G^{(n)} \) and its determinant remain unchanged.

Parameters
iIndex of the first row to swap.
jIndex of the second row to swap.

Definition at line 635 of file det_manip.hpp.

◆ try_change_col()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_change_col ( long j,
y_type const & y )
inline

Try to change one column in the original matrix \( F^{(n)} \).

The column to be changed is at position \( j \) in the original matrix \( F^{(n)} \). The new elements of the columns are determined by the given matrix builder argument \( y \).

Let \( j_p \) be the position of the column in the matrix \( G^{(n)} \). We can write the new matrix as

\[ \widetilde{G}^{(n)} = G^{(n)} + \mathbf{u} \mathbf{v}^T \; , \]

where \( u_i = f(x_i, y) - f(x_i, y_{j_p}) \) and \( \mathbf{v} = \mathbf{e}_{j_p} \) is a cartesian basis vector.

The new inverse matrix \( \widetilde{M}^{(n)} \) is then given by the Sherman-Morrison formula

\[ \widetilde{M}^{(n)} = M^{(n)} - \frac{M^{(n)} \mathbf{u} \mathbf{v}^T M^{(n)}}{1 + \mathbf{v}^T M^{(n)} \mathbf{u}} \; , \]

and the new determinant by the matrix determinant lemma

\[ \det(\widetilde{G}^{(n)}) = \det(G^{(n)}) \left( 1 + \mathbf{v}^T M^{(n)} \mathbf{u} \right) = \det(G^{(n)}) \xi \; . \]

The function returns the ratio

\[ R = \frac{\det(\widetilde{F}^{(n)})}{\det(F^{(n)})} = \left( 1 + \mathbf{v}^T M^{(n)} \mathbf{u} \right) \; . \]

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
jPosition of the column to be changed in the original matrix \( F^{(n)} \).
yArgument to the matrix builder that determines the new elements of the column.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1375 of file det_manip.hpp.

◆ try_change_col_row()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_change_col_row ( long i,
long j,
x_type const & x,
y_type const & y )
inline

Try to change one column and one row in the original matrix \( F^{(n)} \).

The row and column to be changed are at positions \( i \) and \( j \) in the original matrix \( F^{(n)} \), respectively. The new elements of the row and column are determined by the given matrix builder arguments \( x \) and \( y \).

Let \( i_p \) and \( j_p \) be the positions of the row and the column in the matrix \( G^{(n)} \). We can write the new matrix as

\[ \widetilde{G}^{(n)} = G^{(n)} + \mathbf{r} \mathbf{s}^T + \mathbf{u} \mathbf{v}^T \; , \]

where

  • \( \mathbf{r} = \mathbf{e}_{i_p} \),
  • \( s_k = f(x, y_k) - f(x_{i_p}, y_k) \) except for \( s_{j_p} = f(x, y) - f(x_{i_p}, y_{j_p}) \),
  • \( u_l = f(x_l, y) - f(x_l, y_{j_p}) \) except for \( u_{i_p} = 0 \), and
  • \( \mathbf{v} = \mathbf{e}_{j_p} \).

By using the matrix determinant lemma twice and once the Sherman-Morrison formula, we find for the new determinant

\[ \det(\widetilde{G}^{(n)}) = \det(G^{(n)}) \left[ (1 + \mathbf{s}^T M^{(n)} \mathbf{r}) (1 + \mathbf{v}^T M^{(n)} \mathbf{u}) - M^{(n)}_{j_p i_p} \mathbf{s}^T M^{(n)} \mathbf{u} \right] = \det(G^{(n)}) \left[ (1 + \alpha)(1 + \beta) - M^{(n)}_{j_p i_p} \gamma \right] = \det(G^{(n)}) \xi \; . \]

The new inverse matrix \( \widetilde{M}^{(n)} \) can be obtained by applying the Sherman-Morrison formula twice:

\[ \widetilde{M}^{(n)} = H^{-1} - \frac{H^{-1} \mathbf{u} \mathbf{v}^T H^{-1}}{1 + \mathbf{v}^T H^{-1} \mathbf{u}} \; , \]

where

\[ H^{-1} = M^{(n)} - \frac{M^{(n)} \mathbf{r} \mathbf{s}^T M^{(n)}}{1 + \mathbf{s}^T M^{(n)} \mathbf{r}} \; . \]

After some algebra, we find for its elements

\[ \widetilde{M}^{(n)}_{ab} = M^{(n)}_{ab} - \frac{(1 + \alpha) (M^{(n)} \mathbf{u})_a M^{(n)}_{j_p b}}{\xi} + \frac{M^{(n)}_{j_p i_p} (M^{(n)} \mathbf{u})_a (\mathbf{s}^T M^{(n)})_b}{\xi} + \frac{\gamma M^{(n)}_{a i_p} M^{(n)}_{j_p b}}{\xi} - \frac{(1 + \beta) (\mathbf{s}^T M^{(n)})_b M^{(n)}_{a i_p}}{\xi} \; . \]

The function returns the ratio

\[ R = \frac{\det(\widetilde{F}^{(n)})}{\det(F^{(n)})} = \xi \; . \]

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPosition of the row to be changed in the original matrix \( F^{(n)} \).
jPosition of the column to be changed in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the new elements of the row.
yArgument to the matrix builder that determines the new elements of the column.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1531 of file det_manip.hpp.

◆ try_change_row()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_change_row ( long i,
x_type const & x )
inline

Try to change one row in the original matrix \( F^{(n)} \).

The row to be changed is at position \( i \) in the original matrix \( F^{(n)} \). The new elements of the row are determined by the given matrix builder argument \( x \).

We follow the same procedure as in try_change_col(), except that we use \( v_i = f(x, y_j) - f(x_{i_p}, y_j) \) and \( \mathbf{u} = \mathbf{e}_{i_p} \) is a cartesian basis vector.

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPosition of the row to be changed in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the new elements of the row.
Returns
Determinant ratio \( \det(\widetilde{F}^{(n)}) / \det(F^{(n)}) \).

Definition at line 1432 of file det_manip.hpp.

◆ try_insert()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_insert ( long i,
long j,
x_type const & x,
y_type const & y )
inline

Try to insert one row and column.

The row is inserted at position \( i \) and the column at position \( j \) in the original matrix \( F^{(n)} \). Their elements are determined by the given matrix builder arguments \( x \) and \( y \).

The new column/row will be at column \( j \), row \( i \), with \( 0 \leq i, j \leq n \). The current column \( j \) (resp. row \( i \)) becomes column \( j + 1 \) (resp. row \( i + 1 \)). Inserting at \( n \) simply adds the new row/column at the end.

This is a special case of try_insert_k() with \( k = 1 \).

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPosition of the row to be inserted in the original matrix \( F^{(n)} \).
jPosition of the column to be inserted in the original matrix \( F^{(n)} \).
xArgument to the matrix builder that determines the elements of the new row.
yArgument to the matrix builder that determines the elements of the new column.
Returns
Determinant ratio \( \det(F^{(n+1)}) / \det(F^{(n)}) \).

Definition at line 681 of file det_manip.hpp.

◆ try_insert2()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::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 )
inline

Try to insert two rows and columns.

The rows are inserted at the positions \( i_0 \) and \( i_1 \) and the columns at the positions \( j_0 \) and \( j_1 \) in the original matrix \( F^{(n)} \). Their elements are determined by the given matrix builder arguments \( x_0 \), \( x_1 \), \( y_0 \) and \( y_1 \).

It simply calls the more general try_insert_k().

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
i0Position of the first row to be inserted in the original matrix \( F^{(n)} \).
i1Position of the second row to be inserted in the original matrix \( F^{(n)} \).
j0Position of the first column to be inserted in the original matrix \( F^{(n)} \).
j1Position of the second column to be inserted in the original matrix \( F^{(n)} \).
x0Argument to the matrix builder that determines the elements of the first new row.
x1Argument to the matrix builder that determines the elements of the second new row.
y0Argument to the matrix builder that determines the elements of the first new column.
y1Argument to the matrix builder that determines the elements of the second new column.
Returns
Determinant ratio \( \det(F^{(n+2)}) / \det(F^{(n)}) \).

Definition at line 943 of file det_manip.hpp.

◆ try_insert_from_function()

template<typename FunctionType>
template<typename Fx, typename Fy>
value_type triqs::det_manip::det_manip< FunctionType >::try_insert_from_function ( long i,
long j,
Fx fx,
Fy fy,
value_type const ksi )
inline

Try to insert one row and column, providing the new elements through callables instead of the matrix builder.

Like try_insert(), but the elements of the new row and column are supplied directly: fx gives the new row coefficients \( f(x_l, y) \), fy gives the new column coefficients \( f(x, y_l) \), and ksi is the corner element \( f(x, y) \) at the intersection of the new row and column.

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Template Parameters
FxCallable type for the new row coefficients.
FyCallable type for the new column coefficients.
Parameters
iPosition of the row to be inserted in the original matrix \( F^{(n)} \).
jPosition of the column to be inserted in the original matrix \( F^{(n)} \).
fxCallable returning the new row coefficient for a given argument \( x_l \).
fyCallable returning the new column coefficient for a given argument \( y_l \).
ksiCorner element at the intersection of the new row and column.
Returns
Determinant ratio \( \det(F^{(n+1)}) / \det(F^{(n)}) \).

Definition at line 735 of file det_manip.hpp.

◆ try_insert_k()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_insert_k ( std::vector< long > i,
std::vector< long > j,
std::vector< x_type > x,
std::vector< y_type > y )
inline

Try to insert \( k \) rows and columns.

The positions of the new rows and columns in the original matrix \( F^{(n+k)} \) are specified in the tuples \( \mathbf{i} \) and \( \mathbf{j} \), respectively. Their elements are determined by the given matrix builder arguments \( \mathbf{x} \) and \( \mathbf{y} \).

Since we are working with \( G^{(n)} \), we are free to insert the rows and columns at the bottom and right of the matrix and use the update formulas presented in Determinant manipulation.

We use the following order for the rows and columns to be inserted:

  • The first row (column) in \( C \) ( \( B \)) corresponds to the row (column) with the smallest index in the matrix \( F^{(n)} \).
  • The second row (column) in \( C \) ( \( B \)) corresponds to the row (column) with the second smallest index in the matrix \( F^{(n)} \).
  • And so on.

The expression for the new determinant \( \det(G^{(n+k)}) \) can be found at Determinant manipulation and the new sign associated with the permutation matrices can be written as

\[ s^{(n+k)} = \det(P^{(n)}_r) \det(P^{(n)}_c) \det(P1) \det(P2) = s^{(n)} \det(P1) \det(P2) \; , \]

where \( P1 \) and \( P2 \) are permutation matrices that move the inserted rows and columns to their respective positions in the original matrix \( F^{(n)} \).

The function returns the ratio

\[ R = \frac{\det(F^{(n+k)})}{\det(F^{(n)})} = \frac{\det(G^{(n+k)}) s^{(n+k)}}{\det(G^{(n)}) s^{(n)}} = \det(D - C M^{(n)} B) s^{(n+k)} s^{(n)} = \det(S^{-1}) s^{(n+k)} s^{(n)} \; , \]

where we used the fact that \( s^{(n)} = 1 / s^{(n)} \).

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPositions of the rows to be inserted in the original matrix \( F^{(n)} \).
jPositions of the columns to be inserted in the original matrix \( F^{(n)} \).
xArguments to the matrix builder that determine the elements of the new rows.
yArguments to the matrix builder that determine the elements of the new columns.
Returns
Determinant ratio \( \det(F^{(n+k)}) / \det(F^{(n)}) \).

Definition at line 857 of file det_manip.hpp.

◆ try_refill()

template<typename FunctionType>
template<typename ArgumentContainer1, typename ArgumentContainer2>
value_type triqs::det_manip::det_manip< FunctionType >::try_refill ( ArgumentContainer1 const & X,
ArgumentContainer2 const & Y )
inline

Try to fill the original matrix \( F^{(n)} \) with new elements.

This function tries to build a completely new matrix \( \widetilde{F}^{(\widetilde{n})} \) using the given matrix builder arguments \( \mathbf{x} \) and \( \mathbf{y} \). The new elements are calculated as \( \widetilde{F}_{ij} = f(x_i, y_j) \).

The function returns the ratio

\[ R = \frac{\det(\widetilde{F}^{(\widetilde{n})})}{\det(F^{(n)})} \; . \]

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Template Parameters
ArgumentContainer1Container type holding the first arguments.
ArgumentContainer2Container type holding the second arguments.
Parameters
XContainer holding the first matrix builder arguments.
YContainer holding the second matrix builder arguments.
Returns
Determinant ratio \( \det(\widetilde{F}^{(\widetilde{n})}) / \det(F^{(n)}) \).

Definition at line 1625 of file det_manip.hpp.

◆ try_remove()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_remove ( long i,
long j )
inline

Try to remove one row and column.

The row to be removed is at position \( i \) and the column at position \( j \) in the original matrix \( F^{(n)} \).

This is a special case of try_remove_k() with \( k = 1 \).

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPosition of the row to be removed in the original matrix \( F^{(n)} \).
jPosition of the column to be removed in the original matrix \( F^{(n)} \).
Returns
Determinant ratio \( \det(F^{(n-1)}) / \det(F^{(n)}) \).

Definition at line 1088 of file det_manip.hpp.

◆ try_remove2()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_remove2 ( long i0,
long i1,
long j0,
long j1 )
inline

Try to remove two rows and two columns.

The rows to be removed are specified by the indices \( i_0 \) and \( i_1 \), and the columns by the indices \( j_0 \) and \( j_1 \). The positions are given w.r.t. the original matrix \( F^{(n)} \).

It simply calls the more general try_remove_k().

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
i0Position of the first row to be removed in the original matrix \( F^{(n)} \).
i1Position of the second row to be removed in the original matrix \( F^{(n)} \).
j0Position of the first column to be removed in the original matrix \( F^{(n)} \).
j1Position of the second column to be removed in the original matrix \( F^{(n)} \).
Returns
Determinant ratio \( \det(F^{(n-2)}) / \det(F^{(n)}) \).

Definition at line 1277 of file det_manip.hpp.

◆ try_remove_k()

template<typename FunctionType>
value_type triqs::det_manip::det_manip< FunctionType >::try_remove_k ( std::vector< long > i,
std::vector< long > j )
inline

Try to remove \( k \) rows and columns.

The rows to be removed are specified in the tuple \( \mathbf{i} \) and the columns in the tuple \( \mathbf{j} \). The positions are given w.r.t. the original matrix \( F^{(n)} \). The corresponding positions in the matrix \( G^{(n)} \) are denoted by \( \mathbf{i}_p \) and \( \mathbf{j}_p \), respectively.

Since we are working with \( G^{(n)} \), we are free to first move the rows and columns to the bottom and to the right of the matrix and use the update formulas presented in Determinant manipulation.

More specifically, we introduce the matrix

\[ \widetilde{G}^{(n)} = P_1 G^{(n)} P_2 = \begin{bmatrix} \widetilde{G}^{(n-k)} & B \\ C & D \end{bmatrix} \; , \]

where \( P_1 \) and \( P_2 \) are permutation matrices that swap the rows and columns to be removed (contained in the matrices \( B \), \( C \) and \( D \)) with the bottom rows and the right most columns of the matrix. \( \widetilde{G}^{(n-k)} \) is the resulting matrix after the remove operation.

We use the following order for the rows and columns to be removed:

  • The first row (column) in \( C \) ( \( B \)) corresponds to the row (column) with the smallest index in the matrix \( F^{(n)} \).
  • The second row (column) in \( C \) ( \( B \)) corresponds to the row (column) with the second smallest index in the matrix \( F^{(n)} \).
  • And so on.

The original matrix can be written as

\[ \begin{split} F^{(n)} &= P^{(n)}_r G^{(n)} P^{(n)}_c = P^{(n)}_r P_1^{-1} [P_1 G^{(n)} P_2] P_2^{-1} P^{(n)}_c = \widetilde{P}^{(n)}_r \widetilde{G}^{(n)} \widetilde{P}^{(n)}_c \\ &= P_3 \begin{bmatrix} P^{(n-k)}_r & 0 \\ 0 & I \end{bmatrix} \begin{bmatrix} \widetilde{G}^{(n-k)} & B \\ C & D \end{bmatrix} \begin{bmatrix} P^{(n-k)}_c & 0 \\ 0 & I \end{bmatrix} P_4 \; , \end{split} \]

where \( P_3 \) and \( P_4 \) are permutation matrices that move the rows and columns in \( B \), \( C \) and \( D \) back to their original positions in the matrix \( F^{(n)} \).

We can therefore write the determinant of the resulting matrix \( \widetilde{G}^{(n-k)} \) in terms of the determinant of the current matrix \( G^{(n)} \)

\[ \det(\widetilde{G}^{(n-k)}) = \det(\widetilde{G}^{(n)}) \det(S) = \det(P_1) \det(G^{(n)}) \det(P_2) \det(S) \; , \]

and the new sign \( \widetilde{s}^{(n-k)} \) in terms of the current sign \( s^{(n)} \):

\[ \begin{split} \widetilde{s}^{(n-k)} &= \det(\widetilde{P}^{(n-k)}_r) \det(\widetilde{P}^{(n-k)}_c) = \det(P_3) \det(\widetilde{P}^{(n)}_r) \det(\widetilde{P}^{(n)}_c) \det(P_4) \\ &= \det(P_3) \det(P^{(n)}_r) \det(P_1) \det(P_2) \det(P^{(n)}_c) \det(P_4) = s^{(n)} \det(P_1) \det(P_2) \det(P_3) \det(P_4) \; . \end{split} \]

Here, we used the fact that \( \det(P) = \det(P^{-1}) \) for a permutation matrix \( P \).

The function returns the ratio

\[ R = \frac{\det(F^{(n-k)})}{\det(F^{(n)})} = \frac{\det(\widetilde{G}^{(n-k)}) \widetilde{s}^{(n-k)}}{ \det(G^{(n)}) s^{(n)}} = \det(S) \det(P_3) \det(P_4) \; . \]

Warning
This routine does not make any modification. It has to be completed with complete_operation().
Parameters
iPositions of the rows to be removed in the original matrix \( F^{(n)} \).
jPositions of the columns to be removed in the original matrix \( F^{(n)} \).
Returns
Determinant ratio \( \det(F^{(n-k)}) / \det(F^{(n)}) \).

Definition at line 1223 of file det_manip.hpp.

◆ foreach

template<typename FunctionType>
template<typename LambdaType>
void foreach ( det_manip< FunctionType > const & d,
LambdaType const & fn )
friend

For-each implementation for triqs::det_manip::det_manip objects.

It loops over all elements of the matrix \( M^{(n)} \) and calls the given callable object for each element together with the corresponding arguments \( x_i \) and \( y_j \). The order of iteration is not fixed; it is optimised for memory traversal.

Template Parameters
LambdaTypeCallable type.
Parameters
dtriqs::det_manip::det_manip object.
fnCallable object that takes three arguments: \( x_i \), \( y_j \), and \( M_{ji} \).

Definition at line 616 of file det_manip.hpp.

◆ h5_read

template<typename FunctionType>
void h5_read ( h5::group fg,
std::string subgroup_name,
det_manip< FunctionType > & g )
friend

Read a triqs::det_manip::det_manip object from HDF5.

Parameters
fgh5::group containing the subgroup to be read from.
subgroup_nameName of the subgroup.
gManipulator object to be read into.

Definition at line 238 of file det_manip.hpp.

◆ h5_write

template<typename FunctionType>
void h5_write ( h5::group fg,
std::string subgroup_name,
det_manip< FunctionType > const & g )
friend

Write a triqs::det_manip::det_manip object to HDF5.

Parameters
fgh5::group containing the subgroup to be written to.
subgroup_nameName of the subgroup.
gManipulator object to be written.

Definition at line 216 of file det_manip.hpp.


The documentation for this class was generated from the following file: