next up previous contents index
Next: Subroutine update_running_average_and_variance Up: Module linearalgebra_module Previous: Subroutine zero_sum   Contents   Index

Subroutine least_squares


\begin{boxedminipage}{\textwidth}
\begin{verbatim}call least_squares(x,y,sig,a, &
chisq,funcs)\end{verbatim}
\end{boxedminipage}

Linear Least Squares fit using LAPACK to do singular value decomposition.

Fit data y with errors sig to model using parameters a, and calculate $\chi^2$ of the fit. The user defined subroutine funcs should return the model parameters a for the point x in the array afunc.

x, y, sig -- real(dp), intent(in), dimension(:)

a -- real(dp), intent(out), dimension(:)

chisq -- real(dp), intent(out)

Subroutine funcs(x,afunc)

x -- real(dp)

afunc -- real(dp), dimension(:)

update_running_average_and_variance subroutine

gabor 2009-06-30