Vector Calculations in LISP
Asked Answered
M

4

5

How can I perform vector calculations in lisp, such as magnitude of a vector, norm of a vector, distance (between two points), dot product, cross product, etc.

Thanks.

Metallo answered 26/5, 2010 at 12:4 Comment(0)
S
4

There are several libraries of bindings to Fortran linear algebra packages like LAPACK and BLAS, such as LLA, the Lisp Linear Algebra library.

Salvo answered 26/5, 2010 at 12:14 Comment(0)
O
3

Take a look at GSLL (which includes an interface to BLAS), and the underlying grid system. On the other hand, I agree with the above comment in that if the things you mention are all you need, then it's probably faster/easier to write your own.

Opalopalesce answered 26/5, 2010 at 20:32 Comment(0)
C
1

I think that Tamas Papp's LLA library might have what you want. He recently announced that he plans a rewrite.

Coe answered 26/5, 2010 at 12:15 Comment(0)
C
1

All this stuff is incredibly straight-forward maths. Calculate it the way you would normally.

Council answered 26/5, 2010 at 12:15 Comment(4)
@Charles So what is the more performant way of doing a dot product? Because that's simple multiplying two numbers together. And cross product is only slightly more complicated than that. And magnitude of a vector, well, again it's a very trivial operation. Exactly what speed benefits are you implying the existence of?Council
What's the order of an N-dimensional cross-product? It's more than "Slightly more complicated". Applications of linear algebra tend to be of large dimension.Salvo
the more performant way of doing a dot product is the one that compiles down to the most efficient code. Even though the same mathematical operations are being performed, two implementations of a dot product can easily differ by an order of magnitude or more in execution time.Actuality
@Charles: Fair enough, @Stephen: That's an incredibly useless comment.Council

© 2022 - 2024 — McMap. All rights reserved.