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 | Protected Attributes | List of all members
FArray< T > Class Template Reference

Generalized array of functions class (not end-user) More...

#include <cfun.h>

Inheritance diagram for FArray< T >:
Inheritance graph
[legend]
Collaboration diagram for FArray< T >:
Collaboration graph
[legend]

Public Member Functions

 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 (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 basic_function< T > BaseFunction
 Vector element, i.e. rfunction or cfunction.

Protected Attributes

std::vector< BaseFunctionmv
 Internal storage.

Detailed Description

template<typename T>
class FArray< T >

Generalized array of functions class (not end-user)

T type stands for treal or tcomplex. Please use inherited verctor and matrix classes. This one provides some member functions which are common for all arrays.

See Also
basic_fvector
basic_fmatrix

Definition at line 7443 of file cfun.h.

Member Typedef Documentation

template<typename T>
typedef basic_function<T> FArray< T >::BaseFunction
protected

Vector element, i.e. rfunction or cfunction.

Definition at line 7446 of file cfun.h.

Constructor & Destructor Documentation

template<typename T>
FArray< T >::FArray ( )
inline

Default constructor.

Creates empty array. No memory gets allocated.

Definition at line 7465 of file cfun.h.

template<typename T>
FArray< T >::FArray ( size_t  nSize)
inlineexplicit

Constructor.

Creates function array of nSize size.

Parameters
[in]nSizeNumber of functions in array.

Definition at line 7476 of file cfun.h.

template<typename T>
FArray< T >::FArray ( const FArray< T > &  a)
inline

Copy constructor.

Creates function array as a copy of array a.

Parameters
[in]aFunction array to copy.

Definition at line 7487 of file cfun.h.

template<typename T>
FArray< T >::FArray ( FArray< T > &&  a)
inline

Move constructor.

Definition at line 7496 of file cfun.h.

template<typename T>
FArray< T >::FArray ( const string_array saInput)
inlineexplicit

Constructor.

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

Parameters
[in]saInputArray of strings.

Definition at line 7509 of file cfun.h.

template<typename T>
FArray< T >::FArray ( const string_array saVars,
const string_array saBodies,
const string_array saParameters,
const string_array saMeanings 
)
inline

Constructor.

Creates array of parameterized functions of one or more variables of saBodies.size() size.

Parameters
[in]saVarsString array with variables (may be empty).
[in]saBodiesString array with function 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 7528 of file cfun.h.

template<typename T>
virtual FArray< T >::~FArray ( )
inlinevirtual

Destructor.

Definition at line 7540 of file cfun.h.

Member Function Documentation

template<typename T>
std::vector<BaseFunction>& FArray< T >::impl ( )
inline

Internal storage.

Functional arrays are implemented as std::vectors. This function returns non-const reference to the storage.

Returns
Reference to internal std::vector storage.

Definition at line 7551 of file cfun.h.

template<typename T>
const std::vector<BaseFunction>& FArray< T >::impl ( ) const
inline

Internal storage.

Functional arrays are implemented as std::vectors. This function returns const reference to the storage.

Returns
Reference to internal std::vector storage.

Definition at line 7562 of file cfun.h.

template<typename T>
size_t FArray< T >::size ( ) const
inline

Internal storage.

Functional arrays are implemented as std::vectors. This function returns number of elements in the storage. For matrices it's a product of numbers of rows and columns.

Returns
Storage size as size_t.

Definition at line 7575 of file cfun.h.

Here is the caller graph for this function:

template<typename T>
const BaseFunction& FArray< T >::operator[] ( size_t  n) const
inline

Constant reference to element (not l-value, zero-based)

Returns constant reference to array's element by its index (zero based).

Parameters
[in]nIndex of element to return reference to.
Returns
basic_function<T>

Definition at line 7587 of file cfun.h.

template<typename T>
BaseFunction& FArray< T >::operator[] ( size_t  n)
inline

Reference to element (l-value, zero-based)

Returns reference to array's element by its index (zero based).

Parameters
[in]nIndex of element to return reference to.
Returns
basic_function<T>

Definition at line 7599 of file cfun.h.

template<typename T>
void FArray< T >::value ( T *  pv) const
inline

Numerical value.

Returns numerical value of array of functions of no variables. Arrays' dimensions are not verified.

Example:
using namespace cvm;
using namespace std;
funcs.push_back("2*2");
funcs.push_back("3*3");
rfvector rfv(funcs);
cfvector cfv(funcs);
rvector ry(2);
cvector cy(2);
rfv.value(ry);
cfv.value(cy);
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)
Parameters
[out]pvArray of functions' values.

Definition at line 7635 of file cfun.h.

Here is the caller graph for this function:

template<typename T>
void FArray< T >::value ( d,
T *  pv 
) const
inline

Numerical value.

Returns numerical value of array of functions of one variable. Arrays' dimensions are not verified.

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 ry(3);
cvector cy(3);
rfv.value(2., ry);
cfv.value(complex<double>(2.,0.), 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]dVariable's value.
[out]pvArray of functions' values.

Definition at line 7673 of file cfun.h.

template<typename T>
void FArray< T >::value ( d1,
d2,
T *  pv 
) const
inline

Numerical value.

Returns numerical value of array of functions of two variables. Arrays' dimensions are not verified.

Example:
using namespace cvm;
using namespace std;
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(3);
cvector cy(3);
rfv.value(2., 3., ry);
cfv.value(complex<double>(2.,0.), complex<double>(3.,0.), cy);
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.
[out]pvArray of functions' values.

Definition at line 7712 of file cfun.h.

template<typename T>
void FArray< T >::value ( d1,
d2,
d3,
T *  pv 
) const
inline

Numerical value.

Returns numerical value of array of functions of three variables. Arrays' dimensions are not verified.

Example:
using namespace cvm;
using namespace std;
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(3);
cvector cy(3);
rfv.value(3., 2., 2., ry);
cfv.value(complex<double>(3.,0.), complex<double>(2.,0.), complex<double>(2.,0.), cy);
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.
[out]pvArray of functions' values.

Definition at line 7755 of file cfun.h.

template<typename T>
void FArray< T >::value ( const T *  pd,
T *  pv 
) const
inline

Numerical value.

Returns numerical value of array of functions for given values of variables. Arrays' dimensions are not verified.

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]pdArray of variables' values.
[out]pvArray of functions' values.

Definition at line 7799 of file cfun.h.

Member Data Documentation

template<typename T>
std::vector<BaseFunction> FArray< T >::mv
protected

Internal storage.

Definition at line 7448 of file cfun.h.


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