Esempio n. 1
0
    public void TestCholesky()
    {
        matrix C     = new matrix("4,12,-16;12,37,-43;-16,-43,98");
        matrix Achol = new matrix("2,0,0;6,1,0;-8,5,3");
        matrix B     = new CholeskyDecomposition(C).L;

        Assert.IsTrue(Achol.equals(B));
    }
Esempio n. 2
0
    public void Test_generate_C2()
    {
        int[]  perm = { 1, 0, 3, 2 };
        matrix C    = svm.generateC(perm);
        matrix Cs   = new matrix("0,1,0,0;1,0,0,0;0,0,0,1;0,0,1,0");

        Assert.IsTrue(C.equals(Cs));
    }
Esempio n. 3
0
    public void Test_transpose()
    {
        matrix T          = new matrix("1,2,3;4,5,6;7,8,9");
        matrix transposed = new matrix("1,4,7;2,5,8;3,6,9");

        Assert.IsTrue(T.transpose().equals(transposed));
        Assert.IsTrue(T.equals(T.transpose().transpose()));
    }
Esempio n. 4
0
    public void Test_generate_C()
    {
        int[]  perm = { 0, 1, 2, 3 };
        matrix C    = svm.generateC(perm);
        matrix Cs   = new matrix("1,0,0,0;0,1,0,0;0,0,1,0;0,0,0,1");

        Assert.IsTrue(C.equals(Cs));
    }