Open enoonIT opened 10 years ago
I've moved this ticket to 0.6.0 release. We should think how to handle this functionality.
So vectors can already be inserted into matrices? I'm just gonna implement adding matricies inside other matricies.
Ok so I'm thinking something like System.arrayCopy()
with a bunch of overridable methods.
Wait. You can't insert matrix into vector. We have to provide methods that insert matrix into matrix. Something like this:
interface Matrix {
Matrix insert(Matrix that, int left, int right);
}
Insert matrix into matrix, that was a typo. Right now I have telescoping methods ending in this (inside the Matrix
interface:
Matrix insert(Matrix matrix, int sx, int sy, int dx, int dy, int width, int height);
You can use the naming convention from slice
method: https://github.com/vkostyukov/la4j/blob/master/src/main/java/org/la4j/matrix/Matrix.java#L705. AI would suggest having this signature:
Matrix insert(Matrix that, int i, int j) { return insert(that, i, j, that.rows(), that.columns()); }
Matrix insert(Matrix that, int i, int j, int width, int height);
Wait, slice
names don't fit well here. Use i
, j
, width
, height
.
But there's both source and destination positions. What about sourceX
, destX
and numRows
or something?
Right. How about sourceRow
, sourceColumn
, destRow
, destColumn
, width
, height
?
width
/height
sorta break row
/column
don't they? And also (related) why are rows
and columns
fields in AbstractMatrix
? They have methods too...? Can I kill the fields (or move them down to subclasses) and just use the methods?
Let's move the conversation to #222.
Inserting vectors into vectors.
One extremely useful thing that can be done in Matlab is to insert a matrix inside of another one: A(2:4,1:3) = B;
I've found a way to insert Vectors intro Matrices but I've failed to see a way to insert a Matrix in a Matrix in la4j (other than hand iterating the values) - how should this case be handled?