meow00
asked on
Matrix and FieldElement in JLinAlg ......
Hi Experts,
This is a follow up question of
https://www.experts-exchange.com/questions/20988833/Matrix-2D-array-of-FieldElement-in-JLinAlg.html
-------------------------
now I got
DoubleWrapper[][] D = new DoubleWrapper[5][5] ;
FieldElement[][] F = new FieldElement[5][5] ;
but I couldn't assign values to the arrays : eg.
D[1][1] = 1 ;
D[2][2] = 2 ;
kept giving me errors as the follows:
--------------------------
found : int
required: JLinAlg.DoubleWrapper
D[1][1] = 1 ;
^
Main.java [31:1] incompatible types
found : int
required: JLinAlg.DoubleWrapper
D[2][2] = 2 ;
^
2 errors
Errors compiling Main.
--------------------------
Could anyone please give me some helps ? how do I assign values to the arrays ??? many thanks !!!
meow.....
ASKER
Hi Experts,
I try to store a double value, so I use :
D[1][1] =DoubleWrapper(1.0) ;
D[2][2] =DoubleWrapper(2.0) ;
But I still got the following errors:
Main.java [30:1] cannot resolve symbol
symbol : method DoubleWrapper (double)
location: class Main
D[1][1] =DoubleWrapper(1.0) ;
^
Main.java [31:1] cannot resolve symbol
symbol : method DoubleWrapper (double)
location: class Main
D[2][2] =DoubleWrapper(2.0) ;
^
2 errors
Errors compiling Main.
-------------------------- ----------
And this is how DoubleWrapper is used in the documents :
public class DoubleWrapper
extends FieldElement
This class wraps a double value and performs all FieldElement operations on that double. Fast but not without rounding errors.
Constructor Summary :
DoubleWrapper(double value)
Builds an element from a double-precision floating-point value.
-------------------------- ---------- ---
Could anyone please tell me what I have missed ??? Thanks a lot !!!
meow...
I try to store a double value, so I use :
D[1][1] =DoubleWrapper(1.0) ;
D[2][2] =DoubleWrapper(2.0) ;
But I still got the following errors:
Main.java [30:1] cannot resolve symbol
symbol : method DoubleWrapper (double)
location: class Main
D[1][1] =DoubleWrapper(1.0) ;
^
Main.java [31:1] cannot resolve symbol
symbol : method DoubleWrapper (double)
location: class Main
D[2][2] =DoubleWrapper(2.0) ;
^
2 errors
Errors compiling Main.
--------------------------
And this is how DoubleWrapper is used in the documents :
public class DoubleWrapper
extends FieldElement
This class wraps a double value and performs all FieldElement operations on that double. Fast but not without rounding errors.
Constructor Summary :
DoubleWrapper(double value)
Builds an element from a double-precision floating-point value.
--------------------------
Could anyone please tell me what I have missed ??? Thanks a lot !!!
meow...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
eg.
FieldElement f = .....
F[0][0] = f;
If you want to store int's then you need to use an int array:
int[][] intarray = new int[5][5];
intarray[0][0] = 1;