[Haskell-cafe] Re: [Haskell] ANNOUNCE: An index-aware linear
algebra library in Haskell
Alberto Ruiz
aruiz at um.es
Sat Apr 15 12:14:44 EDT 2006
On Friday 14 April 2006 17:02, Frederik Eaton wrote:
> An index-aware linear algebra library in Haskell
Excellent work!
Is it possible to create a vector or matrix whose size is not known at compile
time?
> - Due to the need to specify index types at some point, input of
> vectors is difficult. I have provided two functions in Fu.Vector.Base
> which should cover most of the cases:
>
> listVec :: Vector v e => [e] -> (forall n . (ReflectNum n) => v (L n) -> w)
> -> w
> listMat :: Vector v e => [[e]] ->
> (forall n m . (ReflectNum n, ReflectNum m) => v (L m, L n) -> w) -> w
>
> However, these aren't useful in interactive situations. So I have also
> provided some template-haskell routines
>
> http://ofb.net/~frederik/futility/src/Vector/Template.hs
>
> which can be used to instantiate vectors directly. For example:
(In examples.hs):
>-- matrix with elements of type Double
>v6 = trans $(dAM [[1,2,3,4]])
>
>v7 = $(dAM [[1,0,0],[0,1,0],[0,0,1],[1,1,1]])
--
Alberto
More information about the Haskell-Cafe
mailing list