Public Member Functions

apf::Matrix< M, N > Class Template Reference

template-generic matrix of M by N doubles More...

List of all members.

Public Member Functions

 Matrix ()
 mandatory
 Matrix (double const (*array)[N])
 construct from an array
 Matrix (Vector< N > const *vectors)
 construct from an array of Vector
Matrix< M, N > operator+ (Matrix< M, N > const &b) const
 add two matrices
Matrix< M, N > operator- (Matrix< M, N > const &b) const
 subtract two matrices
Matrix< M, N > operator* (double s) const
 multiply a matrix by a scalar
Matrix< M, N > operator/ (double s) const
 divide a matrix by a scalar
Vector< M > operator* (Vector< N > const &b) const
 multiply a matrix by a vector
template<std::size_t O>
Matrix< M, O > operator* (Matrix< N, O > const &b) const
 multiply two matrices

Detailed Description

template<std::size_t M, std::size_t N>
class apf::Matrix< M, N >

template-generic matrix of M by N doubles

see apf::Vector for the rationale on templating. In short, this class is designed to handle matrices whose small sizes are known at compile time. They should be used in a functional programming style

For matrices sized at runtime, see apf::DynamicMatrix. For sparse structures or parallel matrices, look outside of APF.

for those interested in software design, notice how Array and Vector come together to form Matrix

Definition at line 31 of file apfMatrix.h.


Member Function Documentation

template<std::size_t M, std::size_t N>
template<std::size_t O>
Matrix<M,O> apf::Matrix< M, N >::operator* ( Matrix< N, O > const &  b  )  const [inline]

multiply two matrices

the extra template parameter generates code for all possible combinations of matrix sizes

Definition at line 95 of file apfMatrix.h.

    {
      Matrix<M,O> r;
      for (std::size_t i=0; i < M; ++i)
      for (std::size_t j=0; j < O; ++j)
      {
        r[i][j] = (*this)[i][0]*b[0][j];
        for (std::size_t k=1; k < N; ++k)
          r[i][j] += (*this)[i][k]*b[k][j];
      }
      return r;
    }


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