MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SmallMatrix_impl.h File Reference
#include "SmallMatrix.h"

Go to the source code of this file.

Functions

void dgemv_ (const char *trans, int *m, int *n, double *alpha, double *A, int *LDA, double *x, int *incx, double *beta, double *y, int *incy)
 This does matrix times vector and is from blas level 2. More...
 
int dgemm_ (const char *transA, const char *transB, int *M, int *N, int *k, double *alpha, double *A, int *LDA, double *B, int *LDB, double *beta, double *C, int *LDC)
 This is the gernal matrix multiplication from blas level 3. More...
 
int daxpy_ (int *N, double *DA, double *DX, int *INCX, double *DY, int *INCY)
 This is the gerneral scalar times vector + vector from blas, hence from blas level 1. Here we also use on a matrix by treating as a vector. More...
 
void dgetrf_ (int *M, int *N, double *A, int *lda, int *IPIV, int *INFO)
 This is LU factorisation of the matrix A. This has been taken from LAPACK. More...
 
void dgetri_ (int *N, double *A, int *lda, int *IPIV, double *WORK, int *lwork, int *INFO)
 This is the inverse calulation also from LAPACK. Calculates inverse if you pass it the LU factorisation. More...
 
void dgesv_ (int *N, int *NRHS, double *A, int *lda, int *IPIV, double *B, int *LDB, int *INFO)
 This is used for solve Ax=B for x. Again this is from LAPACK. More...
 
template<unsigned int numberOfRows, unsigned int numberOfColumns>
SmallVector< numberOfColumns > operator* (SmallVector< numberOfRows > &vec, SmallMatrix< numberOfRows, numberOfColumns > &mat)
 Multiplies a matrix with a vector. More...
 

Function Documentation

int daxpy_ ( int *  N,
double *  DA,
double *  DX,
int *  INCX,
double *  DY,
int *  INCY 
)

This is the gerneral scalar times vector + vector from blas, hence from blas level 1. Here we also use on a matrix by treating as a vector.

int dgemm_ ( const char *  transA,
const char *  transB,
int *  M,
int *  N,
int *  k,
double *  alpha,
double *  A,
int *  LDA,
double *  B,
int *  LDB,
double *  beta,
double *  C,
int *  LDC 
)

This is the gernal matrix multiplication from blas level 3.

Referenced by SmallMatrix< numberOfRows, numberOfColumns >::operator*().

void dgemv_ ( const char *  trans,
int *  m,
int *  n,
double *  alpha,
double *  A,
int *  LDA,
double *  x,
int *  incx,
double *  beta,
double *  y,
int *  incy 
)

This does matrix times vector and is from blas level 2.

Referenced by SmallMatrix< numberOfRows, numberOfColumns >::operator*(), and operator*().

void dgesv_ ( int *  N,
int *  NRHS,
double *  A,
int *  lda,
int *  IPIV,
double *  B,
int *  LDB,
int *  INFO 
)

This is used for solve Ax=B for x. Again this is from LAPACK.

Referenced by SmallMatrix< numberOfRows, numberOfColumns >::solve().

void dgetrf_ ( int *  M,
int *  N,
double *  A,
int *  lda,
int *  IPIV,
int *  INFO 
)

This is LU factorisation of the matrix A. This has been taken from LAPACK.

Referenced by SmallMatrix< numberOfRows, numberOfColumns >::inverse(), and SmallMatrix< numberOfRows, numberOfColumns >::LUfactorisation().

void dgetri_ ( int *  N,
double *  A,
int *  lda,
int *  IPIV,
double *  WORK,
int *  lwork,
int *  INFO 
)

This is the inverse calulation also from LAPACK. Calculates inverse if you pass it the LU factorisation.

Referenced by SmallMatrix< numberOfRows, numberOfColumns >::inverse().

template<unsigned int numberOfRows, unsigned int numberOfColumns>
SmallVector<numberOfColumns> operator* ( SmallVector< numberOfRows > &  vec,
SmallMatrix< numberOfRows, numberOfColumns > &  mat 
)

Multiplies a matrix with a vector.

Definition at line 357 of file SmallMatrix_impl.h.

References SmallVector< numberOfRows >::data(), SmallMatrix< numberOfRows, numberOfColumns >::data(), DEBUG, dgemv_(), logger, SmallVector< numberOfRows >::size(), and WARN.

358 {
359  if (numberOfColumns == 0)
360  {
361  logger(WARN, "Trying to multiply a vector with a matrix without any columns.");
363  }
364  int nr = numberOfRows;
365  int nc = numberOfColumns;
366 
367  int i_one = 1;
368  double d_one = 1.0;
369  double d_zero = 0.0;
370 
372 
373  logger(DEBUG, "Matrix size: % x % \n Vector size: %", nr, nc, vec.size());
374 
375  dgemv_("T", &nr, &nc, &d_one, mat.data(), &nr, vec.data(), &i_one, &d_zero, result.data(), &i_one);
376  return result;
377 }
Mdouble * data()
Definition: SmallMatrix.h:351
LL< Log::DEBUG > DEBUG
Debug information.
Definition: Logger.cc:58
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Implementation of a 3D vector (by Vitaliy).
Definition: SmallVector.h:61
const Mdouble * data() const
Definition: SmallVector.h:238
LL< Log::WARN > WARN
Warning log level.
Definition: Logger.cc:54
unsigned int size() const
Definition: SmallVector.h:233
void dgemv_(const char *trans, int *m, int *n, double *alpha, double *A, int *LDA, double *x, int *incx, double *beta, double *y, int *incy)
This does matrix times vector and is from blas level 2.