SciProgCentre / kmath

Kotlin mathematics extensions library
640 stars 55 forks source link

NDArray factories #14

Open Zelenyy opened 5 years ago

Zelenyy commented 5 years ago

Add aliases for creation NDarray: zeros, ones, linspace, logspace, repeat, eye, arange,

altavir commented 5 years ago

zero and one are by default present in NDField and are in most cases singleton values. Others should be added as extension functions for NDField. Contribution is welcome.

altavir commented 5 years ago

Current design guideline is to use structure companion for factories like Buffer.real. It is possible to implement additional factories in companions or to add them as extensions later like fun Buffer.Companion.arrange(){}. Also since it is possible to use functions in structure generators, I don't see a point in creating a lot of factories, when you can use lambda to customize it.

I will add some factory methods for matrices, because they have features which could be inferred during construction.