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.
 All Classes Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | Protected Types | List of all members
cfmatrix Class Reference

Matrix of complex functions More...

#include <cfun.h>

Inheritance diagram for cfmatrix:
Inheritance graph
[legend]
Collaboration diagram for cfmatrix:
Collaboration graph
[legend]

Public Member Functions

 cfmatrix ()
 Default constructor.
 cfmatrix (size_t m, size_t n)
 Constructor.
 cfmatrix (size_t m, size_t n, const string_array &saInput)
 Constructor.
 cfmatrix (size_t m, size_t n, const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings)
 Constructor.
 cfmatrix (const BaseFMatrix &fm)
 Copy Constructor.
 cfmatrix (BaseFMatrix &&fm)
 Move Constructor.
cmatrix operator() () const
 Numerical value.
cmatrix operator() (tcomplex d) const
 Numerical value.
cmatrix operator() (tcomplex d1, tcomplex d2) const
 Numerical value.
cmatrix operator() (tcomplex d1, tcomplex d2, tcomplex d3) const
 Numerical value.
cmatrix operator() (const tcomplex *pd) const
 Numerical value.
- Public Member Functions inherited from basic_fmatrix< tcomplex >
 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_fmatrixoperator= (const basic_fmatrix &fm) throw (cvmexception)
 Assignment operator.
basic_fmatrixoperator= (basic_fmatrix &&fm) throw (cvmexception)
 Assignment operator.
BaseFunctionat (size_t nRow, size_t nCol)
 Reference to element (l-value)
const BaseFunctionat (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_fmatrixoperator<< (const basic_fmatrix &fm)
 Replacement operator.
basic_fmatrix drv (size_t nVarNum) const
 Partial derivative.
basic_fmatrixsimp ()
 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_fmatrixoperator+= (const basic_fmatrix &fm) throw (cvmexception)
 Increment operator.
basic_fmatrixoperator-= (const basic_fmatrix &fm) throw (cvmexception)
 Decrement operator.
basic_fmatrix operator* (const BaseFunction &f) const
 Multiplication operator.
basic_fmatrix operator* (const tcomplex &d) const
 Multiplication operator.
basic_fvector< tcomplexoperator* (const basic_fvector< tcomplex > &fv) const throw (cvmexception)
 Matrix by vector product
basic_fmatrix operator* (const basic_fmatrix &fm) const throw (cvmexception)
 Matrix by matrix product
basic_fmatrix operator/ (const BaseFunction &f) const
 Division operator.
basic_fmatrix operator/ (const tcomplex &d) const
 Division operator.
basic_fmatrixoperator*= (const BaseFunction &f)
 Multiply and assign operator.
basic_fmatrixoperator*= (const tcomplex &d)
 Multiply and assign operator.
basic_fmatrixoperator/= (const BaseFunction &f)
 Divide and assign operator.
basic_fmatrixoperator/= (const tcomplex &d)
 Divide and assign operator.
basic_fvector< tcomplexget_row (size_t nRow) const throw (cvmexception)
 Row as not l-value.
basic_fvector< tcomplexget_col (size_t nCol) const throw (cvmexception)
 Column as not l-value.
basic_fmatrixset_row (size_t nRow, const basic_fvector< tcomplex > &fv) throw (cvmexception)
 Row assignment.
basic_fmatrixset_col (size_t nCol, const basic_fvector< tcomplex > &fv) throw (cvmexception)
 Column assignment.
basic_fmatrixmult (const basic_fmatrix &fmA, const basic_fmatrix &fmB) throw (cvmexception)
 Matrix by matrix product
- Public Member Functions inherited from FArray< tcomplex >
 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 BaseFunctionoperator[] (size_t n) const
 Constant reference to element (not l-value, zero-based)
BaseFunctionoperator[] (size_t n)
 Reference to element (l-value, zero-based)
void value (tcomplex *pv) const
 Numerical value.
void value (tcomplexd, tcomplex *pv) const
 Numerical value.
void value (tcomplexd1, tcomplexd2, tcomplex *pv) const
 Numerical value.
void value (tcomplexd1, tcomplexd2, tcomplexd3, tcomplex *pv) const
 Numerical value.
void value (const tcomplex *pd, tcomplex *pv) const
 Numerical value.

Protected Types

typedef basic_fmatrix< tcomplexBaseFMatrix
 Base class.
- Protected Types inherited from basic_fmatrix< tcomplex >
typedef FArray< tcomplexBaseFArray
 Base class.
typedef BaseFArray::BaseFunction BaseFunction
 Matrix element, i.e. rfunction or cfunction
- Protected Types inherited from FArray< tcomplex >
typedef basic_function< tcomplexBaseFunction
 Vector element, i.e. rfunction or cfunction.

Additional Inherited Members

- Protected Attributes inherited from basic_fmatrix< tcomplex >
size_t mM
 Number of rows
size_t mN
 Number of columns

Detailed Description

Matrix of complex functions

Fortran style storage is used here, i.e. elements are stored by columns (the same way as in basic_rmatrix etc.).

See Also
basic_fmatrix
rfmatrix

Definition at line 11934 of file cfun.h.

Member Typedef Documentation

Base class.

Definition at line 11937 of file cfun.h.

Constructor & Destructor Documentation

cfmatrix::cfmatrix ( )
inline

Default constructor.

Creates empty matrix of functions. No memory gets allocated.

Definition at line 11945 of file cfun.h.

cfmatrix::cfmatrix ( size_t  m,
size_t  n 
)
inline

Constructor.

Creates m-by-n matrix of zero functions.

Example:
using namespace cvm;
rfmatrix rfm(2,3);
std::cout << rfm;
cfmatrix cfm(2,3);
std::cout << cfm;
prints
0 0 0
0 0 0
(0,0) (0,0) (0,0)
(0,0) (0,0) (0,0)
Parameters
[in]mNumber of rows.
[in]nNumber of columns.

Definition at line 11972 of file cfun.h.

cfmatrix::cfmatrix ( size_t  m,
size_t  n,
const string_array saInput 
)
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.

Example:
using namespace cvm;
funcs.push_back("{x} x");
funcs.push_back("{x} x^2");
funcs.push_back("{x} x^3");
funcs.push_back("{x} x^4");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
std::cout << rfm << std::endl;
std::cout << cfm << std::endl;
prints
{x} x {x} x^3
{x} x^2 {x} x^4
{x} x {x} x^(3,0)
{x} x^(2,0) {x} x^(4,0)
Parameters
[in]mNumber of rows.
[in]nNumber of columns.
[in]saInputArray of strings with functions' expressions.

Definition at line 12011 of file cfun.h.

cfmatrix::cfmatrix ( size_t  m,
size_t  n,
const string_array saVars,
const string_array saBodies,
const string_array saParameters,
const string_array saMeanings 
)
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.

Example:
using namespace cvm;
try{
string_array vars, bodies, params, meanings;
vars.push_back("x");
vars.push_back("y");
params.push_back("p");
meanings.push_back("sqrt(x) + sqrt(y)");
bodies.push_back("p*x");
bodies.push_back("p+1");
bodies.push_back("p*y");
bodies.push_back("p-1");
rfmatrix rm(2, 2, vars, bodies, params, meanings);
std::cout << rm;
cfmatrix cm(2, 2, vars, bodies, params, meanings);
std::cout << cm;
}
catch (std::exception& e) {
std::cout << "Exception " << e.what () << std::endl;
}
prints
{x,y} (sqrt(x)+sqrt(y))*x {x,y} (sqrt(x)+sqrt(y))*y
{x,y} sqrt(x)+sqrt(y)+1 {x,y} sqrt(x)+sqrt(y)-1
{x,y} (sqrt(x)+sqrt(y))*x {x,y} (sqrt(x)+sqrt(y))*y
{x,y} sqrt(x)+sqrt(y)+(1,0) {x,y} sqrt(x)+sqrt(y)-(1,0)
Parameters
[in]mNumber of rows.
[in]nNumber of columns.
[in]saVarsString array with variables (may be empty).
[in]saBodiesString array with functions' expressions. For expression syntax look at basic_function description.
[in]saParametersString array with parameters (may be empty).
[in]saMeaningsString array with parameters' meanings (may be empty, must have the same size as saParameters).

Definition at line 12062 of file cfun.h.

cfmatrix::cfmatrix ( const BaseFMatrix fm)
inline

Copy Constructor.

Creates copy of matrix of functions referred by fm.

Parameters
[in]fmMatrix of functions (or cfmatrix) to copy from.

Definition at line 12074 of file cfun.h.

cfmatrix::cfmatrix ( BaseFMatrix &&  fm)
inline

Move Constructor.

Definition at line 12082 of file cfun.h.

Member Function Documentation

cmatrix cfmatrix::operator() ( ) const
inline

Numerical value.

Returns numerical value of matrix of functions of no variables.

Example:
using namespace cvm;
funcs.push_back("1*1");
funcs.push_back("2*2");
funcs.push_back("3*3");
funcs.push_back("4*4");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
rmatrix ry = rfm();
cmatrix cy = cfm();
std::cout << rfm << ry << std::endl;
std::cout << cfm << cy << std::endl;
prints
1*1 3*3
2*2 4*4
1 9
4 16
(1,0)*(1,0) (3,0)*(3,0)
(2,0)*(2,0) (4,0)*(4,0)
(1,0) (9,0)
(4,0) (16,0)
Returns
vector of functions' values.

Definition at line 12121 of file cfun.h.

Here is the call graph for this function:

cmatrix cfmatrix::operator() ( tcomplex  d) const
inline

Numerical value.

Returns numerical value of matrix of functions of one variable.

Example:
using namespace cvm;
funcs.push_back("{x} x");
funcs.push_back("{x} x^2");
funcs.push_back("{x} x^3");
funcs.push_back("{x} x^4");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
rmatrix ry = rfm(2.);
cmatrix cy = cfm(tcomplex(2.,0.));
std::cout << rfm << ry << std::endl;
std::cout << cfm << cy << std::endl;
prints
{x} x {x} x^3
{x} x^2 {x} x^4
2 8
4 16
{x} x {x} x^(3,0)
{x} x^(2,0) {x} x^(4,0)
(2,0) (8,0)
(4,0) (16,0)
Parameters
[in]dvariable's value.
Returns
matrix of functions' values.

Definition at line 12162 of file cfun.h.

Here is the call graph for this function:

cmatrix cfmatrix::operator() ( tcomplex  d1,
tcomplex  d2 
) const
inline

Numerical value.

Returns numerical value of matrix of functions of two variables.

Example:
using namespace cvm;
funcs.push_back("{x,y} x+y");
funcs.push_back("{x,y} x-y");
funcs.push_back("{x,y} x*y");
funcs.push_back("{x,y} x^y");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
rmatrix ry = rfm(2., 3.);
cmatrix cy = cfm(tcomplex(2.,0.), tcomplex(3.,0.));
std::cout << rfm << ry << std::endl;
std::cout << cfm << cy << std::endl;
prints
{x,y} x+y {x,y} x*y
{x,y} x-y {x,y} x^y
5 6
-1 8
{x,y} x+y {x,y} x*y
{x,y} x-y {x,y} x^y
(5,0) (6,0)
(-1,0) (8,0)
Parameters
[in]d1First variable's value.
[in]d2Second variable's value.
Returns
matrix of functions' values.

Definition at line 12204 of file cfun.h.

Here is the call graph for this function:

cmatrix cfmatrix::operator() ( tcomplex  d1,
tcomplex  d2,
tcomplex  d3 
) const
inline

Numerical value.

Returns numerical value of matrix of functions of three variables.

Example:
using namespace cvm;
funcs.push_back("{x,y,z} x+y+z");
funcs.push_back("{x,y,z} x-y-z");
funcs.push_back("{x,y,z} x*y*z");
funcs.push_back("{x,y,z} x^y^z");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
rmatrix ry = rfm(3., 2., 2.);
cmatrix cy = cfm(tcomplex(3.,0.), tcomplex(2.,0.), tcomplex(2.,0.));
std::cout << rfm << ry << std::endl;
std::cout << cfm << cy << std::endl;
prints
{x,y,z} x+y+z {x,y,z} x*y*z
{x,y,z} x-y-z {x,y,z} x^(y^z)
7 12
-1 81
{x,y,z} x+y+z {x,y,z} x*y*z
{x,y,z} x-y-z {x,y,z} x^(y^z)
(7,0) (12,0)
(-1,0) (81,0)
Parameters
[in]d1First variable's value.
[in]d2Second variable's value.
[in]d3Third variable's value.
Returns
matrix of functions' values.

Definition at line 12247 of file cfun.h.

Here is the call graph for this function:

cmatrix cfmatrix::operator() ( const tcomplex pd) const
inline

Numerical value.

Returns numerical value of matrix of functions for given values of variables. Array's dimension is not verified.

Example:
using namespace cvm;
funcs.push_back("{x,y,z} x+y+z");
funcs.push_back("{x,y,z} x-y-z");
funcs.push_back("{x,y,z} x*y*z");
funcs.push_back("{x,y,z} x^y^z");
rfmatrix rfm(2,2,funcs);
cfmatrix cfm(2,2,funcs);
rvector rx(3);
cvector cx(3);
rx[1] = 3.; rx[2] = 2.; rx[3] = 2.;
cx[1] = tcomplex(3.,0.); cx[2] = tcomplex(2.,0.); cx[3] = tcomplex(2.,0.);
rmatrix ry = rfm(rx);
cmatrix cy = cfm(cx);
std::cout << rfm << ry << std::endl;
std::cout << cfm << cy << std::endl;
prints
{x,y,z} x+y+z {x,y,z} x*y*z
{x,y,z} x-y-z {x,y,z} x^(y^z)
7 12
-1 81
{x,y,z} x+y+z {x,y,z} x*y*z
{x,y,z} x-y-z {x,y,z} x^(y^z)
(7,0) (12,0)
(-1,0) (81,0)
Parameters
[in]pdarray of variables' values.
Returns
vector of functions' values.

Definition at line 12293 of file cfun.h.

Here is the call graph for this function:


The documentation for this class was generated from the following file: