147pm
147pm

Reputation: 2239

Haskell Vector: not scientific, engineering vectors?

When I see Haskell's Vector, that's not a physics, linear algebra vector, is it? Vectors in Java (as I recall) is an array one can dynamically add to. But that's not usable as a science vector, is it? How could I have a science vector data structure in Haskell?

Upvotes: 0

Views: 286

Answers (3)

Lemming
Lemming

Reputation: 597

You might want to try newer interfaces to BLAS/LAPACK: https://hackage.haskell.org/package/comfort-blas, https://hackage.haskell.org/package/lapack.

Upvotes: 0

Lemming
Lemming

Reputation: 1

I guess you want hmatrix, a Haskell interface to LAPACK and BLAS.

Upvotes: 0

MasterMastic
MasterMastic

Reputation: 21286

I assume you are referring to Data.Vector, and yes, you're right. It's not the vector the mathematical parts of us know. For a "legit" vector and any other linear algebra on free vector spaces there is the linear package.

Data.Vector is pretty much a memory array (very optimized, very good API).


Data.Vector really is a misleading name, and I assume it's directly or indirectly inspired from C++'s standard library vector class template which is also misleading.

From here, in C++'s standard library...

It's called a vector because Alex Stepanov, the designer of the Standard Template Library, was looking for a name to distinguish it from built-in arrays. He admits now that he made a mistake, because mathematics already uses the term 'vector' for a fixed-length sequence of numbers.
...
Alex's lesson: be very careful every time you name something.

Upvotes: 1

Related Questions