@@ -0,0 +1,2802 @@
+/*%0A * Copyright (C) 2016 Y.K. Chan%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage jacobi.core.decomp.qr;%0A%0Aimport jacobi.api.Matrix;%0Aimport jacobi.test.annotations.JacobiImport;%0Aimport jacobi.test.annotations.JacobiInject;%0Aimport jacobi.test.util.JacobiJUnit4ClassRunner;%0Aimport java.util.Arrays;%0Aimport java.util.stream.IntStream;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A/**%0A *%0A * @author Y.K. Chan%0A */%0A@JacobiImport(%22/jacobi/test/data/BasicQRTest.xlsx%22)%0A@RunWith(JacobiJUnit4ClassRunner.class)%0Apublic class BasicQRTest %7B%0A    %0A    @JacobiInject(1)%0A    public Matrix input5x5;%0A    %0A    @JacobiInject(2)%0A    public Matrix input7x7;%0A    %0A    @Test%0A    public void generateOrderings() %7B%0A        int n = 20;%0A        int m = 5;%0A        for(int i = 0; i %3C n; i++)%7B%0A           int%5B%5D array = IntStream.range(1, m).toArray();%0A           for(int k = 0; k %3C m * m ; k++)%7B%0A               int a = (int) Math.floor(Math.random() * array.length);%0A               int b = (int) Math.floor(Math.random() * array.length);%0A               int temp = array%5Ba%5D;%0A               array%5Ba%5D = array%5Bb%5D;%0A               array%5Bb%5D = temp;%0A           %7D %0A           System.out.println(Arrays.toString(array));%0A        %7D%0A        %0A    %7D%0A    %0A    @Test%0A    @JacobiImport(%22Data%22)%0A    public void test5x5() %7B%0A        QRStrategy impl = new BasicQR(this.mockStep(%0A           1, 2, 3, 4%0A        ));%0A        impl.compute(input5x5, null, true);%0A        for(int i = 1; i %3C this.input5x5.getRowCount(); i++)%7B%0A            Assert.assertEquals(0.0, this.input5x5.get(i, i - 1), 1e-16);%0A        %7D%0A    %7D%0A   %0A%0A    private QRStep mockStep(int... order) %7B%0A        return (m, p, begin, end, full) -%3E %7B%0A            for(int i = 0; i %3C order.length; i++)%7B%0A                if(order%5Bi%5D %3E begin && order%5Bi%5D %3C end)%7B %0A                    int k = order%5Bi%5D;%0A                    order%5Bi%5D = -1;%0A                    m.set(k, k - 1, 0.0);%0A                    return;%0A                %7D%0A            %7D%0A            throw new UnsupportedOperationException(%22Unable to find converge point in %22 %0A                    + Arrays.toString(order)%0A                    + %22 within %5B%22 + begin + %22,%22 + end + %22).%22);%0A        %7D;%0A    %7D%0A%7D%0A

Fix deflation