本文整理汇总了C++中Double::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Double::GetValue方法的具体用法?C++ Double::GetValue怎么用?C++ Double::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Double
的用法示例。
在下文中一共展示了Double::GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char ** argv)
{
while (true)
{
break;
double **a = new double *[2];
a[1] = new double [2];
a[0] = new double [2];
a[0][0] = a[0][1] = a[1][0] = a[1][1] = 1.5;
Numeric *mat = new Matrix (2, 2, a);
Expression *expr = new Expression ("a + 1");
ExpressionParser *parser = new ExpressionParser (expr);
parser->SetVariable("a", mat);
CalculationResult res = parser->ParseExpression ();
cout << res.statusInformation << endl;
delete[] a[0];
delete[] a[1];
delete[] a;
delete mat;
delete expr;
delete parser;
}
while (true)
{
break;
Expression *equation = new Expression ("x - 5");
ExpressionParser *parser = new ExpressionParser (equation);
EquationSolver *solver = new EquationSolver (equation, parser, "x");
Expression *dEquation = new Expression ("1");
CalculationResult result = solver->SolveBySecant (0, 1);
Double *re = static_cast <Double *> (result.numeric.get ());
cout <<re->GetValue () << endl;
delete equation;
delete parser;
delete solver;
delete dEquation;
}
while (true)
{
break;
double a[4][4] = { {1, -1, 2, -1}, {2, -2, 3, -3}, {1, 1, 1, 0}, {1, -1, 4, 3} };
vector < double > *b = new vector < double > { -8, -20, -2, 4 };
double **eles = new double *[4];
for (int i = 0;i < 4;i++)
eles[i] = new double [4];
for (int i = 0;i < 4;i++)
for (int j = 0;j < 4;j++)
eles[i][j] = a[i][j];
Matrix *mat = new Matrix (4, 4, eles);
CalculationResult res = EquationSolver :: SolveByGauss (mat, b);
Array < double > *ans = static_cast < Array < double > * > (res.numeric.get ());
vector < double > anss = ans->GetCopy ();
for (int i = 0;i < anss.size ();i++)
cout << anss[i] << ' ';
cout << endl;
for (int i = 0;i < 4;i++)
delete[] eles[i];
delete[] eles;
delete mat;
delete b;
}
while (true)
{
double a[3][3] = { {25, 15, -5}, {15, 18, 0}, {-5, 0, 11} };
vector < double > *b = new vector < double > { 35, 33, 6 };
double **eles = new double *[3];
for (int i = 0;i < 3;i++)
eles[i] = new double [3];
for (int i = 0;i < 3;i++)
for (int j = 0;j < 3;j++)
eles[i][j] = a[i][j];
Matrix *mat = new Matrix (3, 3, eles);
CalculationResult res = EquationSolver :: SolveByCholesky (mat, b);
Array < double > *ans = static_cast < Array < double > * > (res.numeric.get ());
vector < double > anss = ans->GetCopy ();
for (int i = 0;i < anss.size ();i++)
cout << anss[i] << ' ';
cout << endl;
for (int i = 0;i < 3;i++)
delete[] eles[i];
delete[] eles;
delete mat;
delete b;
}
return 0;
}