Ejemplo n.º 1
0
        static private void TestPolyMatrix()
        {
            var N    = NaturalCoordinate.ConstructInterpolationFunction(2, 2);
            var NTT  = N.Transpose().Transpose();
            var NNew = N.Integrate(0).Differentiate(0);

            for (int i = 0; i < N.Rows; i++)
            {
                for (int j = 0; j < N.Cols; j++)
                {
                    int Length = N.Data [i, j].Coefficients.Length;
                    for (int k = 0; k < Length; k++)
                    {
                        if (N.Data [i, j].Coefficients [k] != NTT.Data [i, j].Coefficients [k])
                        {
                            throw new Exception("This should be the same!");
                        }
                        if (N.Data [i, j].Coefficients [k] != NNew.Data [i, j].Coefficients [k])
                        {
                            throw new Exception("This should be the same!");
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 static private void TestNaturalCoordinates()
 {
     var N  = NaturalCoordinate.ConstructInterpolationFunction(1, 1);
     var N2 = NaturalCoordinate.ConstructInterpolationFunction(2, 2);
     var N3 = NaturalCoordinate.ConstructInterpolationFunction(3, 2);
     //Console.WriteLine ("1D Order Linear Interpolation");
     //PrintNaturalCoordinates (N);
     //Console.WriteLine ("2D Order Quadratic Interpolation");
     //PrintNaturalCoordinates (N2);
     //Console.WriteLine ("3D Order Cubic Interpolation");
     //PrintNaturalCoordinates (N3);
 }
Ejemplo n.º 3
0
        static private void TestDeterminant()
        {
            var A  = new double[4, 4];
            int id = 0;

            for (int i = 0; i < A.GetLength(0); i++)
            {
                for (int j = 0; j < A.GetLength(1); j++)
                {
                    A [i, j] = id;
                    id++;
                }
            }
            var Ans = NaturalCoordinate.Determinant(A);

            Debug.Assert(Ans == 0);
        }