# Ublas :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-04-13 16:45:14

Im sure it can, but perhaps the author assumed you knew whether or not
the matrix was singular (I tend not to assume this)

> -----Original Message-----
> From: ublas-bounces_at_[hidden]
> [mailto:ublas-bounces_at_[hidden]] On Behalf Of Manoj Rajagopalan
> Sent: Thursday, April 13, 2006 12:53 PM
> To: ublas mailing list
> Subject: Re: [ublas] Solving linear equations of the form Ax = b ?
>
> I can confirm that this code will crash on singular matrices
> :-) Can't
> ublas be modified to throw an exception or return an error value like
> INFO in the original FORTRAN version?
>
>
> Sohail Somani wrote:
> > Warning: I think the wiki says that this code will crash on
> a singular
> > matrix.
> >
> > Just fyi.
> >
> >
> >>-----Original Message-----
> >>From: ublas-bounces_at_[hidden]
> >>[mailto:ublas-bounces_at_[hidden]] On Behalf Of Manoj
> Rajagopalan
> >>Sent: Thursday, April 13, 2006 7:06 AM
> >>To: ublas mailing list
> >>Subject: Re: [ublas] Solving linear equations of the form Ax = b ?
> >>
> >>you can solve Ax=b using three lines of ublas code:
> >>
> >>permutation_matrix<> piv;
> >>lu_factorize(A, piv);
> >>lu_substitute(A, piv, x);
> >>
> >>Then x will contain the solution and A is overwritten with its LU
> >>decomposition. i.e., the original values of A and x are
> >>destroyed so the
> >>above lines are actually the inplace_solve(A, x) for a dense,
> >>generic A.
> >>
> >>BTW, I've come across this in many places - what does
> >>"boilerplate code"
> >>mean and why is it called so?
> >>
> >>cheers!
> >>Manoj
> >>
> >>
> >>
> >>John Maddock wrote:
> >>
> >>>I gather from a quick web search that ublas does have LUP
> >>
> >>decomposition
> >>
> >>>routines, however a grep of the docs failed to find any
> >>
> >>mention of the
> >>
> >>>routine in question, and how they should be used.
> >>>
> >>>So.... does anyone have the boiler plate code needed to
> >>
> >>solve for x given
> >>
> >>>matrix A and vector b ?
> >>>
> >>>Many thanks,
> >>>
> >>>
> >>>_______________________________________________
> >>>ublas mailing list
> >>>ublas_at_[hidden]

> >>
> >>_______________________________________________
> >>ublas mailing list
> >>ublas_at_[hidden]

> >>
> >
> > _______________________________________________
> > ublas mailing list
> > ublas_at_[hidden]

> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]

>