libgenua
Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Types | Public Member Functions | Private Attributes | List of all members
DMatrix< Type > Class Template Reference

Detailed Description

template<class Type>
class DMatrix< Type >

Matrix template.

Simple matrix class using heap allocation. The pointer to the first element is guaranteed to be 64-byte aligned in order to simplify vectorization. Likewise, the allocated space is always an integer multiple of 64 bytes.

When the size of a matrix is known at compile time (and not very large), use class SMatrix instead.

DMatrix and DVector define arithmetic operators to simplify writing algorithm prototypes. Where applicable, operators call LAPACK when available. Many functions in the linear algebra domain use eiter LAPACK or interface to the Eigen library when LAPACK is not found.

See Also
DVector, SVector, SMatrix, lu.h, lls.h, eig.h

#include <dmatrix.h>

Public Types

typedef Eigen::Matrix< Type,
Eigen::Dynamic, Eigen::Dynamic > 
EigenMatrix
 for interfacing with the Eigen library
 

Public Member Functions

 DMatrix ()
 default empty constructor
 
 DMatrix (size_t r, size_t c)
 sized construction
 
template<class AnotherType >
 DMatrix (const DMatrix< AnotherType > &src)
 conversion from different type
 
template<class AnotherType >
 DMatrix (const DVector< AnotherType > &src)
 conversion from different type
 
template<class AnotherType >
 DMatrix (const Eigen::Matrix< AnotherType, Eigen::Dynamic, Eigen::Dynamic > &a)
 conversion from Eigen matrix
 
template<class AnotherType >
 DMatrix (const Eigen::Map< const Eigen::Matrix< AnotherType, Eigen::Dynamic, Eigen::Dynamic > > &a)
 conversion from Eigen map
 
 DMatrix (const DMatrix< Type > &src)
 copy construction
 
 DMatrix (DMatrix< Type > &&t)
 move constructor
 
DMatrix< Type > & operator= (DMatrix< Type > &&rhs)
 move assignment
 
DMatrix< Type > & operator= (const DMatrix< Type > &rhs)
 assignment operator
 
DMatrix< Type > & operator= (const Type &x)
 assignament to scalar
 
bool operator== (const DMatrix< Type > &rhs) const
 element equality
 
const Type * pointer () const
 data pointer
 
Type * pointer ()
 data pointer
 
Type * colpointer (size_t j)
 pointer to the top of column j
 
Type * colend (size_t j)
 pointer to one past the end of column j
 
const Type * colpointer (size_t j) const
 pointer to the top of column j
 
const Type * colend (size_t j) const
 pointer to one past the end of column j
 
reference operator[] (size_t i)
 mutable linear access
 
const_reference operator[] (size_t i) const
 const linear access
 
reference operator() (size_t i)
 mutable linear access
 
const_reference operator() (size_t i) const
 const linear access
 
reference operator() (size_t r, size_t c)
 mutable 2D access
 
const_reference operator() (size_t r, size_t c) const
 const 2D access
 
size_t nrows () const
 row count
 
size_t ncols () const
 column count
 
size_t size () const
 total size
 
size_t bytes () const
 number of bytes actually occupied (not capacity)
 
size_t ldim () const
 leading dimension
 
void resize (size_t r, size_t c)
 change size and clear memory
 
void allocate (size_t r, size_t c)
 allocate space only
 
void reserve (size_t r, size_t c)
 change size, do not initialize memory
 
void appendColumn (const Type *ptr)
 append column, data in ptr must be at least nrows() long
 
const_iterator begin () const
 start pointer
 
const_iterator end () const
 one-past-end pointer
 
iterator begin ()
 start pointer
 
iterator end ()
 one-past-end pointer
 
template<class VectorType >
void assignColumn (size_t jcol, const VectorType &c)
 convenience shortcut to make numerical method code more expressive
 
template<class VectorType >
void assignRow (size_t irow, const VectorType &c)
 convenience shortcut (strided access!)
 
template<typename FloatType >
void scaleColumn (size_t icol, const FloatType &a)
 convenience shortcut
 
template<typename FloatType >
void scaleRow (size_t irow, const FloatType &a)
 convenience shortcut (strided access)
 
DMatrix< Type > operator- () const
 negation
 
DMatrix< Type > transposed () const
 return transposed copy
 
void transpose ()
 transpose in place (inefficient but simple)
 
void swap (DMatrix< Type > &a)
 swap contents with a
 
void clear ()
 release storage
 
EigenMap mmap ()
 create a mutable map object for interfacing with Eigen
 
ConstEigenMap cmap () const
 create a mutable map object for interfacing with Eigen
 

Private Attributes

size_t rows
 array sizes
 
container data
 pointer to data
 

The documentation for this class was generated from the following file: