Tensors
I'm have not really looked in to the library yet.
But I was wondering what it would take to extend it to N-way tensors. If I find the time I would be happy to look into that.
Aren't tensors just N-dimensional arrays the same way like matrices are 2-Dimensional arrays? If this is all you need, than core.matrix already supports multi dimensional arrays out of the box. (implementations might only support 2-dimensional matrices, but take a look at NDArray for example)
Yes. This is correct. I had to be more precise.
I was thinking about extending it to tensor products, tensor-vector products, decompositions etc..
For whatever it's worth, I don't have a current use case for tensor products, etc., but I think this seems like something that could be generally very useful.
Good idea!
I think some of this should already be complete, but it probably hasn't had enough testing / use case exploration. Some quick thoughts:
- Operations like
inner-productshould already work on n-dimensional arrays - All elementwise operations (add, sub, emap etc.) should already work
- Some implementations (inc vectorz-clj) have reasonable support for 3+ array dimensions. Others only natively support 2D arrays, so 3+ dimensions will require wrapping. Fortunately this is quite easy (you can wrap 2D matrices in a Clojure vector to get something that behaves like a 3D array, for example...)
- We haven't really looked at tensor decompositions and tensor-specific operations etc. This could definitely use some development!
@mars0i
I have to use tensors (and all the corresponding algebra) for my master thesis :) . Usage of tensors in data science and engineering (my discipline) is quite new but I assure you it will become very important! ;)
@tgoossens absolutely agree!
If you are able to do some core.matrix development with real use cases that would be fantastic - always best to have a real project in mind....
@mikera
I will have to study tensor algebra in quite some detail for my master thesis. And one of my professors is an expert in it. His work: http://www.tensorlab.net/
If I find the time I will gladly discuss and investigate the possibilities further!
I had heard that tensor algebra was common in some parts of physics, but I became aware of because it's been used in evolutionary developmental biology (see chapter 8 of Sean Rice's Evolutionary Theory).
@tgoossens thanks - Tensorlab looks very interesting. I'd certainly love to see some similar tensor support in core.matrix or a related library in the Clojure ecosystem!