You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dealing with sparse matrix, I want to insert a column, as a new last column, so if the initial matrix was m x n, then the new matrix should be m x (n+1)
If my sparse matrix occupies the variable mat, then I am trying this as follows:
mat = (SparseMatrix)mat.insertColumn(mat.columns(), Vector.fromArray(new_column_array_data));
However, this throws an error java.lang.IndexOutOfBoundsException: Illegal row number,
Now if I perform the same operation, but 1 column back, inserting between the current 2nd last and current last column,
mat = (SparseMatrix)mat.insertColumn(mat.columns()-1, Vector.fromArray(new_column_array_data));
Then the new data is indeed inserted, however, it is not in the correct position per my requirements, I need the new column inserted as the final column.
So is this a bug or a feature?
In order to get around the above, at the moment, I am having to insert (duplicate) the current last column, at the 2nd last column, then insert my desired column, and then finally remove the last column. Requiring 3 operations.
The text was updated successfully, but these errors were encountered:
Dealing with sparse matrix, I want to insert a column, as a new last column, so if the initial matrix was
m x n
, then the new matrix should bem x (n+1)
If my sparse matrix occupies the variable
mat
, then I am trying this as follows:mat = (SparseMatrix)mat.insertColumn(mat.columns(), Vector.fromArray(new_column_array_data));
However, this throws an error
java.lang.IndexOutOfBoundsException: Illegal row number,
Now if I perform the same operation, but 1 column back, inserting between the current 2nd last and current last column,
mat = (SparseMatrix)mat.insertColumn(mat.columns()-1, Vector.fromArray(new_column_array_data));
Then the new data is indeed inserted, however, it is not in the correct position per my requirements, I need the new column inserted as the final column.
So is this a bug or a feature?
In order to get around the above, at the moment, I am having to insert (duplicate) the current last column, at the 2nd last column, then insert my desired column, and then finally remove the last column. Requiring 3 operations.
The text was updated successfully, but these errors were encountered: