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

Vector of real functions. More...

#include <cfun.h>

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

Public Member Functions

 rfvector ()
 Default constructor.
 rfvector (size_t nSize)
 Constructor.
 rfvector (const string_array &saInput)
 Constructor.
 rfvector (const string_array &saVars, const string_array &saBodies, const string_array &saParameters, const string_array &saMeanings)
 Constructor.
 rfvector (const BaseFVector &fv)
 Copy Constructor.
 rfvector (BaseFVector &&fv)
 Move Constructor.
rvector operator() () const
 Numerical value.
rvector operator() (treal d) const
 Numerical value.
rvector operator() (treal d1, treal d2) const
 Numerical value.
rvector operator() (treal d1, treal d2, treal d3) const
 Numerical value.
rvector operator() (const treal *pd) const
 Numerical value.
- Public Member Functions inherited from basic_fvector< treal >
 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 treal &d) const
 Multiplication operator.
BaseFunction operator* (const basic_fvector &fv) const throw (cvmexception)
 Scalar product.
basic_fvector operator* (const basic_fmatrix< treal > &fm) const throw (cvmexception)
 Vector by matrix product.
basic_fvector operator/ (const BaseFunction &f) const
 Division operator.
basic_fvector operator/ (const treal &d) const
 Division operator.
basic_fvectoroperator*= (const BaseFunction &f)
 Multiply and assign operator.
basic_fvectoroperator*= (const treal &d)
 Multiply and assign operator.
basic_fvectoroperator/= (const BaseFunction &f)
 Divide and assign operator.
basic_fvectoroperator/= (const treal &d)
 Divide and assign operator.
basic_fvectormult (const basic_fvector &fv, const basic_fmatrix< treal > &fm) throw (cvmexception)
 Vector by matrix product.
basic_fvectormult (const basic_fmatrix< treal > &fm, const basic_fvector &fv) throw (cvmexception)
 Matrix by vector product
basic_fmatrix< trealjacobian (size_t nfrom=0, size_t vars=0) const
 Jacobi matrix.
void jacobian (basic_fmatrix< treal > &fmj, size_t nfrom=0, size_t vars=0) const
 Jacobi matrix.
- 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_fvector< trealBaseFVector
 Base class.
- Protected Types inherited from basic_fvector< treal >
typedef FArray< trealBaseFArray
 Base class.
typedef BaseFArray::BaseFunction BaseFunction
 Vector 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 FArray< treal >
std::vector< BaseFunctionmv
 Internal storage.

Detailed Description

Vector of real functions.

See Also
basic_fvector
cfvector

Definition at line 9278 of file cfun.h.

Member Typedef Documentation

Base class.

Definition at line 9281 of file cfun.h.

Constructor & Destructor Documentation

rfvector::rfvector ( )
inline

Default constructor.

Creates empty vector of functions. No memory gets allocated.

Definition at line 9289 of file cfun.h.

rfvector::rfvector ( 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 9313 of file cfun.h.

rfvector::rfvector ( 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 9354 of file cfun.h.

rfvector::rfvector ( 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 9404 of file cfun.h.

rfvector::rfvector ( 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 9416 of file cfun.h.

rfvector::rfvector ( BaseFVector &&  fv)
inline

Move Constructor.

Definition at line 9424 of file cfun.h.

Member Function Documentation

rvector rfvector::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)
Returns
vector of functions' values.

Definition at line 9457 of file cfun.h.

Here is the call graph for this function:

rvector rfvector::operator() ( treal  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 9493 of file cfun.h.

Here is the call graph for this function:

rvector rfvector::operator() ( treal  d1,
treal  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 9530 of file cfun.h.

Here is the call graph for this function:

rvector rfvector::operator() ( treal  d1,
treal  d2,
treal  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 9568 of file cfun.h.

Here is the call graph for this function:

rvector rfvector::operator() ( const treal 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 9609 of file cfun.h.

Here is the call graph for this function:


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