Re: solving linear equations with LAPACK/Matlab



wakun@xxxxxxxxx wrote:
> Hi there,
> I am solving linear equations with Matlab and now I need to use C++
> instead. The size of the matrix is about 200x200 and is invertible.
> In matlab, I solve the problem as follow
>
> %Ax = b the system
> x=inv(A)*b
>
> (BTW, is it a right way to solve the system in matlab? Any better
> routine for that problem?)

Never invert. Use A\b instead.

> Anyway, for some reason, my tutor ask me to solve the same problem in
> C++. So I am going to solve it with the help of LAPACK and the C++
> wrapper (LAPACK++). However, I am very new to LAPACK and the
> documentation seems not very friendly to user. I guess I should find
> the routine to calculate the inverse of the matrix first and multiply
> the inverse matrix with the vector on RHS (b). Would you please tell
> me if I am doing right, any function in LAPACK for solving such
> system directly ? Any example for solving tridiagonal system,
> five-diagonal system and seven-diagonal system ?
>
> Thanks in advance.


.



Relevant Pages

  • Re: Finite element anaysis of Navier Stokes equation
    ... I'm finishing my dissertation on "Dispersion of Toxic Gases in Cities", in more detail I wrote a kind of CFD code for solving the NS and the advection-diffusion equations. ... I employed some of the powerful numerical solvers of MatLAB for testing. ... I wrote a code for solving Stokes equation, which is actually a simplification of the NS equations. ...
    (comp.soft-sys.matlab)
  • Re: solving linear equations with LAPACK/Matlab
    ... > I am solving linear equations with Matlab and now I need to use C++ ... I am very new to LAPACK and the ... >the inverse matrix with the vector on RHS. ...
    (sci.math.num-analysis)
  • Re: How to choose a numerical method?
    ... i am solving a "duffing-like" 2nd order nonlinear diff. ... equation (in Matlab) ... You might consider calculating conserved entities. ... al. Geometric Numerical Integration: Structure-preserving Algorithms ...
    (sci.math.num-analysis)
  • solving linear equations with LAPACK/Matlab
    ... I am solving linear equations with Matlab and now I need to use C++ ... I am very new to LAPACK and the ... the inverse matrix with the vector on RHS. ...
    (sci.math.num-analysis)
  • Re: Confused with QR decomposition and LAPACK
    ... and that the problem is with your lapack code. ... Second, you don't give any indications about what matlab produces, ... R matrices directly but can be calculated from the Output matrix. ...
    (comp.soft-sys.matlab)