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

Vector of complex functions. More...

#include <cfun.h>

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

Public Member Functions

 cfvector ()
 Default constructor.
 cfvector (size_t nSize)
 Constructor.
 cfvector (const string_array &saInput)
 Constructor.
 cfvector (const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings)
 Constructor.
 cfvector (const BaseFVector &fv)
 Copy Constructor.
 cfvector (BaseFVector &&fv)
 Move Constructor.
cvector operator() () const
 Numerical value.
cvector operator() (tcomplex d) const
 Numerical value.
cvector operator() (tcomplex d1, tcomplex d2) const
 Numerical value.
cvector operator() (tcomplex d1, tcomplex d2, tcomplex d3) const
 Numerical value.
cvector operator() (const tcomplex *pd) const
 Numerical value.
- Public Member Functions inherited from basic_fvector< tcomplex >
 basic_fvector ()
 Default constructor.
 basic_fvector (size_t nSize)
 Constructor.
 basic_fvector (const string_array &saInput)
 Constructor.
 basic_fvector (const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings)
 Constructor.
 basic_fvector (const basic_fvector &fv)
 Copy Constructor.
 basic_fvector (basic_fvector &&fv)
 Move Constructor.
basic_fvectoroperator= (const basic_fvector &fv) throw (cvmexception)
 Assignment operator.
basic_fvectoroperator= (basic_fvector &&fv) throw (cvmexception)
 Move sssignment operator.
bool operator== (const basic_fvector &fv) const
 Vectors of functions comparison.
bool operator!= (const basic_fvector &fv) const
 Vectors of functions comparison.
basic_fvectoroperator<< (const basic_fvector &fv)
 Replacement operator.
basic_fvector drv (size_t nVarNum) const
 Partial derivative.
basic_fvectorsimp ()
 Simplifier.
basic_fvector operator+ (const basic_fvector &fv) const throw (cvmexception)
 Addition operator.
basic_fvector operator- (const basic_fvector &fv) const throw (cvmexception)
 Subtraction operator.
basic_fvectoroperator+= (const basic_fvector &fv) throw (cvmexception)
 Increment operator.
basic_fvectoroperator-= (const basic_fvector &fv) throw (cvmexception)
 Decrement operator.
basic_fvector operator* (const BaseFunction &f) const
 Multiplication operator.
basic_fvector operator* (const tcomplex &d) const
 Multiplication operator.
BaseFunction operator* (const basic_fvector &fv) const throw (cvmexception)
 Scalar product.
basic_fvector operator* (const basic_fmatrix< tcomplex > &fm) const throw (cvmexception)
 Vector by matrix product.
basic_fvector operator/ (const BaseFunction &f) const
 Division operator.
basic_fvector operator/ (const tcomplex &d) const
 Division operator.
basic_fvectoroperator*= (const BaseFunction &f)
 Multiply and assign operator.
basic_fvectoroperator*= (const tcomplex &d)
 Multiply and assign operator.
basic_fvectoroperator/= (const BaseFunction &f)
 Divide and assign operator.
basic_fvectoroperator/= (const tcomplex &d)
 Divide and assign operator.
basic_fvectormult (const basic_fvector &fv, const basic_fmatrix< tcomplex > &fm) throw (cvmexception)
 Vector by matrix product.
basic_fvectormult (const basic_fmatrix< tcomplex > &fm, const basic_fvector &fv) throw (cvmexception)
 Matrix by vector product
basic_fmatrix< tcomplexjacobian (size_t nfrom=0, size_t vars=0) const
 Jacobi matrix.
void jacobian (basic_fmatrix< tcomplex > &fmj, size_t nfrom=0, size_t vars=0) const
 Jacobi matrix.
- 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_fvector< tcomplexBaseFVector
 Base class.
- Protected Types inherited from basic_fvector< tcomplex >
typedef FArray< tcomplexBaseFArray
 Base class.
typedef BaseFArray::BaseFunction BaseFunction
 Vector 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 FArray< tcomplex >
std::vector< BaseFunctionmv
 Internal storage.

Detailed Description

Vector of complex functions.

See Also
basic_fvector
rfvector

Definition at line 9623 of file cfun.h.

Member Typedef Documentation

Base class.

Definition at line 9626 of file cfun.h.

Constructor & Destructor Documentation

cfvector::cfvector ( )
inline

Default constructor.

Creates empty vector of functions. No memory gets allocated.

Definition at line 9634 of file cfun.h.

cfvector::cfvector ( size_t  nSize)
inlineexplicit

Constructor.

Creates vector of zero functions of nSize size.

Example:
using namespace cvm;
rfvector rfv(3);
std::cout << rfv;
cfvector cfv(3);
std::cout << cfv;
prints
0 0 0
(0,0) (0,0) (0,0)
Parameters
[in]nSizeNumber of functions in array.

Definition at line 9658 of file cfun.h.

cfvector::cfvector ( const string_array saInput)
inlineexplicit

Constructor.

Creates vector of functions of saInput.size() size. Each function element is ininialized using appropriate string as parameterless input in Wolfram's Mathemaca syntax {var1[,var2,...]} expr

Example:
using namespace cvm;
using namespace std;
funcs.push_back("{x} x");
funcs.push_back("{x} x^2");
funcs.push_back("{x} x^3");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector rx(1), ry(3);
cvector cx(1), cy(3);
rx(1) = 2.;
cx(1) = complex<double>(2.,0.);
rfv.value(rx, ry);
cfv.value(cx, cy);
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
{x} x {x} x^2 {x} x^3
2 4 8
{x} x {x} x^(2,0) {x} x^(3,0)
(2,0) (4,0) (8,0)
Parameters
[in]saInputArray of strings.

Definition at line 9699 of file cfun.h.

cfvector::cfvector ( const string_array saVars,
const string_array saBodies,
const string_array saParameters,
const string_array saMeanings 
)
inline

Constructor.

Creates vector of parameterized functions of one or more variables. Throws cvmexception in case of syntax or memory allocation error.

Example:
using namespace cvm;
using namespace std;
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^2");
bodies.push_back("p");
bodies.push_back("x+y");
rfvector rfv(vars, bodies, params, meanings);
rvector rv(3);
rfv.value(4., 1., rv);
std::cout << rfv << rv;
cfvector cfv(vars, bodies, params, meanings);
cvector cv(3);
cfv.value(complex<double>(4., 0.), complex<double>(1., 0.), cv);
std::cout << cfv << cv;
}
catch (std::exception& e) {
std::cout << "Exception " << e.what () << std::endl;
}
prints
{x,y} (sqrt(x)+sqrt(y))^2 {x,y} sqrt(x)+sqrt(y) {x,y} x+y
9 3 5
{x,y} (sqrt(x)+sqrt(y))^(2,0) {x,y} sqrt(x)+sqrt(y) {x,y} x+y
(9,0) (3,0) (5,0)
Parameters
[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 9749 of file cfun.h.

cfvector::cfvector ( const BaseFVector fv)
inline

Copy Constructor.

Creates copy of vector of functions referred by fv.

Parameters
[in]fvVector of functions (rfvector or cfvector) to copy from.

Definition at line 9761 of file cfun.h.

cfvector::cfvector ( BaseFVector &&  fv)
inline

Move Constructor.

Definition at line 9769 of file cfun.h.

Member Function Documentation

cvector cfvector::operator() ( ) const
inline

Numerical value.

Returns numerical value of vector of functions of no variables.

Example:
using namespace cvm;
funcs.push_back("2*2");
funcs.push_back("3*3");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector ry = rfv();
cvector cy = cfv();
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
2*2 3*3
4 9
(2,0)*(2,0) (3,0)*(3,0)
(4,0) (9,0)

Definition at line 9801 of file cfun.h.

Here is the call graph for this function:

cvector cfvector::operator() ( tcomplex  d) const
inline

Numerical value.

Returns numerical value of vector 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");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector ry = rfv(2.);
cvector cy = cfv(tcomplex(2.,0.));
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
{x} x {x} x^2 {x} x^3
2 4 8
{x} x {x} x^(2,0) {x} x^(3,0)
(2,0) (4,0) (8,0)
Parameters
[in]dvariable's value.
Returns
vector of functions' values.

Definition at line 9837 of file cfun.h.

Here is the call graph for this function:

cvector cfvector::operator() ( tcomplex  d1,
tcomplex  d2 
) const
inline

Numerical value.

Returns numerical value of vector 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");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector ry = rfv(2., 3.);
cvector cy = cfv(tcomplex(2.,0.), tcomplex(3.,0.));
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
{x,y} x+y {x,y} x*y {x,y} x^y
5 6 8
{x,y} x+y {x,y} x*y {x,y} x^y
(5,0) (6,0) (8,0)
Parameters
[in]d1First variable's value.
[in]d2Second variable's value.
Returns
vector of functions' values.

Definition at line 9874 of file cfun.h.

Here is the call graph for this function:

cvector cfvector::operator() ( tcomplex  d1,
tcomplex  d2,
tcomplex  d3 
) const
inline

Numerical value.

Returns numerical value of vector 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");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector ry = rfv(3., 2., 2.);
cvector cy = cfv(tcomplex(3.,0.), tcomplex(2.,0.), tcomplex(2.,0.));
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
{x,y,z} x+y+z {x,y,z} x*y*z {x,y,z} x^(y^z)
7 12 81
{x,y,z} x+y+z {x,y,z} x*y*z {x,y,z} x^(y^z)
(7,0) (12,0) (81,0)
Parameters
[in]d1First variable's value.
[in]d2Second variable's value.
[in]d3Third variable's value.
Returns
vector of functions' values.

Definition at line 9912 of file cfun.h.

Here is the call graph for this function:

cvector cfvector::operator() ( const tcomplex pd) const
inline

Numerical value.

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

Example:
using namespace cvm;
funcs.push_back("{x} x");
funcs.push_back("{x} x^2");
funcs.push_back("{x} x^3");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector rx(1);
cvector cx(1);
rx(1) = 2.;
cx(1) = tcomplex(2.,0.);
rvector ry = rfv(rx);
cvector cy = cfv(cx);
std::cout << rfv << ry << std::endl;
std::cout << cfv << cy << std::endl;
prints
{x} x {x} x^2 {x} x^3
2 4 8
{x} x {x} x^(2,0) {x} x^(3,0)
(2,0) (4,0) (8,0)
Parameters
[in]pdarray of variables' values.
Returns
vector of functions' values.

Definition at line 9953 of file cfun.h.

Here is the call graph for this function:


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