Closed TheFausap closed 6 years ago
Hello!
Well, there is no need to expand it -- it will work with whatever data type you want. See, Spartns is a representation library, it does not do operations. I really wanted to include linear algebra/tensor operations, but I never had time to work on that.
Now -- when you create a structure with defspartn
, one of the parameters is :element-type
. This is used to optimize the code for that type, so if you use Common Lisp's native complex type, then Spartns will generate code optimized for that (so it would make sense to pick a CL implementation that does fast math on complexes). You may also take a look at the "Performance" section in the manual.
The goals when I wrote Spartns were (i) to have a flexible representation library -- so flexible that I realized it could actually be interesting also for other stuff, including non-numerical data; (ii) to have fast methods to operate on tensors (look for fast traversals in the manual); and (iii) to support sparse tensors (and sparse indexed structures in general).
And although Spartns makes no assumption as to what the data type is (so it may represent usual tensors as in Math, Physics and Engineering, but also multi-dimensional indexed structures of characters, strings, of arbitrary objects), it will generate optimized code for CL native types -- I don't think it would be much faster if I wrote code for traversing tensors with FLOAT
, DOUBLE-FLOAT
, COMPLEX
, or other types manually.
See -- using fast traversals, it may be really easy to write code that does operate on a number of tensors.
Anyway -- if there is anything hat you feel would be nice to add to the documentation, please tell me (is the manual clear enough on element types, for example?) If not, then we may close this issue.
Please don' hesitate to ask for more help!
-- J.
Hello! thanks for the clarification. The documentation seems ok. I'll start to code a kronecker product of two matrices, just to some simple (??) algebra :-)
Fausto
Hello,
is it possible to extend spartns to complex matrices ?
thanks, Fausto