Re: [Haskell-cafe] BLAS Solve Example

2008-07-23 Thread Dan Weston
A jedi master might stick with the existing double precision solver, then convert the results to best rational approximation [1], then do a forward solve on the rational versions of matrices, adjusting numerator and denominator to eliminate the residual error (with a heuristic to favor common f

Re: [Haskell-cafe] BLAS Solve Example

2008-07-23 Thread Darrin Thompson
On Wed, Jul 23, 2008 at 2:12 AM, Alberto Ruiz <[EMAIL PROTECTED]> wrote: > $ ghci solve.hs > *Main> sol > 3 |> [-5.511e-2,0.3,0.2776] > I was hoping for rational solutions. If I were a true jedi master I'd write my own solver, which might be the right thing

Re: [Haskell-cafe] BLAS Solve Example

2008-07-22 Thread Alberto Ruiz
Darrin Thompson wrote: I'm stuck on something that I thought would be easy. I have a matrix and a vector. module Main where import Data.Vector.Dense import Data.Matrix.Dense import BLAS.Matrix.Solve m = listMatrix (2, 3) ([1, 2, 3, 4, 5, 6]::[Double]) v = listVector 2 ([1, 2]::[Double]) main

Re: [Haskell-cafe] BLAS Solve Example

2008-07-22 Thread Patrick Perry
Sorry Darrin, the BLAS library only includes matrix multiplication and solving triangular systems. To solve a general system, you would need to use LAPACK, but there aren't any bindings for that library yet. I would suggest you take a look at the hmatrix package, which includes a lot more

[Haskell-cafe] BLAS Solve Example

2008-07-22 Thread Darrin Thompson
I'm stuck on something that I thought would be easy. I have a matrix and a vector. > module Main where > import Data.Vector.Dense > import Data.Matrix.Dense > import BLAS.Matrix.Solve > > m = listMatrix (2, 3) ([1, 2, 3, 4, 5, 6]::[Double]) > v = listVector 2 ([1, 2]::[Double]) > > main = do ???