math icon indicating copy to clipboard operation
math copied to clipboard

Create Matrix/Vector from array

Open Xfel opened this issue 10 years ago • 2 comments

When reading binary files, it would be useful to be able to create Matrices and Vectors from primitive arrays. Currently, this is only possible for the MatrixN or VectorN classes, if I want an object of specific size, I need to copy it manually or create it from an N object which is additional overhead.

Xfel avatar Nov 23 '15 17:11 Xfel

Are you sure that something like. new VectorNf(array).toVector3() being slower than new Vector3f(array[0], array[1], array[2]) is a bottleneck in your program?

Also, would you mind coming to the #flow IRC channel on EsperNet to discuss this issue?

Wolf480pl avatar Nov 23 '15 18:11 Wolf480pl

Also, vecotrs and matrices are serialzable, so you could use Java's serialization if it works for you, dunno what your usecase is though.

Wolf480pl avatar Nov 23 '15 19:11 Wolf480pl