[
https://issues.apache.org/jira/browse/MATH-1249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624576#comment-14624576
]
Gilles commented on MATH-1249:
------------------------------
bq. \[...\] aftre recompiling without the FINAL keyword for
BlockRealMatrix.BLOCK_SIZE) \[...\]
So, *you* introduced the bug...
"final" is there for a good reason: it _cannot_ be changed after construction!
Discussion and questions about usage or design should go through the project's
MLs:
http://commons.apache.org/proper/commons-math/mail-lists.html
> 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)