SHOGUN  6.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
Macros
SGMatrix.cpp File Reference

Go to the source code of this file.

Macros

#define REAL_EQUALS(real_t)
 
#define REAL_IS_SYMMETRIC(real_t)
 

Macro Definition Documentation

#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.

#define REAL_IS_SYMMETRIC (   real_t)
Value:
template <> \
bool SGMatrix<real_t>::is_symmetric() const \
{ \
assert_on_cpu(); \
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; \
}
int32_t index_t
Definition: common.h:72
#define REQUIRE(x,...)
Definition: SGIO.h:205

Definition at line 251 of file SGMatrix.cpp.


SHOGUN Machine Learning Toolbox - Documentation