Linear system solver in D?

Guillaume B. guillaume.b.spam at sympatico.ca
Wed Feb 20 15:55:00 PST 2008


Bill Baxter wrote:

> BCS wrote:
>> Reply to Guillaume B.,
>> 
>>> lp_solve is nice too: http://lpsolve.sourceforge.net/5.5/ ... and it
>>> can read many file formats...
>>>
>>> Guillaume
>>>
>> 
>> how is it's API? What I'll have is an array of real's in memeory.
>> 
>> Hmm that's a though, does anyone know if any of the listed libs work
>> with 80bit FP?
>> 
>> 
> 
> Guiallumes link looks to be for integer programming, not floating point
> calcs.  LAPACK or something that wraps it is what you want.
> 
> I highly recommend you look at the BLASLAPACK dir of
> dsource/projects/multiarray.  The LAPACK wrappers have been tested on
> both Windows and Ubuntu.  I have instructions in both dirs for how to
> install in either case, and there's a simple test program there that
> does a linear solve on a small matrix.
> 
>
http://www.dsource.org/projects/multiarray/browser/trunk/multiarray/BLASLAPACK/lapacktest.d
> 
> The blas and lapack are separate from the rest of multiarray, so you can
> just check out that BLASLAPACK dir and be good to go.
> 
> --bb

 It actually supports floating points number... And if your C compiler
supports 80 bits floating point, you can probably compile it to support it
since the functions are like this:

unsigned char add_constraint(lprec *lp, REAL *row, int constr_type, REAL
rh);

 Although by default, REAL is probably a typedef for double.

 And lp_solve is actually a solver for Linear Programs... It's an optimizer,
not a simple solver for a system of linear equations... It's to solve
things like this:

maximize 143x + 60y
where
120x + 210y <= 15000
110x + 30y <= 4000
x + y <= 75
x >= 0
y >= 0

 So it might not be exactly what you want... You can see an example problem
(the explanations are very good) with an example of the C API there:
http://lpsolve.sourceforge.net/5.5/formulate.htm

 Hope this helps!

 Guillaume



More information about the Digitalmars-d-learn mailing list