NumLinAlg.h
Go to the documentation of this file.
1 /* -*- mode:c++ -*- */
2 
16 #ifndef NUMLINALG_H__
17 #define NUMLINALG_H__
18 
19 #include <iosfwd>
20 #include <vector>
21 
22 namespace hippodraw {
23 
26  namespace Numeric {
27 
30 std::vector< double >
31 operator + ( const std::vector< double >& x, const std::vector< double >& y );
32 
35 std::vector< double >
36 operator - ( const std::vector< double >& x, const std::vector< double >& y );
37 
40 std::vector< double >
41 operator - ( const std::vector< double >& y );
42 
45 std::vector< std::vector< double > >
46 operator + ( const std::vector< std::vector< double > >&A,
47  const std::vector< std::vector< double > >&B );
48 
51 std::vector< std::vector< double > >
52 operator - ( const std::vector< std::vector< double > >&A,
53  const std::vector< std::vector< double > >&B );
54 
57 std::vector< double >
58 operator * ( double a, const std::vector< double >& x );
59 
62 std::vector< double >
63 operator / ( const std::vector< double >& x, double a );
64 
66 std::vector< std::vector< double > >
67 operator * ( double a, const std::vector< std::vector< double > > & A ) ;
68 
70 std::vector< std::vector< double> >
71 operator / ( const std::vector< std::vector< double> > & A, double a );
72 
74 std::vector< double >
75 operator * ( const std::vector< std::vector< double > > & A,
76  const std::vector< double > & x );
77 
79 std::vector< double >
80 operator * ( const std::vector< double > & x,
81  const std::vector< std::vector< double > > & A );
82 
84 std::vector< std::vector< double > >
85 operator * ( const std::vector< std::vector< double > >&A,
86  const std::vector< std::vector< double > >&B );
87 
89 double innerProduct( const std::vector< double > & a,
90  const std::vector< double > & b );
91 
93 std::vector< std::vector< double > >
94 outerProduct ( const std::vector< double > & a,
95  const std::vector< double > & b );
96 
98 double quadraticProduct( const std::vector< std::vector< double > > & A,
99  const std::vector< double > x );
100 
102 double norm( const std::vector< double > & a );
103 
107 int cholFactor( std::vector< std::vector< double > > & A );
108 
110 int cholBackSolve( const std::vector< std::vector< double > > & L,
111  std::vector< double > & x,
112  const std::vector< double > & b );
113 
116 int invertMatrix( const std::vector< std::vector< double > > & A,
117  std::vector< std::vector< double > > & Ainv );
118 
120 int eye( std::vector< std::vector< double > > & M, int n );
121 
123 int write( const std::vector< double > & x );
124 
126 int write( const std::vector< std::vector< double > > & A );
127 
129 int allocateMatrix( std::vector< std::vector< double > >& A, int m, int n );
130 
132 int allocateVector( std::vector< double >& x, int n );
133 
134  } // namespace Numeric
135 } // namespace hippodraw
136 
137 #endif
std::vector< double > operator-(const std::vector< double > &x, const std::vector< double > &y)
Given two vectors x and y this function performs operation z = x - y.
Definition: NumLinAlg.cxx:53
std::vector< double > operator+(const std::vector< double > &x, const std::vector< double > &y)
Given two vectors x and y this function performs operation z = x + y.
Definition: NumLinAlg.cxx:38
double innerProduct(const std::vector< double > &a, const std::vector< double > &b)
Computes the dot or the inner product of two vectors(i.e.
Definition: NumLinAlg.cxx:239
int allocateMatrix(std::vector< std::vector< double > > &A, int m, int n)
Allocates a matrix of size m x n.
Definition: NumLinAlg.cxx:452
int cholFactor(std::vector< std::vector< double > > &A)
The subroutine which does cholesky factorization of a given Symmetric positive definite matrix (say) ...
Definition: NumLinAlg.cxx:292
vector< vector< double > > outerProduct(const std::vector< double > &a, const std::vector< double > &b)
Computes the outer product of two vectors (i.e.
Definition: NumLinAlg.cxx:252
int cholBackSolve(const std::vector< std::vector< double > > &L, std::vector< double > &x, const std::vector< double > &b)
Solves the equation LL&#39;x = b where L is lower triangular matrix.
Definition: NumLinAlg.cxx:325
int eye(std::vector< std::vector< double > > &I, int n)
Creates an n x n identity matrix for M.
Definition: NumLinAlg.cxx:405
std::vector< double > operator*(double a, const std::vector< double > &x)
Given a scalar a and a vector x this function performs operation y = ax.
Definition: NumLinAlg.cxx:119
int invertMatrix(const std::vector< std::vector< double > > &A, std::vector< std::vector< double > > &Ainv)
Inverts a SPD matrix a to get inverse Ainv using the cholesky factorization.
Definition: NumLinAlg.cxx:356
double quadraticProduct(const std::vector< std::vector< double > > &A, const std::vector< double > x)
Calculates the vector-matrix-vector product x&#39;*A*x.
Definition: NumLinAlg.cxx:268
double norm(const std::vector< double > &a)
Computes the two norm of the vector.
Definition: NumLinAlg.cxx:285
std::vector< double > operator/(const std::vector< double > &x, double a)
Given a scalar and a vector x this function performs operation y = x/a.
Definition: NumLinAlg.cxx:133
int write(const std::vector< double > &a)
Given the vector it writes it to std stream.
Definition: NumLinAlg.cxx:421
int allocateVector(std::vector< double > &x, int n)
Allocates a vector of size n.
Definition: NumLinAlg.cxx:467

Generated for HippoDraw Class Library by doxygen