Accord.Tests.Interop.Math.TSNETest.symmetrizeMatrix_1 C# (CSharp) Method

symmetrizeMatrix_1() private method

private symmetrizeMatrix_1 ( ) : void
return void
        public void symmetrizeMatrix_1()
        {
            double perplexity = 0.5;
            int n = 6;
            int k = (int)(3 * perplexity);
            uint[] row_P = Vector.Create(n + 1, new uint[] { 0, 1, 2, 3, 4, 5, 6 });
            uint[] col_P = Vector.Create(n * k, new uint[] { 5, 3, 1, 1, 2, 1 });
            double[] val_P = Vector.Create(n * k, new double[] 
            { 
                0.99901046609114708, 
                0.99901047304189827,
                0.99901046869768451,
                0.99901047304189827,	
                0.99901046869768484,
                0.99901046869768451,
            });


            uint[] expected_row = Vector.Create(100, row_P);
            uint[] expected_col = Vector.Create(100, col_P);
            double[] expected_val = Vector.Create(100, val_P);
            TSNEWrapper.symmetrizeMatrix(expected_row, expected_col, expected_val, n);

            int[] actual_row = row_P.To<int[]>();
            int[] actual_col = col_P.To<int[]>();
            double[] actual_val = (double[])val_P.Clone();
            TSNE.symmetrizeMatrix(ref actual_row, ref actual_col, ref actual_val, n);

            expected_row = expected_row.First(7);
            expected_col = expected_col.First(10);
            expected_val = expected_val.First(10);
            Assert.IsTrue(actual_col.IsEqual(expected_col));
            Assert.IsTrue(actual_row.IsEqual(expected_row));
            Assert.IsTrue(actual_val.IsEqual(expected_val));
        }