-
Hi everyone, I'm just making a real small example to try and understand how your object Matrix works. I came across something weird... Here's my example:
I don't know how but the output is wrong...
Actually I do know.. I investigated a little more your implementation and if I got it right you are transforming this matrix into a StorageFormat, an array. But when trying to find out the position of each number the math seems wrong. Here is your method (I'm just copying and pasting it here):
Checking this method on class StoreFormat:
So when I'm trying to set line 0 column 2 the position in thos StorageFormat is 0 * 2+2 = 2 and when I'm trying to set line 1 column 0 1 * 2 + 0 = 2. Same index... If I'm seeing this the wrong way can you explain how Matrix work. How should I initialize it? And how to set values please? Thank you in advance, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
It seems there is a bug in Tornado related to the compiler replacement
phase for the matrix API. We will analyze this case. Which backend are you
using?
Juan
…On Sat, 29 Oct 2022, 17:29 MLobatoR, ***@***.***> wrote:
Hi everyone,
I'm just making a real small example to try and understand how your object
Matrix works. I came across something weird...
Here's my example:
Matrix2DInt matrix = new Matrix2DInt(3, 2);
matrix.set(0, 0, 1);
matrix.set(0, 1, 2);
matrix.set(0, 2, 3);
matrix.set(1, 0, 4);
matrix.set(1, 1, 5);
matrix.set(1, 2, 6);
System.out.println(matrix.toString());
I don't know how but the output is wrong...
MatrixInt <2 x 3>
1 2 4
4 5 6
Actually I do know.. I investigated a little more your implementation and
if I got it right you are transforming this matrix into a StorageFormat, an
array. But when trying to find out the position of each number the math
seems wrong. Here is your method (I'm just copying and pasting it here):
public void set(int i, int j, int value) {
storage[StorageFormats.toRowMajor(i, j, M)] = value;
}
Checking this method on class StoreFormat:
public static int toRowMajor(int i, int j, int yMax) {
return (i * yMax) + j;
}
So when I'm trying to set line 0 column 2 the position in thos
StorageFormat is 0 * 2+2 = 2 and when I'm trying to set line 1 column 0 1 *
2 + 0 = 2. Same index...
If I'm seeing this the wrong way can you explain how Matrix work. How
should I initialize it? And how to set values please?
Thank you in advance,
ML
—
Reply to this email directly, view it on GitHub
<#213>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKX2BPYZBXGTEHJ5SZBBU3WFU7FBANCNFSM6AAAAAARR2XSSQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
This has been solved. This message is just to mark the solution. |
Beta Was this translation helpful? Give feedback.
This has been solved. This message is just to mark the solution.