简体   繁体   中英

How to replace single row in Matrix using Jama ?

I trying to replace a single row using Jama .

I tried it by using setMatrix like this -

double[][] myArray = { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 },
                { 1, 1, 1, 1 } }; // all the matrix '1'
        Matrix myMatrix = new Matrix(myArray);

        myMatrix.setMatrix(2, 2, new int[] { 1, 2, 3, 4 }, new Matrix(
                new double[][] { { 3, 3, 3, 3 } })); // replace 2nd row to [3,3,3,3]
        System.out.println((Arrays.deepToString(myMatrix.getArray())));

but it throw java.lang.ArrayIndexOutOfBoundsException , how to make that correctly ?

我设法-它只是从索引0开始-更改为{0,1,2,3}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM