13 #ifndef __SGSPARSEMATRIX_H__
14 #define __SGSPARSEMATRIX_H__
26 template <
class T>
class SGSparseVector;
27 template <
class ST>
struct SGSparseVectorEntry;
28 template<
class T>
class SGMatrix;
33 template <
class T>
class SGSparseMatrix :
public SGReferencedData
41 index_t num_vec,
bool ref_counting=
true);
88 "Dimension mismatch! %d vs %d\n",
108 REQUIRE(i_row>=0,
"Provided row index %d negative!\n", i_row);
109 REQUIRE(i_col>=0,
"Provided column index %d negative!\n", i_col);
110 REQUIRE(i_row<
num_features,
"Provided row index (%d) is larger than number of rows (%d)\n",
112 REQUIRE(i_col<
num_vectors,
"Provided column index (%d) is larger than number of columns (%d)\n",
129 REQUIRE(i_row>=0,
"Provided row index %d negative!\n", i_row);
130 REQUIRE(i_col>=0,
"Provided column index %d negative!\n", i_col);
131 REQUIRE(i_row<
num_features,
"Provided row index (%d) is larger than number of rows (%d)\n",
133 REQUIRE(i_col<
num_vectors,
"Provided column index (%d) is larger than number of columns (%d)\n",
214 #endif // __SGSPARSEMATRIX_H__
T & operator()(index_t i_row, index_t i_col)
template class SGSparseMatrix
SGVector< float64_t > load_with_labels(CLibSVMFile *libsvm_file, bool do_sort_features=true)
SGSparseMatrix< T > get_transposed()
const T operator()(index_t i_row, index_t i_col) const
index_t num_features
total number of features
shogun reference count managed data
const SGSparseVector< T > & operator[](index_t index) const
A File access base class.
void from_dense(SGMatrix< T > full)
SGSparseVector< T > * sparse_matrix
array of sparse vectors of size num_vectors
const SGVector< T > operator*(SGVector< T > v) const
virtual void copy_data(const SGReferencedData &orig)
all of classes and functions are contained in the shogun namespace
read sparse real valued features in svm light format e.g. -1 1:10.0 2:100.2 1000:1.3 with -1 == (optional) label and dim 1 - value 10.0 dim 2 - value 100.2 dim 1000 - value 1.3
template class SGSparseVectorEntry
SGSparseVector< T > & operator[](index_t index)
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry* vector is orde...
void save_with_labels(CLibSVMFile *saver, SGVector< float64_t > labels)
index_t num_vectors
total number of vectors
virtual ~SGSparseMatrix()