Loading src/Geometry/LongRange.h +45 −7 Original line number Diff line number Diff line Loading @@ -111,12 +111,7 @@ public: io.read(matrix_, "Connectors"); } if (matrix_.rows() != matrix_.cols()) std::cerr<<"WARNING: (LongRange) Connectors matrix isn't square\n"; if (matrix_.rows()%linSize != 0) throw RuntimeError("FATAL: (LongRange) Connectors matrix " + String("isn't divisible by number of sites\n")); checkConnectors(matrix_, linSize_); orbitals_ = matrix_.rows()/linSize; Loading Loading @@ -221,6 +216,49 @@ private: matrix_(i, j) = (i == j) ? 0 : value; } static void checkConnectors(const MatrixType& matrix, SizeType linSize) { PsimagLite::String str; if (matrix.rows() != matrix.cols()) str = "LongRange: Connectors matrix isn't square\n"; if (matrix.rows()%linSize != 0) str += "LongRange: Connectors matrix isn't divisible by number of sites\n"; if (hasDiagonal(matrix)) { str += "LongRange: Connectors matrix has non-zero diagonal value(s)\n"; } if (hasLowerTriangle(matrix)) { str += "LongRange: Connectors matrix has non-zero(es) in lower triangle\n"; } if (str.empty()) return; throw RuntimeError(str); } static bool hasDiagonal(const MatrixType& matrix) { SizeType n = matrix.rows(); if (n != matrix.cols()) return true; for (SizeType i = 0; i < n; ++i) { if (PsimagLite::norm(matrix(i, i)) != 0) return true; } return false; } static bool hasLowerTriangle(const MatrixType& matrix) { for (SizeType i = 0; i < matrix.rows(); ++i) { for (SizeType j = 0; j < i; ++j) { if (PsimagLite::norm(matrix(i, j)) != 0) return true; } } return false; } SizeType linSize_; SizeType orbitals_; SizeType maxConnections_; Loading Loading
src/Geometry/LongRange.h +45 −7 Original line number Diff line number Diff line Loading @@ -111,12 +111,7 @@ public: io.read(matrix_, "Connectors"); } if (matrix_.rows() != matrix_.cols()) std::cerr<<"WARNING: (LongRange) Connectors matrix isn't square\n"; if (matrix_.rows()%linSize != 0) throw RuntimeError("FATAL: (LongRange) Connectors matrix " + String("isn't divisible by number of sites\n")); checkConnectors(matrix_, linSize_); orbitals_ = matrix_.rows()/linSize; Loading Loading @@ -221,6 +216,49 @@ private: matrix_(i, j) = (i == j) ? 0 : value; } static void checkConnectors(const MatrixType& matrix, SizeType linSize) { PsimagLite::String str; if (matrix.rows() != matrix.cols()) str = "LongRange: Connectors matrix isn't square\n"; if (matrix.rows()%linSize != 0) str += "LongRange: Connectors matrix isn't divisible by number of sites\n"; if (hasDiagonal(matrix)) { str += "LongRange: Connectors matrix has non-zero diagonal value(s)\n"; } if (hasLowerTriangle(matrix)) { str += "LongRange: Connectors matrix has non-zero(es) in lower triangle\n"; } if (str.empty()) return; throw RuntimeError(str); } static bool hasDiagonal(const MatrixType& matrix) { SizeType n = matrix.rows(); if (n != matrix.cols()) return true; for (SizeType i = 0; i < n; ++i) { if (PsimagLite::norm(matrix(i, i)) != 0) return true; } return false; } static bool hasLowerTriangle(const MatrixType& matrix) { for (SizeType i = 0; i < matrix.rows(); ++i) { for (SizeType j = 0; j < i; ++j) { if (PsimagLite::norm(matrix(i, j)) != 0) return true; } } return false; } SizeType linSize_; SizeType orbitals_; SizeType maxConnections_; Loading