Generalized array of functions class (not end-user)
More...
#include <cfun.h>
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 BaseFunction & | operator[] (size_t n) const |
| Constant reference to element (not l-value, zero-based)
|
BaseFunction & | operator[] (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.
|
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
Constructor & Destructor Documentation
Default constructor.
Creates empty array. No memory gets allocated.
Definition at line 7465 of file cfun.h.
Constructor.
Creates function array of nSize
size.
- Parameters
-
[in] | nSize | Number of functions in array. |
Definition at line 7476 of file cfun.h.
Copy constructor.
Creates function array as a copy of array a
.
- Parameters
-
[in] | a | Function array to copy. |
Definition at line 7487 of file cfun.h.
Move constructor.
Definition at line 7496 of file cfun.h.
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] | saInput | Array of strings. |
Definition at line 7509 of file cfun.h.
Constructor.
Creates array of parameterized functions of one or more variables of saBodies.size()
size.
- Parameters
-
[in] | saVars | String array with variables (may be empty). |
[in] | saBodies | String array with function expressions. For expression syntax look at basic_function description. |
[in] | saParameters | String array with parameters (may be empty). |
[in] | saMeanings | String array with parameters' meanings (may be empty, must have the same size as saParameters). |
Definition at line 7528 of file cfun.h.
Destructor.
Definition at line 7540 of file cfun.h.
Member Function Documentation
Internal storage.
Functional arrays are implemented as std::vector
s. This function returns non-const reference to the storage.
- Returns
- Reference to internal
std::vector
storage.
Definition at line 7551 of file cfun.h.
Internal storage.
Functional arrays are implemented as std::vector
s. 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::vector
s. 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.
Constant reference to element (not l-value, zero-based)
Returns constant reference to array's element by its index (zero based).
- Parameters
-
[in] | n | Index of element to return reference to. |
- Returns
- basic_function<T>
Definition at line 7587 of file cfun.h.
Reference to element (l-value, zero-based)
Returns reference to array's element by its index (zero based).
- Parameters
-
[in] | n | Index 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");
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] | pv | Array of functions' values. |
Definition at line 7635 of file cfun.h.
template<typename T>
void FArray< T >::value |
( |
T |
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");
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] | d | Variable's value. |
[out] | pv | Array of functions' values. |
Definition at line 7673 of file cfun.h.
template<typename T>
void FArray< T >::value |
( |
T |
d1, |
|
|
T |
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");
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] | d1 | First variable's value. |
[in] | d2 | Second variable's value. |
[out] | pv | Array of functions' values. |
Definition at line 7712 of file cfun.h.
template<typename T>
void FArray< T >::value |
( |
T |
d1, |
|
|
T |
d2, |
|
|
T |
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");
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] | d1 | First variable's value. |
[in] | d2 | Second variable's value. |
[in] | d3 | Third variable's value. |
[out] | pv | Array 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");
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] | pd | Array of variables' values. |
[out] | pv | Array of functions' values. |
Definition at line 7799 of file cfun.h.
Member Data Documentation
Internal storage.
Definition at line 7448 of file cfun.h.
The documentation for this class was generated from the following file: