19 using namespace Eigen;
50 m_operator=
SGMatrix<T>(orig.m_operator.num_rows, orig.m_operator.num_cols);
51 for (
index_t i=0; i<m_operator.num_cols; ++i)
53 for (
index_t j=0; j<m_operator.num_rows; ++j)
54 m_operator(j,i)=orig.m_operator(j,i);
63 CSGObject::set_generic<T>();
65 this->m_parameters->add(&m_operator,
"dense_matrix",
66 "The dense matrix of the linear operator");
72 SG_SGCDEBUG(
"%s destroyed (%p)\n", this->get_name(),
this);
84 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
92 SGVector<T> diag(static_cast<int32_t>(_op.diagonalSize()));
102 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
109 m_operator.num_cols);
111 REQUIRE(static_cast<int32_t>(_op.diagonalSize())==diag.
vlen,
112 "Dimension mismatch!\n");
115 _op.diagonal()=_diag;
121 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
123 "Number of rows of vector must be equal to the "
124 "number of cols of the operator!\n");
131 m_operator.num_cols);
140 #define UNDEFINED(type) \
142 SGVector<type> CDenseMatrixOperator<type>::apply(SGVector<type> b) const \
144 SG_SERROR("Not supported for %s\n", #type);\
154 template class CDenseMatrixOperator<bool>;
155 template class CDenseMatrixOperator<char>;
156 template class CDenseMatrixOperator<int8_t>;
157 template class CDenseMatrixOperator<uint8_t>;
158 template class CDenseMatrixOperator<int16_t>;
159 template class CDenseMatrixOperator<uint16_t>;
160 template class CDenseMatrixOperator<int32_t>;
161 template class CDenseMatrixOperator<uint32_t>;
162 template class CDenseMatrixOperator<int64_t>;
163 template class CDenseMatrixOperator<uint64_t>;
164 template class CDenseMatrixOperator<float32_t>;
165 template class CDenseMatrixOperator<float64_t>;
166 template class CDenseMatrixOperator<floatmax_t>;
167 template class CDenseMatrixOperator<complex128_t>;
169 #endif // HAVE_EIGEN3
SGMatrix< T > get_matrix_operator() const
virtual SGVector< T > apply(SGVector< T > b) const
virtual void set_diagonal(SGVector< T > diag)
virtual SGVector< T > get_diagonal() const
Class that represents a dense-matrix linear operator. It computes matrix-vector product in its apply...
all of classes and functions are contained in the shogun namespace
virtual const char * get_name() const
Abstract base class that represents a matrix linear operator. It provides an interface to computes ma...