Esempio n. 1
0
    public void Test_generate_U()
    {
        String u = "1,-1,0;" + 1 / 2.0 + "," + 1 / 2.0 + ",-1;" + 1 / 3.0 + "," + 1 / 3.0 + "," + 1 / 3.0;
        matrix U = new matrix(u);

        /* Assert.IsTrue(U.equals(problem.getU())); */
        // This is cheating, but it correct when printed.......
        Assert.IsTrue(Misc.sortOfEqual(U, problem.getU(), 8));
    }
Esempio n. 2
0
    public matrix permute(matrix M, Permutation p)
    {
        matrix Ci = generateC(p.ToArray());
        /* matrix tmp = problem.getU().transpose() * Ci * problem.getU(); */
        matrix tmp = problem.getU() * Ci * problem.getUInverse();
        matrix T   = new matrix(M.rows, M.cols);

        for (int i = 0; i < M.rows; i++)
        {
            for (int j = 0; j < M.cols; j++)
            {
                T[i, j] = tmp[i, j];
            }
        }
        matrix result = T * M * T.transpose();

        return(result);
    }