Feel++ 0.91.0
Feel::MatrixUBlas< T, LayoutType > Class Template Reference

interface to ublas sparse matrix More...

#include <matrixublas.hpp>

List of all members.

Public Member Functions

Constructors, destructor
 MatrixUBlas ()
 MatrixUBlas (MatrixUBlas const &m)
 ~MatrixUBlas ()
Operator overloads
value_type & operator() (size_type i, size_type j)
value_type const & operator() (size_type i, size_type j) const
Accessors
unsigned int size1 () const
unsigned int size2 () const
size_type nnz () const
unsigned int rowStart () const
unsigned int rowStop () const
bool isInitialized () const
matrix_type const & mat () const
matrix_type & mat ()
Methods
void init (const unsigned int m, const unsigned int n, const unsigned int m_l, const unsigned int n_l, const unsigned int nnz=30, const unsigned int noz=10)
void clear ()
void zero ()
void zero (size_type start1, size_type stop1, size_type start2, size_type stop2)
void add (const unsigned int i, const unsigned int j, const value_type value)
void set (const unsigned int i, const unsigned int j, const value_type value)
void printMatlab (const std::string name="NULL") const
void fill (pattern_type const &)
void resize (size_type nr, size_type nc, bool preserve=false)
template<typename VE1 , typename VE2 >
value_type energy (ublas::vector_expression< VE1 > const &__v, ublas::vector_expression< VE2 > const &__u) const
void diagonalize (size_type)

Typedefs

typedef T value_type
typedef
ublas::compressed_matrix
< value_type, LayoutType > 
matrix_type
typedef
boost::numeric::bindings::traits::sparse_matrix_traits
< matrix_type >::ordering_type 
ordering_type
typedef
boost::numeric::bindings::traits::sparse_matrix_traits
< matrix_type >::layout_type 
layout_type
typedef std::vector< std::set
< size_type > > 
pattern_type
static const bool is_row_major

Detailed Description

template<typename T, typename LayoutType>
class Feel::MatrixUBlas< T, LayoutType >

interface to ublas sparse matrix

Author:
Christophe Prud'homme
See also:

Member Function Documentation

template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::add ( const unsigned int  i,
const unsigned int  j,
const value_type  value 
) [inline]

Add value to the element (i,j). Throws an error if the entry does not exist. Still, it is allowed to store zero values in non-existent fields.

template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::clear ( ) [inline]

Release all memory and return to a state just like after having called the default constructor.

template<typename T , typename LayoutType >
template<typename VE1 , typename VE2 >
value_type Feel::MatrixUBlas< T, LayoutType >::energy ( ublas::vector_expression< VE1 > const &  __v,
ublas::vector_expression< VE2 > const &  __u 
) const [inline]
Returns:
$ v^T M u $
template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::fill ( pattern_type const &  __pattern)

fill sparse matrix with non zero entries

template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::init ( const unsigned int  m,
const unsigned int  n,
const unsigned int  m_l,
const unsigned int  n_l,
const unsigned int  nnz = 30,
const unsigned int  noz = 10 
)

Initialize a Ublas matrix that is of global dimension $ m \times n $ with local dimensions $ m_l \times n_l $. nnz is the number of on-processor nonzeros per row (defaults to 30). noz is the number of on-processor nonzeros per row (defaults to 30).

template<typename T , typename LayoutType >
bool Feel::MatrixUBlas< T, LayoutType >::isInitialized ( ) const [inline]
Returns:
true if matrix is initialized/usable, false otherwise
template<typename T , typename LayoutType >
matrix_type& Feel::MatrixUBlas< T, LayoutType >::mat ( ) [inline]

Returns the raw ublas matrix.

template<typename T , typename LayoutType >
matrix_type const& Feel::MatrixUBlas< T, LayoutType >::mat ( ) const [inline]

Returns the raw ublas matrix.

template<typename T , typename LayoutType >
size_type Feel::MatrixUBlas< T, LayoutType >::nnz ( ) const [inline]
Returns:
the number of non-zeros entries in the matrix
template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::printMatlab ( const std::string  name = "NULL") const

Print the contents of the matrix in Matlab's sparse matrix format. Optionally prints the matrix to the file named name. If name is not specified it is dumped to the screen.

template<typename T , typename LayoutType >
unsigned int Feel::MatrixUBlas< T, LayoutType >::rowStart ( ) const [inline]

return row_start, the index of the first matrix row stored on this processor

template<typename T , typename LayoutType >
unsigned int Feel::MatrixUBlas< T, LayoutType >::rowStop ( ) const [inline]

return row_stop, the index of the last matrix row (+1) stored on this processor

template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::set ( const unsigned int  i,
const unsigned int  j,
const value_type  value 
) [inline]

Set value to the element (i,j). Throws an error if the entry does not exist. Still, it is allowed to store zero values in non-existent fields.

template<typename T , typename LayoutType >
unsigned int Feel::MatrixUBlas< T, LayoutType >::size1 ( ) const [inline]
Returns:
m, the row-dimension of the matrix where the marix is $ M \times N $.
template<typename T , typename LayoutType >
unsigned int Feel::MatrixUBlas< T, LayoutType >::size2 ( ) const [inline]
Returns:
n, the column-dimension of the matrix where the marix is $ M \times N $.
template<typename T , typename LayoutType >
void Feel::MatrixUBlas< T, LayoutType >::zero ( ) [inline]

Set all entries to 0. This method retains sparsity structure.


Member Data Documentation

template<typename T , typename LayoutType >
const bool Feel::MatrixUBlas< T, LayoutType >::is_row_major [static]
Initial value:
 boost::is_same<ordering_type,
                                                    boost::numeric::bindings::traits::row_major_t>::value