CVM Class Library
8.1
This C++ class library encapsulates concepts of vector and different matrices including square, band, symmetric and hermitian ones in Euclidean space of real and complex numbers.
|
Matrix of functions class More...
#include <cfun.h>
Public Member Functions | |
basic_fmatrix () | |
Default constructor. | |
basic_fmatrix (size_t m, size_t n) | |
Constructor. | |
basic_fmatrix (size_t m, size_t n, const string_array &saInput) | |
Constructor. | |
basic_fmatrix (size_t m, size_t n, const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings) | |
Constructor. | |
basic_fmatrix (const basic_fmatrix &fm) | |
Copy Constructor. | |
basic_fmatrix (basic_fmatrix &&fm) | |
Move Constructor. | |
size_t | msize () const |
Number of rows. | |
size_t | nsize () const |
Number of columns. | |
basic_fmatrix & | operator= (const basic_fmatrix &fm) throw (cvmexception) |
Assignment operator. | |
basic_fmatrix & | operator= (basic_fmatrix &&fm) throw (cvmexception) |
Assignment operator. | |
BaseFunction & | at (size_t nRow, size_t nCol) |
Reference to element (l-value) | |
const BaseFunction & | at (size_t nRow, size_t nCol) const |
Value of element (not l-value) | |
bool | operator== (const basic_fmatrix &fm) const |
Matrices of functions comparison. | |
bool | operator!= (const basic_fmatrix &fm) const |
Matrices of functions comparison. | |
basic_fmatrix & | operator<< (const basic_fmatrix &fm) |
Replacement operator. | |
basic_fmatrix | drv (size_t nVarNum) const |
Partial derivative. | |
basic_fmatrix & | simp () |
Simplifier. | |
basic_fmatrix | operator+ (const basic_fmatrix &fm) const throw (cvmexception) |
Addition operator. | |
basic_fmatrix | operator- (const basic_fmatrix &fm) const throw (cvmexception) |
Subtraction operator. | |
basic_fmatrix & | operator+= (const basic_fmatrix &fm) throw (cvmexception) |
Increment operator. | |
basic_fmatrix & | operator-= (const basic_fmatrix &fm) throw (cvmexception) |
Decrement operator. | |
basic_fmatrix | operator* (const BaseFunction &f) const |
Multiplication operator. | |
basic_fmatrix | operator/ (const BaseFunction &f) const |
Division operator. | |
basic_fmatrix | operator* (const T &d) const |
Multiplication operator. | |
basic_fmatrix | operator/ (const T &d) const |
Division operator. | |
basic_fmatrix & | operator*= (const BaseFunction &f) |
Multiply and assign operator. | |
basic_fmatrix & | operator/= (const BaseFunction &f) |
Divide and assign operator. | |
basic_fmatrix & | operator*= (const T &d) |
Multiply and assign operator. | |
basic_fmatrix & | operator/= (const T &d) |
Divide and assign operator. | |
basic_fvector< T > | get_row (size_t nRow) const throw (cvmexception) |
Row as not l-value. | |
basic_fvector< T > | get_col (size_t nCol) const throw (cvmexception) |
Column as not l-value. | |
basic_fmatrix & | set_row (size_t nRow, const basic_fvector< T > &fv) throw (cvmexception) |
Row assignment. | |
basic_fmatrix & | set_col (size_t nCol, const basic_fvector< T > &fv) throw (cvmexception) |
Column assignment. | |
basic_fvector< T > | operator* (const basic_fvector< T > &fv) const throw (cvmexception) |
Matrix by vector product | |
basic_fmatrix | operator* (const basic_fmatrix &fm) const throw (cvmexception) |
Matrix by matrix product | |
basic_fmatrix & | mult (const basic_fmatrix &fmA, const basic_fmatrix &fmB) throw (cvmexception) |
Matrix by matrix product | |
Public Member Functions inherited from FArray< T > | |
FArray () | |
Default constructor. | |
FArray (size_t nSize) | |
Constructor. | |
FArray (const FArray &a) | |
Copy constructor. | |
FArray (FArray &&a) | |
Move constructor. | |
FArray (const string_array &saInput) | |
Constructor. | |
FArray (const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings) | |
Constructor. | |
virtual | ~FArray () |
Destructor. | |
std::vector< BaseFunction > & | impl () |
Internal storage. | |
const std::vector< BaseFunction > & | impl () const |
Internal storage. | |
size_t | size () const |
Internal storage. | |
const BaseFunction & | operator[] (size_t n) const |
Constant reference to element (not l-value, zero-based) | |
BaseFunction & | operator[] (size_t n) |
Reference to element (l-value, zero-based) | |
void | value (T *pv) const |
Numerical value. | |
void | value (T d, T *pv) const |
Numerical value. | |
void | value (T d1, T d2, T *pv) const |
Numerical value. | |
void | value (T d1, T d2, T d3, T *pv) const |
Numerical value. | |
void | value (const T *pd, T *pv) const |
Numerical value. |
Protected Types | |
typedef FArray< T > | BaseFArray |
Base class. | |
typedef BaseFArray::BaseFunction | BaseFunction |
Matrix element, i.e. rfunction or cfunction | |
Protected Types inherited from FArray< T > | |
typedef basic_function< T > | BaseFunction |
Vector element, i.e. rfunction or cfunction. |
Protected Attributes | |
size_t | mM |
Number of rows | |
size_t | mN |
Number of columns | |
Protected Attributes inherited from FArray< T > | |
std::vector< BaseFunction > | mv |
Internal storage. |
Friends | |
class | basic_fvector< T > |
std::ostream & | operator<< (std::ostream &os, const basic_fmatrix< T > &fm) |
Output operator. |
Matrix of functions class
T
type stands for treal or tcomplex. Please use inherited rfmatrix and cfmatrix classes. Fortran style storage is used here, i.e. elements are stored by columns (the same way as in basic_rmatrix etc.).
|
protected |
|
protected |
|
inline |
|
inline |
Constructor.
Creates m
-by-n
matrix of zero functions.
[in] | m | Number of rows. |
[in] | n | Number of columns. |
|
inline |
Constructor.
Creates m
-by-n
matrix of functions. Each function element is ininialized using appropriate string as parameterless input in Wolfram's Mathemaca syntax {var1[,var2,...]} expr
. For expression syntax look at basic_function description. Matrix elements are initialized column by column. Constructor throws cvmexception in case of inappropriate sizes passed.
[in] | m | Number of rows. |
[in] | n | Number of columns. |
[in] | saInput | Array of strings with functions' expressions. |
|
inline |
Constructor.
Creates m
-by-n
matrix of parameterized functions. Each function element is ininialized using appropriate string as parameterless input in Wolfram's Mathemaca syntax {var1[,var2,...]} expr
. For expression syntax look at basic_function description. Matrix elements are initialized column by column. Constructor throws cvmexception in case of inappropriate sizes passed.
[in] | m | Number of rows. |
[in] | n | Number of columns. |
[in] | saVars | String array with variables (may be empty). |
[in] | saBodies | String array with functions' expressions. For expression syntax look at basic_function description. |
[in] | saParameters | String array with parameters (may be empty). |
[in] | saMeanings | String array with parameters' meanings (may be empty, must have the same size as saParameters). |
|
inline |
|
inline |
|
inline |
Number of rows.
Returns number of rows of calling matrix.
Definition at line 10174 of file cfun.h.
|
inline |
Number of columns.
Returns number of columns of calling matrix.
Definition at line 10197 of file cfun.h.
|
inline |
Assignment operator.
Assigns basic_fmatrix object to calling one or throws cvmexception if objects have different sizes.
[in] | fm | Const reference to matrix of functions to assign. |
|
inline |
|
inline |
Reference to element (l-value)
Operator provides access to a particular element of calling matrix of functions by its row and column index. Indexes passed are 0-based. This is different from core classes indexing like basic_rmatrix indexing. That's because function arrays are based on std::vector implementation having 0-based indexing. Operator returns l-value in order to make possible write access to an element. Operator throws cvmexception if nRow
or nCol
is outside of boundaries.
[in] | nRow | Row index (0-based). |
[in] | nCol | Column index (0-based). |
|
inline |
Value of element (not l-value)
Operator returns value of a particular element of calling matrix of functions by its row and column index. Indexes passed are 0-based. This is different from core classes indexing like basic_rmatrix indexing. That's because function arrays are based on std::vector implementation having 0-based indexing. Operator throws cvmexception if nRow
or nCol
is outside of boundaries.
[in] | nRow | Row index (0-based). |
[in] | nCol | Column index (0-based). |
|
inline |
Matrices of functions comparison.
Returns true if matrices of functions are equal and false otherwise.
[in] | fm | Const reference to matrix of functions to compare with. |
Definition at line 10373 of file cfun.h.
|
inline |
Matrices of functions comparison.
Returns true if matrices of functions are not equal and false otherwise.
[in] | fm | Const reference to matrix of functions to compare with. |
|
inline |
Replacement operator.
Assigns basic_fmatrix object to calling one without checking anything.
[in] | fm | Const reference to matrix of functions to replace by. |
|
inline |
Partial derivative.
Creates basic_fmatrix object as a partial derivative of calling matrix. Variables set remains the same even if the derivative doesn't depend on some of them. Partial derivative is computed by nVarNum
's variable (0-based, 0 by default).
[in] | nVarNum | Variable's index (0-based, 0 by default). |
|
inline |
Simplifier.
Simplifies basic_fmatrix for fatsest numerical computation possible and returns reference to the object changed.
|
inline |
Addition operator.
Creates basic_fmatrix object as sum of calling matrix and matrix referred by fm
. Operator throws cvmexception if sizes of matrices or lists of variables don't match.
[in] | fm | Const reference to matrix to add. |
|
inline |
Subtraction operator.
Creates basic_fmatrix object as difference of calling matrix and matrix referred by fm
. Operator throws cvmexception if sizes of matrices or lists of variables don't match.
[in] | fm | Const reference to matrix to subtract. |
|
inline |
Increment operator.
Adds to calling basic_fmatrix matrix of functions referred by fm
and returns reference to the object changed. Operator throws cvmexception if sizes of matrices or lists of variables don't match.
[in] | fm | Const reference to matrix to add. |
|
inline |
Decrement operator.
Subtracts from calling basic_fmatrix matrix of functions referred by fm
and returns reference to the object changed. Operator throws cvmexception if sizes of matrices or lists of variables don't match.
[in] | fm | Const reference to matrix to subtract. |
|
inline |
Multiplication operator.
Creates basic_fmatrix object as product of calling matrix and function referred by f
. Operator throws cvmexception if lists of variables don't match.
[in] | f | Const reference to function to multiply by. |
|
inline |
Division operator.
Creates basic_fmatrix object as division of calling matrix by function referred by f
. Operator throws cvmexception if lists of variables don't match.
[in] | f | Const reference to function to divide by. |
|
inline |
Multiplication operator.
Creates basic_fmatrix object as product of calling matrix and real or complex number referred by d
.
[in] | d | Number to multiply by. |
|
inline |
Division operator.
Creates basic_fmatrix object as division of calling matrix by real or complex number referred by d
.
[in] | d | Number to multiply by. |
|
inline |
Multiply and assign operator.
Multiplies calling matrix of functions by function referred by f
and returns reference to the object changed. Operator throws cvmexception if lists of variables don't match.
[in] | f | Const reference to function to multiply by. |
|
inline |
Divide and assign operator.
Divides calling matrix of functions by function referred by f
and returns reference to the object changed. Operator throws cvmexception if lists of variables don't match.
[in] | f | Const reference to function to divide by. |
|
inline |
Multiply and assign operator.
Multiplies calling matrix of functions by real or complex number referred by d
and returns reference to the object changed.
[in] | d | Number to multiply by. |
|
inline |
Divide and assign operator.
Divides calling matrix of functions by real or complex number referred by d
and returns reference to the object changed.
[in] | d | Number to divide by. |
|
inline |
Row as not l-value.
Operator creates basic_fvector object as a copy of nRow-th
row (0-based) of calling matrix. Note: index passed is 0-based. This is different from core classes indexing like basic_rmatrix indexing. Operator throws cvmexception if nRow
is outside of boundaries.
[in] | nRow | Index of row (0-based). |
|
inline |
Column as not l-value.
Operator creates basic_fvector object as a copy of nCol-th
column (0-based) of calling matrix. Note: index passed is 0-based. This is different from core classes indexing like basic_rmatrix indexing. Operator throws cvmexception if nCol
is outside of boundaries.
[in] | nCol | Index of column (0-based). |
|
inline |
Row assignment.
Function assigns basic_fvector object referred by fv
to nRow-th row (0-based) of calling matrix and returns reference to the object changed. Note: index passed is 0-based. This is different from core classes indexing like basic_rmatrix indexing. Operator throws cvmexception if nRow
is outside of boundaries.
[in] | nRow | Index of row (0-based). |
[in] | fv | Vector of functions to assign. |
|
inline |
Column assignment.
Function assigns basic_fvector object referred by fv
to nCol-th column (0-based) of calling matrix and returns reference to the object changed. Note: index passed is 0-based. This is different from core classes indexing like basic_rmatrix indexing. Operator throws cvmexception if nCol
is outside of boundaries.
[in] | nCol | Index of column (0-based). |
[in] | fv | Vector of functions to assign. |
|
inline |
Matrix by vector product
Creates basic_fvector object as product of calling matrix of functions and vector of functions referred by fv
. Operator throws cvmexception if sizes of objects or lists of variables don't match.
[in] | fv | Vector of functions to multiply by. |
|
inline |
Matrix by matrix product
Creates basic_fmatrix object as product of calling matrix of functions and matrix of functions referred by fm
. Operator throws cvmexception if sizes of objects or lists of variables don't match.
[in] | fm | Matrix of functions to multiply by. |
|
inline |
Matrix by matrix product
Sets calling basic_fmatrix object to be product of matrices referred by fmA
and fmB
and returns reference to the object changed. Function throws cvmexception if sizes of objects or lists of variables don't match.
[in] | fmA | Matrix of functions to multiply. |
[in] | fmB | Matrix of functions to multiply by. |
|
friend |
|
friend |
Output operator.
Prints matrix of functions referred by fm
to output stream referred by os
using Wolfram's Mathemaca syntax {var1[,var2,...]} expr
for each element.
[in] | os | Reference to output stream. |
[in] | fm | Const reference to matrix of functions to print. |
|
protected |
|
protected |