124 return std::make_pair(
false, 0.);
127 return std::make_pair(
true, 1.0);
129 typename Matrix::value_type invscale1, invscale2;
132 const Matrix& m1 = reference[0];
133 for (
int i = 0; i <
num_rows(m1); i++)
134 for(
int j = 0; j <
num_cols(m1); j++)
136 if (std::abs(m1(i,j)) > 1.e-50) {
137 invscale1 = 1./m1(i,j);
140 if(i == (
num_rows(m1)-1) && j == (
num_cols(m1)-1)){
return std::make_pair(
false, 0.); }
143 const Matrix& m2 = sample[0];
144 for (
int i = 0; i <
num_rows(m2); i++)
145 for(
int j = 0; j <
num_cols(m2); j++)
147 if (std::abs(m2(i,j)) > 1.e-50) {
148 invscale2 = 1./m2(i,j);
151 if(i == (
num_rows(m2)-1) && j == (
num_cols(m2)-1)){
return std::make_pair(
false, 0.); }
155 for (
typename Matrix::size_type b=0; b < reference.
n_blocks(); ++b)
157 const Matrix& mb1 = reference[b];
158 const Matrix& mb2 = sample[b];
159 for (
int i = 0; i <
num_rows(mb1); i++)
160 for(
int j = 0; j <
num_cols(mb1); j++)
162 typename Matrix::value_type t1 = mb1(i,j) * invscale1, t2 = mb2(i,j) * invscale2;
163 if (std::abs(t1 - t2) > 1e-12)
164 return std::make_pair(
false, 0.);
168 typename Matrix::value_type scale = invscale1 / invscale2;
172 catch (std::exception e) { maquis::cout <<
"invscale1 numcheck failed\n"; exit(1);}
174 catch (std::exception e) { maquis::cout <<
"invscale2 numcheck failed\n"; exit(1);}
176 catch (std::exception e) { maquis::cout <<
"scale numcheck failed\n"; exit(1);}
179 return std::make_pair(
true, scale);
size_type n_blocks() const
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Index< SymmGroup > const & right_basis() const
Index< SymmGroup > const & left_basis() const
bool num_check(std::complex< double > x)