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
rfmatrix Class Reference

Matrix of real functions More...

#include <cfun.h>

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

Public Member Functions

 rfmatrix ()
 Default constructor.
 rfmatrix (size_t m, size_t n)
 Constructor.
 rfmatrix (size_t m, size_t n, const string_array &saInput)
 Constructor.
 rfmatrix (size_t m, size_t n, const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings)
 Constructor.
 rfmatrix (const BaseFMatrix &fm)
 Copy Constructor.
 rfmatrix (BaseFMatrix &&fm)
 Move Constructor.
rmatrix operator() () const
 Numerical value.
rmatrix operator() (treal d) const
 Numerical value.
rmatrix operator() (treal d1, treal d2) const
 Numerical value.
rmatrix operator() (treal d1, treal d2, treal d3) const
 Numerical value.
rmatrix operator() (const treal *pd) const
 Numerical value.
- Public Member Functions inherited from basic_fmatrix< treal >
 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 treal &d) const
 Multiplication operator.
basic_fvector< trealoperator* (const basic_fvector< treal > &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 treal &d) const
 Division operator.
basic_fmatrixoperator*= (const BaseFunction &f)
 Multiply and assign operator.
basic_fmatrixoperator*= (const treal &d)
 Multiply and assign operator.
basic_fmatrixoperator/= (const BaseFunction &f)
 Divide and assign operator.
basic_fmatrixoperator/= (const treal &d)
 Divide and assign operator.
basic_fvector< trealget_row (size_t nRow) const throw (cvmexception)
 Row as not l-value.
basic_fvector< trealget_col (size_t nCol) const throw (cvmexception)
 Column as not l-value.
basic_fmatrixset_row (size_t nRow, const basic_fvector< treal > &fv) throw (cvmexception)
 Row assignment.
basic_fmatrixset_col (size_t nCol, const basic_fvector< treal > &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< treal >
 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 (treal *pv) const
 Numerical value.
void value (treald, treal *pv) const
 Numerical value.
void value (treald1, treald2, treal *pv) const
 Numerical value.
void value (treald1, treald2, treald3, treal *pv) const
 Numerical value.
void value (const treal *pd, treal *pv) const
 Numerical value.

Protected Types

typedef basic_fmatrix< trealBaseFMatrix
 Base class.
- Protected Types inherited from basic_fmatrix< treal >
typedef FArray< trealBaseFArray
 Base class.
typedef BaseFArray::BaseFunction BaseFunction
 Matrix element, i.e. rfunction or cfunction
- Protected Types inherited from FArray< treal >
typedef basic_function< trealBaseFunction
 Vector element, i.e. rfunction or cfunction.

Additional Inherited Members

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

Detailed Description

Matrix of real 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
cfmatrix

Definition at line 11558 of file cfun.h.

Member Typedef Documentation

Base class.

Definition at line 11561 of file cfun.h.

Constructor & Destructor Documentation

rfmatrix::rfmatrix ( )
inline

Default constructor.

Creates empty matrix of functions. No memory gets allocated.

Definition at line 11569 of file cfun.h.

rfmatrix::rfmatrix ( 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 11596 of file cfun.h.

rfmatrix::rfmatrix ( 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 11635 of file cfun.h.

rfmatrix::rfmatrix ( 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 Mathematica 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 11686 of file cfun.h.

rfmatrix::rfmatrix ( const BaseFMatrix fm)
inline

Copy Constructor.

Creates copy of matrix of functions referred by fm.

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

Definition at line 11698 of file cfun.h.

rfmatrix::rfmatrix ( BaseFMatrix &&  fm)
inline

Move Constructor.

Definition at line 11706 of file cfun.h.

Member Function Documentation

rmatrix rfmatrix::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 11745 of file cfun.h.

Here is the call graph for this function:

rmatrix rfmatrix::operator() ( treal  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 11786 of file cfun.h.

Here is the call graph for this function:

rmatrix rfmatrix::operator() ( treal  d1,
treal  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 11828 of file cfun.h.

Here is the call graph for this function:

rmatrix rfmatrix::operator() ( treal  d1,
treal  d2,
treal  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 11871 of file cfun.h.

Here is the call graph for this function:

rmatrix rfmatrix::operator() ( const treal 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 11917 of file cfun.h.

Here is the call graph for this function:


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