vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
373 stars 107 forks source link

Matrix Resize behaving in weird way (bug\feature request) #194

Closed enoonIT closed 10 years ago

enoonIT commented 10 years ago

la4j version 0.4.9

Given a BasicVector of length 9

Matrix Update = vector.toRowMatrix();
Update = Update.resize(3, 3);

I would expect Update to contain the values of vector rearranged in a 3x3 grid, but what happens is that the first row keeps the values while the rest is set to 0.

Ideas?

vkostyukov commented 10 years ago

Hi @enoonIT,

There is nothing wrong with resize method. It works as expected. You want something that would be called reshape (or something like that) and not yet implemented in la4j. I will thing about this functionality in a further releases.

For now, I would suggest you to use simple iteration-loop in order to copy the values from vector into the matrix in a way you want.

Thanks!

enoonIT commented 10 years ago

Thanks for the clarification!