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
There seems to be an issue when initializing a matrix using an array. The backing grid does not contain the correct number of elements (e.g. rows*columns) in all cases.
examples: Matrix([[1.0,2.0]]) results in a grid of [1.0, 2.0, 0.0] // contains 1 extra element Matrix([[1.0,2.0,3.0]]) results in a grid of [1.0, 2.0, 3.0, 0.0, 0.0] // contains 2 extra elements Matrix([[1.0,2.0],[1.0,2.0]]) results in a grid of [1.0, 2.0, 1.0, 2.0] Matrix([[1.0,2.0, 3.0],[1.0,2.0, 3.0]]) results in a grid of [1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 0.0, 0.0] // contains 2 extra elements
The problems seems to be caused by replaceSubrange. There seems to be a problem in the calculation for the half open range: grid.replaceSubrange(i*n..<i*n+Swift.min(m, row.count), with: row)
The problem seems to be fixed by moving to a closed range using the same range calculation. grid.replaceSubrange(i*n...i*n+Swift.min(m, row.count), with: row)
The text was updated successfully, but these errors were encountered:
There seems to be an issue when initializing a matrix using an array. The backing grid does not contain the correct number of elements (e.g. rows*columns) in all cases.
examples:
Matrix([[1.0,2.0]])
results in a grid of [1.0, 2.0, 0.0] // contains 1 extra elementMatrix([[1.0,2.0,3.0]])
results in a grid of [1.0, 2.0, 3.0, 0.0, 0.0] // contains 2 extra elementsMatrix([[1.0,2.0],[1.0,2.0]])
results in a grid of [1.0, 2.0, 1.0, 2.0]Matrix([[1.0,2.0, 3.0],[1.0,2.0, 3.0]])
results in a grid of [1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 0.0, 0.0] // contains 2 extra elementsThe problems seems to be caused by replaceSubrange. There seems to be a problem in the calculation for the half open range:
grid.replaceSubrange(i*n..<i*n+Swift.min(m, row.count), with: row)
The problem seems to be fixed by moving to a closed range using the same range calculation.
grid.replaceSubrange(i*n...i*n+Swift.min(m, row.count), with: row)
The text was updated successfully, but these errors were encountered: