Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/tests/lsqrTest2.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/lsqrDense.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/linalg/lsqrDense.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 lsqrDensecxx . . $ lsqrDense# solvercxx . . $ lsqrDense#lsqrDense(49f6e7a06ebc5aa8).;
34
35 const double eps = 1e-15;
36
37 solver.SetOutputStreamcxx . . $ lsqrBase#SetOutputStream(f7f45734e6842120).( std::coutcxx . . $ std/cout. );
38 solver.SetEpsiloncxx . . $ lsqrBase#SetEpsilon(ba8836b59fb42830).( eps );
39 solver.SetDampcxx . . $ lsqrBase#SetDamp(ba8836b59fb42830).( 0.0 );
40 solver.SetMaximumNumberOfIterationscxx . . $ lsqrBase#SetMaximumNumberOfIterations(cb2f890c2fdad230).( 100 );
41 solver.SetToleranceAcxx . . $ lsqrBase#SetToleranceA(ba8836b59fb42830).( 1e-16 );
42 solver.SetToleranceBcxx . . $ lsqrBase#SetToleranceB(ba8836b59fb42830).( 1e-16 );
43 solver.SetUpperLimitOnConditionalcxx . . $ lsqrBase#SetUpperLimitOnConditional(ba8836b59fb42830).( 1.0 / ( 10 * sqrt( eps ) ) );
44 solver.SetStandardErrorEstimatesFlagcxx . . $ lsqrBase#SetStandardErrorEstimatesFlag(b45ddcbc8423892c).( true );
45
46
47 const unsigned int mm = 3;
48 const unsigned int nn = 2;
49
50 double bb[mm];
51 double xx[nn];
52
53 bb[0] = 7.0;
54 bb[1] =-7.0;
55 bb[2] = 2.0;
56
57 solver.SetStandardErrorEstimatesFlagcxx . . $ lsqrBase#SetStandardErrorEstimatesFlag(b45ddcbc8423892c).( true );
58 double se[nn];
59
60 solver.SetStandardErrorEstimatescxx . . $ lsqrBase#SetStandardErrorEstimates(9757410f5581be28).( se );
61
62 // -3 5
63 using RowTypecxx . . $ main(afcd3168fc1188a4).RowType# = double *;
64 RowTypecxx . . $ main(afcd3168fc1188a4).RowType# A[mm];
65 double AA[6];
66 A[0] = &(AA[0]);
67 A[1] = &(AA[2]);
68 A[2] = &(AA[4]);
69 A[0][0] = 1.0;
70 A[0][1] = 2.0;
71 A[1][0] = 4.0;
72 A[1][1] = 1.0;
73 A[2][0] = 1.0;
74 A[2][1] = 1.0;
75 solver.SetMatrixcxx . . $ lsqrDense#SetMatrix(3b0497aa59ba007d).( A );
76
77 solver.Solvecxx . . $ lsqrBase#Solve(e7601b19bca5ff52).( mm, nn, bb, xx );
78
79 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Stopped because " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). solver.GetStoppingReasoncxx . . $ lsqrBase#GetStoppingReason(ddd8539a2fcdd4ce).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
80 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Used " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). solver.GetNumberOfIterationsPerformedcxx . . $ lsqrBase#GetNumberOfIterationsPerformed(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Iterations" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
81 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Frobenius norm estimation of Abar = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFrobeniusNormEstimateOfAbarcxx . . $ lsqrBase#GetFrobeniusNormEstimateOfAbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
82 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Condition number estimation of Abar = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetConditionNumberEstimateOfAbarcxx . . $ lsqrBase#GetConditionNumberEstimateOfAbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
83 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of final value of norm(rbar) = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormRbarcxx . . $ lsqrBase#GetFinalEstimateOfNormRbar(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
84 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of final value of norm of residuals = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormOfResidualscxx . . $ lsqrBase#GetFinalEstimateOfNormOfResiduals(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
85 std::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Estimate of norm of final solution = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). solver.GetFinalEstimateOfNormOfXcxx . . $ lsqrBase#GetFinalEstimateOfNormOfX(21b6c25e127938e2).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). std::endlcxx . . $ std/endl(345bf97a19cc83a9).;
86 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).;
87
88 return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!;
89 }