pele
Python energy landscape explorer
 All Classes Namespaces Functions Variables Typedefs
Public Member Functions | Public Attributes
pele::MatrixAdapter< dtype > Class Template Reference

#include <matrix.h>

Inheritance diagram for pele::MatrixAdapter< dtype >:
pele::Array< dtype >

List of all members.

Public Member Functions

 MatrixAdapter (size_t dim1, size_t dim2, dtype val=0)
 MatrixAdapter (pele::Array< double > v, size_t dim2)
 MatrixAdapter (double *data, size_t dim1, size_t dim2)
dtype const & operator() (size_t i, size_t j) const
dtype & operator() (size_t i, size_t j)
std::pair< size_t, size_t > shape () const

Public Attributes

size_t _dim2

Detailed Description

template<class dtype>
class pele::MatrixAdapter< dtype >

This is a very minimal implementation of a matrix. It's primary function is to act as a wrapper for pele::Array, so a pele array can be act as a matrix temporarily. The idea is to redo somthing like the reshape() function in numpy.

Definition at line 13 of file matrix.h.


Constructor & Destructor Documentation

template<class dtype>
pele::MatrixAdapter< dtype >::MatrixAdapter ( size_t  dim1,
size_t  dim2,
dtype  val = 0 
) [inline]

Construct a matrix and allocate memory for it.

Definition at line 26 of file matrix.h.

template<class dtype>
pele::MatrixAdapter< dtype >::MatrixAdapter ( pele::Array< double >  v,
size_t  dim2 
) [inline]

wrap a pele::Array to act like a matrix

This is like numpy.reshape. v.size() must be divisable by dim2

Definition at line 36 of file matrix.h.

template<class dtype>
pele::MatrixAdapter< dtype >::MatrixAdapter ( double *  data,
size_t  dim1,
size_t  dim2 
) [inline]

wrap an existing block of memory

Definition at line 48 of file matrix.h.


Member Function Documentation

template<class dtype>
dtype const& pele::MatrixAdapter< dtype >::operator() ( size_t  i,
size_t  j 
) const [inline]

access the element of the array at row i and column j

Definition at line 56 of file matrix.h.

template<class dtype>
dtype& pele::MatrixAdapter< dtype >::operator() ( size_t  i,
size_t  j 
) [inline]

Definition at line 60 of file matrix.h.

template<class dtype>
std::pair<size_t, size_t> pele::MatrixAdapter< dtype >::shape ( ) const [inline]

return a pair giving the shape of the array.

Definition at line 68 of file matrix.h.


Member Data Documentation

template<class dtype>
size_t pele::MatrixAdapter< dtype >::_dim2

the second dimension of the matrix, e.g. the number of colums

note: if we make this const we can only use the assignment operator on matrices with the same first dimension

Definition at line 21 of file matrix.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs