vnl_linear_system.cxx
Go to the documentation of this file.
1 // This is core/vnl/vnl_linear_system.cxx
2 //:
3 // \file
4 // \author David Capel, capes@robots
5 // \date July 2000
6 
7 #include "vnl_linear_system.h"
8 #include <cassert>
9 
11 
13 {
14  assert(px.size() == x.size());
15 
16  px = x;
17 }
18 
20 {
21  vnl_vector<double> resid(n_);
23 
24  multiply(x, resid);
25  get_rhs(b);
26 
27  resid -= b;
28 
29  return resid.rms();
30 }
31 
33 {
34  vnl_vector<double> resid(n_);
36 
37  multiply(x, resid);
38  get_rhs(b);
39 
40  resid -= b;
41 
42  return resid.rms() / b.rms();
43 }
virtual void multiply(vnl_vector< double > const &x, vnl_vector< double > &y) const =0
Compute A*x, putting result in y.
virtual void get_rhs(vnl_vector< double > &b) const =0
double get_relative_residual(vnl_vector< double > const &x) const
Compute relative residual (|Ax - b| / |b| )for parameter vector x.
abs_t rms() const
Root Mean Squares of values.
Definition: vnl_vector.h:300
size_t size() const
Return the length, number of elements, dimension of this vector.
Definition: vnl_vector.h:126
double get_rms_error(vnl_vector< double > const &x) const
Compute rms error for parameter vector x.
virtual void apply_preconditioner(vnl_vector< double > const &x, vnl_vector< double > &px) const
virtual ~vnl_linear_system()
Abstraction for a linear system of equations.