least_squares - Solves Ax=b in the least squares sense.


#include "n/n_fit.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

int least_squares
	Vector **result_vpp,
	const Matrix *A_mp,
	const Vector *b_vp


This routine solves Ax=b in the least squares sense. It is like least_squares_2() except that the fitting error is not returned. Put differently, this routine calculates

  MIN { || Ax - b ||  }
   x                2

The result is put into the vector pointed to by *result_vpp, which is created if it is NULL, resized if it is the wrong sized, and reused otherwise. The number of rows in the matrix pointed to by the argument "mp" (i.e, A, above) must be the same as the length of the vector pointed to by the argument "vp" (i.e. b, above). In addition, the number of columns of of *mp (i.e, number of unknowns) cannot exceed the number of rows of *mp (number of equations). This routine relies on the user settable run-time option "least-squares-method" which currently has two possible values ("svd", or "pseudo-inverse") with "svd" being the default. However, neither of these is likely what we want to do for large problems. (UNDER CONSTRUCTION).


NO_ERROR on success, and ERROR on failure, with an appropriate error message being set.


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


least_squares_2 , get_linear_equation_rms_error , get_best_diagonal_post_map , get_diagonal_post_map_error , get_best_map , get_best_post_map , get_post_map_error , get_svd_basis_for_rows , get_row_fits , project_rows_onto_basis , get_best_linear_fit , get_best_linear_fit_2