Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::RowMapSparseValueMatrix< T > Class Template Reference

#include <RowMapSparseValueMatrix.h>

Inheritance diagram for PLearn::RowMapSparseValueMatrix< T >:

Inheritance graph
[legend]
Collaboration diagram for PLearn::RowMapSparseValueMatrix< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RowMapSparseValueMatrix (T value_=0, int n_rows=0, int n_columns=0)
 RowMapSparseValueMatrix (T value_, string filename)
 RowMapSparseValueMatrix (T value_, const Mat &m, int fill_mode=0)
 RowMapSparseValueMatrix (T value_, const SparseMatrix &sm, int n_rows, int n_cols)
 Accepts a FORTRAN formatted sparse matrix as an initializer.

Mat toMat ()
T & operator() (int i, int j)
const T & operator() (int i, int j) const
map< int, T > & operator() (int i)
void averageAcrossRowsAndColumns (Vec avg_across_rows, Vec avg_across_columns, bool only_on_non_value=false)
real euclidianDistance (map< int, real > &map1, map< int, real > &map2)

Public Attributes

value

Detailed Description

template<class T>
class PLearn::RowMapSparseValueMatrix< T >

Warning **: this class inherits methods from RowMapSparseMatrix<T> that are not necessarily correct when "value" is different from 0. The following methods are correct (plus those redefined below):

The value of elements that is not specified is given by the field "value".

Sparse matrices implemented with STL maps.

We assume that there are elements in each ROW.

We associate an STL map to each row: column index --> value

Space used is about O( size_of_elements * number_of_non_value_elements )

Random access time is O(log(number_of_elements_per_row))

Row-wise iterations can be done in constant time per access.

Binary or ascii load/save streaming are available. Recommended filename extensions are .armsm and .brmsm respectively for Ascii Row Map Sparse Matrix or Binary Row Map Sparse Matrix.

Definition at line 75 of file RowMapSparseValueMatrix.h.


Constructor & Destructor Documentation

template<class T>
PLearn::RowMapSparseValueMatrix< T >::RowMapSparseValueMatrix value_ = 0,
int  n_rows = 0,
int  n_columns = 0
[inline]
 

Definition at line 80 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseValueMatrix< T >::value.

template<class T>
PLearn::RowMapSparseValueMatrix< T >::RowMapSparseValueMatrix value_,
string  filename
[inline]
 

Definition at line 84 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseValueMatrix< T >::value.

template<class T>
PLearn::RowMapSparseValueMatrix< T >::RowMapSparseValueMatrix value_,
const Mat m,
int  fill_mode = 0
[inline]
 

Definition at line 88 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseMatrix< T >::length(), PLearn::Mat, PLERROR, PLearn::RowMapSparseValueMatrix< T >::value, and PLearn::RowMapSparseMatrix< T >::width().

template<class T>
PLearn::RowMapSparseValueMatrix< T >::RowMapSparseValueMatrix value_,
const SparseMatrix sm,
int  n_rows,
int  n_cols
[inline]
 

Accepts a FORTRAN formatted sparse matrix as an initializer.

Definition at line 132 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseValueMatrix< T >::value.


Member Function Documentation

template<class T>
void PLearn::RowMapSparseValueMatrix< T >::averageAcrossRowsAndColumns Vec  avg_across_rows,
Vec  avg_across_columns,
bool  only_on_non_value = false
[inline]
 

average across rows on one hand, and in parallel average across columns (thus getting two averages). The boolean argument specifies whether the average is across the explicit elements (the ones not equal to "value") or across everything.

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 195 of file RowMapSparseValueMatrix.h.

References PLearn::TVec< T >::clear(), PLearn::TVec< T >::data(), PLearn::RowMapSparseMatrix< T >::length(), PLearn::TVec< T >::resize(), PLearn::RowMapSparseValueMatrix< T >::value, PLearn::Vec, and PLearn::RowMapSparseMatrix< T >::width().

template<class T>
real PLearn::RowMapSparseValueMatrix< T >::euclidianDistance map< int, real > &  map1,
map< int, real > &  map2
[inline]
 

This is not a "true" euclidian distance

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 253 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseValueMatrix< T >::euclidianDistance(), PLearn::sum(), and PLearn::RowMapSparseValueMatrix< T >::value.

Referenced by PLearn::RowMapSparseValueMatrix< T >::euclidianDistance().

template<class T>
map<int,T>& PLearn::RowMapSparseValueMatrix< T >::operator() int  i  )  [inline]
 

Get i-th row. Exemple to iterate on i-th row:

map<int,T>& row_i = A(i); < note very important: row_i is a reference (&) map<int,T>::const_iterator it = row_i.begin(); map<int,T>::const_iterator end = row_i.end(); for (;it!=end;++it) { int j = it->first; T Aij = it->second; ... }

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 186 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseValueMatrix< T >::operator()().

template<class T>
const T& PLearn::RowMapSparseValueMatrix< T >::operator() int  i,
int  j
const [inline]
 

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 161 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseMatrix< T >::length(), PLearn::RowMapSparseValueMatrix< T >::operator()(), PLERROR, PLearn::RowMapSparseValueMatrix< T >::value, and PLearn::RowMapSparseMatrix< T >::width().

template<class T>
T& PLearn::RowMapSparseValueMatrix< T >::operator() int  i,
int  j
[inline]
 

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 152 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseMatrix< T >::length(), PLearn::RowMapSparseValueMatrix< T >::operator()(), PLERROR, and PLearn::RowMapSparseMatrix< T >::width().

Referenced by PLearn::RowMapSparseValueMatrix< T >::operator()().

template<class T>
Mat PLearn::RowMapSparseValueMatrix< T >::toMat  )  [inline]
 

Reimplemented from PLearn::RowMapSparseMatrix< T >.

Definition at line 136 of file RowMapSparseValueMatrix.h.

References PLearn::RowMapSparseMatrix< T >::length(), PLearn::RowMapSparseValueMatrix< T >::value, and PLearn::RowMapSparseMatrix< T >::width().


Member Data Documentation

template<class T>
T PLearn::RowMapSparseValueMatrix< T >::value
 

Definition at line 78 of file RowMapSparseValueMatrix.h.

Referenced by PLearn::RowMapSparseValueMatrix< T >::averageAcrossRowsAndColumns(), PLearn::RowMapSparseValueMatrix< T >::euclidianDistance(), PLearn::RowMapSparseValueMatrix< T >::operator()(), PLearn::RowMapSparseValueMatrix< T >::RowMapSparseValueMatrix(), and PLearn::RowMapSparseValueMatrix< T >::toMat().


The documentation for this class was generated from the following file:
Generated on Tue Aug 17 16:23:54 2004 for PLearn by doxygen 1.3.7