array.h File Reference
Detailed Description
core file: defines the
MT::Array class
Definition in file array.h.
Go to the source code of this file.
Namespaces
Classes
standard types
basic operators
more efficient basic operations (don't copy in new arrays)
-
template<class T> void plus (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- element-wise plus
-
template<class T> void scalarPlus (MT::Array< T > &x, const MT::Array< T > &y, T a)
- element-wise plus with a scalar
-
template<class T> void plus (MT::Array< T > &x, T a, const MT::Array< T > &y, T b, const MT::Array< T > &z)
- element-wise linear combination (plus with scalar factors for each array)
-
template<class T> void minus (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- element-wise minus
-
template<class T> void mult (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- element-wise multiplication
-
template<class T> void div (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- element-wise division
matrix operations
-
template<class T> void setIdentity (MT::Array< T > &mat, uint dim)
- mat becomes dim*dim identity matrix
-
MT::Array< double > Identity (uint dim)
- returns the identity matrix
-
void makeSymmetric (MT::Array< double > &A)
- make symmetric
-
template<class T> void transpose (MT::Array< T > &x, const MT::Array< T > &y)
- x = y^T
-
template<class T> void diag (MT::Array< T > &x, const MT::Array< T > &y)
- returns the diagonal x = diag(y) (the diagonal-vector of the symmetric 2D matrix y)
-
template<class T> void setDiagonal (MT::Array< T > &x, const MT::Array< T > &v)
- sets x to be the diagonal matrix with diagonal v
-
template<class T> void setDiagonal (MT::Array< T > &x, uint d, double v)
- x is v times the d-dimensional Identity
-
template<class T> void inverse2d (MT::Array< T > &invA, const MT::Array< T > &A)
- inverse of a 2d matrix
-
template<class T> void blockMatrix (MT::Array< T > &X, const MT::Array< T > &A, const MT::Array< T > &B, const MT::Array< T > &C, const MT::Array< T > &D)
- constructs the block matrix X=[A,B ; C,D]
products
-
template<class T> void scalarMultiplication (MT::Array< T > &x, const MT::Array< T > &y, const T &a)
- product with a scalar
-
template<class T> void innerProduct (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- inner product (also ordinary matrix or scalar product):
but also:
-
template<class T> void outerProduct (MT::Array< T > &x, const MT::Array< T > &y, const MT::Array< T > &z)
- outer product (also exterior or tensor product):
-
template<class T> T scalarProduct (const MT::Array< T > &v, const MT::Array< T > &w)
, or
, etc.
-
template<class T> T scalarProduct (const MT::Array< T > &g, const MT::Array< T > &v, const MT::Array< T > &w)
distances
running sums
probability distribution operations
running products
min and max
randomizations
-
template<class T> void rndInt (MT::Array< T > &a, int low=0., int high=1.)
- Assign all elements of
a
to a uniformly distributed variable in [0,1].
-
template<class T> void rndUni (MT::Array< T > &a, double low=0., double high=1.)
- Assign all elements of
a
to a uniformly distributed variable in [0,1].
-
template<class T> void rndGauss (MT::Array< T > &a, double stdDev, bool add=false)
- Assign all elements of
a
to a Gaussian random variable.
-
template<class T> MT::Array< T > & rndGauss (double stdDev, uint dim)
- returns an array with
dim
Gaussian noise elements
-
template<class T> uint softMax (const MT::Array< T > &a, MT::Array< double > &soft, double beta)
- from a vector of numbers, calculates the softmax distribution soft(i) = exp(beta*a(i)), and returns a random sample from this distribution (an index in {0,..,a.N-1})
certain initializations
gnuplot fun
-
void gnuplot (const MT::Array< double > &X)
- calls gnuplot to display the (n,2) or (n,3) array (n=number of points of line or surface)
Defines
-
#define FOR1D(x, i) for(i=0;i<x.d0;i++)
-
#define FOR2D(x, i, j) for(i=0;i<x.d0;i++) for(j=0;j<x.d1;j++)
-
#define forAll(i, A) for(i=A.p;i!=A.pstop;i++)
-
#define IFEX(x)
[]