3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 11:13:46 +01:00

bug in a det_manip constructor (from vectors for x and y values) corrected

This commit is contained in:
Laura Messio 2013-12-18 11:21:39 +01:00
parent 1a0ebea512
commit 477f5f4ea1
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
#include <triqs/det_manip/det_manip.hpp>
struct fun {
typedef double result_type;
typedef double argument_type;
//gives the coefficients of the matrix (function F of the documentation)
double operator()(double x, double y) const {
return(x-y);
}
};
int main() {
fun f;
int init_size=10;
std::vector<double> initial_x{1,2,2.5}, initial_y{3,4,9};
//creation of an empty class det_manip
triqs::det_manip::det_manip<fun> D1(f, init_size);
//creation of a class det_manip with a 3 by 3 matrix
triqs::det_manip::det_manip<fun> D2(f, initial_x, initial_y);
//the initial matrix:
std::cout<<std::endl<< "After construction: D.matrix()=" << D1.matrix()<<std::endl;
std::cout<<std::endl<< "After construction: D.matrix()=" << D2.matrix()<<std::endl;
}

View File

@ -206,7 +206,7 @@ namespace triqs { namespace det_manip {
* \param X, Y : container for X,Y.
*/
template<typename ArgumentContainer1, typename ArgumentContainer2>
det_manip(FunctionType F, ArgumentContainer1 const & X, ArgumentContainer2 const & Y) : f(std::move(F)) {
det_manip(FunctionType F, ArgumentContainer1 const & X, ArgumentContainer2 const & Y) : f(std::move(F)), Nmax(0) {
if (X.size() != Y.size()) TRIQS_RUNTIME_ERROR<< " X.size != Y.size";
_construct_common();
N =X.size();