mikera / vectorz-clj

Fast matrix and vector maths library for Clojure - as a core.matrix implementation
202 stars 19 forks source link

set-column throws IndexOutOfBoundsException if index = column-count #63

Closed schaueho closed 7 years ago

schaueho commented 7 years ago

In vectorz-clj 0.45.0, trying to set a column in column n for an array of size m*n throws an IndexOutOfBoundsException. Sample code:

user> (matrix/set-current-implementation :vectorz)
:vectorz
user> (-> (matrix/new-array [2 3])
          (matrix/set-column 2 [3 4]))
IndexOutOfBoundsException Matrix with shape [2,3] does not have slice: 2 on dimension 0  mikera.matrixx.impl.ARectangularMatrix.checkRow (ARectangularMatrix.java:93)

The exact same code works as expected with clatrix:

user> (-> (matrix/new-array [2 3])
          (matrix/set-column 2 [3 4]))
 A 2x3 matrix
 -------------
 0,00e+00  0,00e+00  3,00e+00 
 0,00e+00  0,00e+00  4,00e+00 

Setting a column also works without problems for positions 0<n.

mikera commented 7 years ago

Confirmed this is a bug. Will create a new release with a fix today.

mikera commented 7 years ago

Fixed in 0.46.0

schaueho commented 7 years ago

Works now, thanks.