18 using namespace Eigen;
49 m_operator=
SGMatrix<T>(orig.m_operator.num_rows, orig.m_operator.num_cols);
50 for (
index_t i=0; i<m_operator.num_cols; ++i)
52 for (
index_t j=0; j<m_operator.num_rows; ++j)
53 m_operator(j,i)=orig.m_operator(j,i);
62 CSGObject::set_generic<T>();
64 this->m_parameters->add(&m_operator,
"dense_matrix",
65 "The dense matrix of the linear operator");
71 SG_SGCDEBUG(
"%s destroyed (%p)\n", this->get_name(),
this);
83 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
91 SGVector<T> diag(static_cast<int32_t>(_op.diagonalSize()));
101 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
108 m_operator.num_cols);
110 REQUIRE(static_cast<int32_t>(_op.diagonalSize())==diag.
vlen,
111 "Dimension mismatch!\n");
114 _op.diagonal()=_diag;
120 REQUIRE(m_operator.matrix,
"Operator not initialized!\n");
122 "Number of rows of vector must be equal to the "
123 "number of cols of the operator!\n");
130 m_operator.num_cols);
139 #define UNDEFINED(type) \
141 SGVector<type> CDenseMatrixOperator<type>::apply(SGVector<type> b) const \
143 SG_SERROR("Not supported for %s\n", #type);\
153 template class CDenseMatrixOperator<bool>;
154 template class CDenseMatrixOperator<char>;
155 template class CDenseMatrixOperator<int8_t>;
156 template class CDenseMatrixOperator<uint8_t>;
157 template class CDenseMatrixOperator<int16_t>;
158 template class CDenseMatrixOperator<uint16_t>;
159 template class CDenseMatrixOperator<int32_t>;
160 template class CDenseMatrixOperator<uint32_t>;
161 template class CDenseMatrixOperator<int64_t>;
162 template class CDenseMatrixOperator<uint64_t>;
163 template class CDenseMatrixOperator<float32_t>;
164 template class CDenseMatrixOperator<float64_t>;
165 template class CDenseMatrixOperator<floatmax_t>;
166 template class CDenseMatrixOperator<complex128_t>;
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...