alberto trivellato created MATH-1249:
----------------------------------------
Summary: BlockRealMatrix BLOCK_SIZE value change
Key: MATH-1249
URL: https://issues.apache.org/jira/browse/MATH-1249
Project: Commons Math
Issue Type: Bug
Reporter: alberto trivellato
Priority: Minor
Changing the value of the filed BlockRealMatrix.BLOCK_SIZE takes to a
java.lang.ArrayIndexOutOfBoundsException in the method multiply(); The
thest is the following (aftre recompiling without the FINAL keyword for
BlockRealMatrix.BLOCK_SIZE):
public void testBlockRealMatrix() throws Exception{
logger.debug("testBlockRealMatrix");
long seed = 12345L;
Random random = new Random(seed);
int rows = 100;
int cols = 100;
double[][] data = new double[rows][cols];
for(int i=0; i<rows; i++){
for(int j=0; j<cols; j++){
data[i][j] = random.nextDouble();
}
}
BlockRealMatrix m1 = new BlockRealMatrix(data);
BlockRealMatrix m2 = new BlockRealMatrix(data);
BlockRealMatrix.BLOCK_SIZE = 52;
long t0 = System.currentTimeMillis();
m2.multiply(m1);
logger.debug("time : " + (System.currentTimeMillis() - t0));
BlockRealMatrix.BLOCK_SIZE = 26;
t0 = System.currentTimeMillis();
m2.multiply(m1);
logger.debug("time : " + (System.currentTimeMillis() - t0));
BlockRealMatrix.BLOCK_SIZE = 104;
t0 = System.currentTimeMillis();
m2.multiply(m1);
logger.debug("time : " + (System.currentTimeMillis() - t0));
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)