Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TVectorValue *DefineVector(const DewString &AVarName, TVec *Vec); | Defines new vector variable. |
| 2 | TVectorValue *DefineVector(const DewString &AVarName); | Use internal vector. |
Overload 1: TVectorValue *DefineVector(const DewString &AVarName, TVec *Vec);
Defines new vector variable.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | const DewString & | |
| 2 | Vec | TVec * |
Remarks:
If variable with name AVarName already was definded, it is redefined and all expressions which contain the symbol AVarName will be recompiled before the next evaluation. External vector may be assigned as values holder. If external vector is not assigned, internal vector will be used.
Examples
#include "MtxExpr.h"
#include "MtxParseClass.h"
#include "MtxParseExpr.h"
using namespace Dew;
using namespace Dew::Math;
void Example()
{
TMtxExpression* MyParser = new TMtxExpression();
// 1. Define variables
TVectorValue* x = MyParser->DefineVector("x");
TDoubleValue* s = MyParser->DefineDouble("s");
// 2. Set values
x->Value->SetIt(false, DewArray<double>{1, -1, 1});
s->DoubleValue = 0.5;
// 3. Add formula and evaluate,
MyParser->AddExpr("-s*x");
Vector res(0);
res.Copy(MyParser->EvaluateVector());
// res = (-0.5,0.5, -0.5)
delete MyParser;
}
See Also: TMtxExpression::Undefine, TMtxExpression::VarByName, TMtxExpression::GetVarList, TMtxExpression::DefineVariable, TMtxExpression::DefineDouble, TMtxExpression::DefineComplex, TMtxExpression::DefineMatrix, TMtxExpression::DefineFunction, TMtxExpression::DefineVaryingFunction, TMtxExpression::DefineOperator, TMtxExpression::DefineDoubleConstant, TMtxExpression::DefineComplexConstant
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 2: TVectorValue *DefineVector(const DewString &AVarName);
Use internal vector.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | const DewString & |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler