Go to the source code of this file.
◆ REAL_EQUALS
#define REAL_EQUALS |
( |
|
real_t | ) |
|
Value:template <> \
bool SGMatrix<real_t>::equals(const SGMatrix<real_t>& other) const \
{ \
if (*this==other) \
return true; \
\
if (matrix==nullptr || other.matrix==nullptr) \
return false; \
\
if (num_rows!=other.num_rows || num_cols!=other.num_cols) \
return false; \
\
return std::equal(matrix, matrix+size(), other.matrix, \
[](const real_t& a, const real_t& b) \
{ \
return CMath::fequals<real_t>(a, b, std::numeric_limits<real_t>::epsilon()); \
}); \
}
Definition at line 162 of file SGMatrix.cpp.
◆ REAL_IS_SYMMETRIC
#define REAL_IS_SYMMETRIC |
( |
|
real_t | ) |
|
Value:template <> \
bool SGMatrix<real_t>::is_symmetric() const \
{ \
REQUIRE(matrix!=
nullptr,
"The underlying matrix is not allocated!\n"); \
REQUIRE(num_rows>0, "Number of rows (%d) has to be positive!\n", num_rows); \
REQUIRE(num_cols>0, "Number of cols (%d) has to be positive!\n", num_cols); \
\
if (num_rows!=num_cols) \
return false; \
\
for (
index_t i=0; i<num_rows; ++i) \
{ \
for (
index_t j=i+1; j<num_cols; ++j) \
{ \
if (!CMath::fequals<real_t>(matrix[j*num_rows+i], \
matrix[i*num_rows+j], std::numeric_limits<real_t>::epsilon())) \
return false; \
} \
} \
\
return true; \
}
Definition at line 251 of file SGMatrix.cpp.