Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/tests/lsmrTest2.cxx

raw symbols SCIP
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19 #include "linalg/lsmrDense.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsmrDense.h`/
20
21 #include <iostream>
22
23 #include <cstdlib>
24 #include <cmath>
25
26
27 //
28 // A more interesting testing case, but still a basic one.
29 //
30 int maincxx . . $ main(afcd3168fc1188a4).( int , char * [] )
31 {
32
33 lsmrDensecxx . . $ lsmrDense# solvercxx . . $ lsmrDense#lsmrDense(49f6e7a06ebc5aa8).;
34
35 const double eps = 1e-15;
36
37 solver.SetOutputStreamcxx . . $ lsmrBase#SetOutputStream(f7f45734e6842120).( std::coutcxx . . $ std/cout. );
38 solver.SetEpsiloncxx . . $ lsmrBase#SetEpsilon(ba8836b59fb42830).( eps );
39 solver.SetDampcxx . . $ lsmrBase#SetDamp(ba8836b59fb42830).( 0.0 );
40 solver.SetMaximumNumberOfIterationscxx . . $ lsmrBase#SetMaximumNumberOfIterations(cb2f890c2fdad230).( 100 );
41 solver.SetToleranceAcxx . . $ lsmrBase#SetToleranceA(ba8836b59fb42830).( 1e-16 );
42 solver.SetToleranceBcxx . . $ lsmrBase#SetToleranceB(ba8836b59fb42830).( 1e-16 );
43 solver.SetUpperLimitOnConditionalcxx . . $ lsmrBase#SetUpperLimitOnConditional(ba8836b59fb42830).( 1.0 / ( 10 * sqrt( eps ) ) );
44
45
46 const unsigned int mm = 3;
47 const unsigned int nn = 2;
48
49 double bb[mm];
50 double xx[nn];
51
52 bb[0] = 7.0;
53 bb[1] =-7.0;
54 bb[2] = 2.0;
55
56 // -3 5
57 using RowTypecxx . . $ main(afcd3168fc1188a4).RowType# = double *;
58 RowTypecxx . . $ main(afcd3168fc1188a4).RowType# A[mm];
59 double AA[6];
60 A[0] = &(AA[0]);
61 A[1] = &(AA[2]);
62 A[2] = &(AA[4]);
63 A[0][0] = 1.0;
64 A[0][1] = 2.0;
65 A[1][0] = 4.0;
66 A[1][1] = 1.0;
67 A[2][0] = 1.0;
68 A[2][1] = 1.0;
69 solver.SetMatrixcxx . . $ lsmrDense#SetMatrix(3b0497aa59ba007d).( A );
70
71 solver.Solvecxx . . $ lsmrBase#Solve(e7601b19bca5ff52).( mm, nn, bb, xx );
72
73 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Stopped because " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). solver.GetStoppingReasoncxx . . $ lsmrBase#GetStoppingReason(ddd8539a2fcdd4ce).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
74 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Used " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). solver.GetNumberOfIterationsPerformedcxx . . $ lsmrBase#GetNumberOfIterationsPerformed(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Iterations" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
75 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Frobenius norm estimation of Abar = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFrobeniusNormEstimateOfAbarcxx . . $ lsmrBase#GetFrobeniusNormEstimateOfAbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
76 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Condition number estimation of Abar = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetConditionNumberEstimateOfAbarcxx . . $ lsmrBase#GetConditionNumberEstimateOfAbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
77 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of final value of norm(rbar) = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormRbarcxx . . $ lsmrBase#GetFinalEstimateOfNormRbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
78 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of final value of norm of residuals = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormOfResidualscxx . . $ lsmrBase#GetFinalEstimateOfNormOfResiduals(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
79 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of norm of final solution = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormOfXcxx . . $ lsmrBase#GetFinalEstimateOfNormOfX(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
80 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Solution = xx = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). xx[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). xx[1] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
81
82 return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!;
83 }