当前位置: 首页>>代码示例>>C#>>正文


C# GeneralMatrix.GetMatrix方法代码示例

本文整理汇总了C#中DotNetMatrix.GeneralMatrix.GetMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# GeneralMatrix.GetMatrix方法的具体用法?C# GeneralMatrix.GetMatrix怎么用?C# GeneralMatrix.GetMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetMatrix.GeneralMatrix的用法示例。


在下文中一共展示了GeneralMatrix.GetMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Negative_BadColumnIndexSetGoodRowIndexSet

        public void Negative_BadColumnIndexSetGoodRowIndexSet()
        {
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            int[] rowindexset = new int[]{1, 2};
            int[] badcolumnindexset = new int[]{1, 2, 4};

            GeneralMatrix B = new GeneralMatrix(avals);
            M = B.GetMatrix(badrowindexset, columnindexset);
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:9,代码来源:SubMatrixTests.cs

示例2: Negative_BadColumnIndexSet2

        public void Negative_BadColumnIndexSet2()
        {
            int ib = 1, ie = 2; /* index ranges for sub GeneralMatrix */
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            int[] badrowindexset = new int[]{1, 3};

            GeneralMatrix B = new GeneralMatrix(avals);

            M = B.GetMatrix(ib, ie + B.RowDimension + 1, columnindexset);
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:10,代码来源:SubMatrixTests.cs

示例3: GeneralMatrix

 public void GetSubMatrixUsingColumnIndexArrayThrowsAnIndexOutOfRangeExceptionWhenAFinalRowIndexExceedsRowDimension()
 {
     var matrix = new GeneralMatrix(avals);
     matrix.GetMatrix(ib, ie + matrix.RowDimension + 1, columnindexset);
 }
开发者ID:firestrand,项目名称:DotNetMatrix,代码行数:5,代码来源:MatrixTests.cs

示例4: GetSubMatrixUsingColumnAndRowStartStopGetsCorrectSubMatrix

 public void GetSubMatrixUsingColumnAndRowStartStopGetsCorrectSubMatrix()
 {
     var matrix = new GeneralMatrix(avals);
     var expected = new GeneralMatrix(subavals);
     var actual = matrix.GetMatrix(ib, ie, jb, je);
     Assert.AreEqual(expected,actual);
 }
开发者ID:firestrand,项目名称:DotNetMatrix,代码行数:7,代码来源:MatrixTests.cs

示例5: GetSubMatrixThrowsAnIndexOutOfRangeExceptionWhenFinalRowIndexExceedsRowDimension

 public void GetSubMatrixThrowsAnIndexOutOfRangeExceptionWhenFinalRowIndexExceedsRowDimension()
 {
     var matrix = new GeneralMatrix(avals);
     matrix.GetMatrix(ib, ie + matrix.RowDimension + 1, jb, je);
 }
开发者ID:firestrand,项目名称:DotNetMatrix,代码行数:5,代码来源:MatrixTests.cs

示例6: Negative_WrongIndecesForSubMatrix2

        public void Negative_WrongIndecesForSubMatrix2()
        {
            int ib = 1, ie = 2, jb = 1, je = 3; /* index ranges for sub GeneralMatrix */
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            GeneralMatrix B = new GeneralMatrix(avals);

            M = B.GetMatrix(ib, ie, jb, je + B.ColumnDimension + 1);
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:8,代码来源:SubMatrixTests.cs

示例7: LUDecomposition

 public void LUDecomposition()
 {
     GeneralMatrix A = new GeneralMatrix(columnwise, 4);
     int n = A.ColumnDimension;
     A = A.GetMatrix(0, n - 1, 0, n - 1);
     A.SetElement(0, 0, 0.0);
     LUDecomposition LU = A.LUD();
     Assert.IsTrue(GeneralTests.Check(A.GetMatrix(LU.Pivot, 0, n - 1), LU.L.Multiply(LU.U)));
 }
开发者ID:kriskniaz,项目名称:pCode,代码行数:9,代码来源:LinearAlgebraTests.cs

示例8: Main


//.........这里部分代码省略.........
                    tmp = B.GetElement(B.RowDimension - 1, B.ColumnDimension);
                    errorCount = try_failure(errorCount, "get(int,int)... ", "OutOfBoundsException expected but not thrown");
                }
                catch (System.IndexOutOfRangeException e1)
                {
                    try_success("get(int,int)... OutofBoundsException... ", "");
                    System.Console.Out.WriteLine(e1.Message);
                }
            }
            catch (System.ArgumentException e1)
            {
                errorCount = try_failure(errorCount, "get(int,int)... ", "OutOfBoundsException expected but not thrown");
                System.Console.Out.WriteLine(e1.Message);
            }
            try
            {
                if (B.GetElement(B.RowDimension - 1, B.ColumnDimension - 1) != avals[B.RowDimension - 1][B.ColumnDimension - 1])
                {
                    errorCount = try_failure(errorCount, "get(int,int)... ", "GeneralMatrix entry (i,j) not successfully retreived");
                }
                else
                {
                    try_success("get(int,int)... ", "");
                }
            }
            catch (System.IndexOutOfRangeException e)
            {
                errorCount = try_failure(errorCount, "get(int,int)... ", "Unexpected ArrayIndexOutOfBoundsException");
                System.Console.Out.WriteLine(e.Message);
            }
            SUB = new GeneralMatrix(subavals);
            try
            {
                M = B.GetMatrix(ib, ie + B.RowDimension + 1, jb, je);
                errorCount = try_failure(errorCount, "GetMatrix(int,int,int,int)... ", "ArrayIndexOutOfBoundsException expected but not thrown");
            }
            catch (System.IndexOutOfRangeException e)
            {
                System.Console.Out.WriteLine(e.Message);
                try
                {
                    M = B.GetMatrix(ib, ie, jb, je + B.ColumnDimension + 1);
                    errorCount = try_failure(errorCount, "GetMatrix(int,int,int,int)... ", "ArrayIndexOutOfBoundsException expected but not thrown");
                }
                catch (System.IndexOutOfRangeException e1)
                {
                    try_success("GetMatrix(int,int,int,int)... ArrayIndexOutOfBoundsException... ", "");
                    System.Console.Out.WriteLine(e1.Message);
                }
            }
            catch (System.ArgumentException e1)
            {
                errorCount = try_failure(errorCount, "GetMatrix(int,int,int,int)... ", "ArrayIndexOutOfBoundsException expected but not thrown");
                System.Console.Out.WriteLine(e1.Message);
            }
            try
            {
                M = B.GetMatrix(ib, ie, jb, je);
                try
                {
                    check(SUB, M);
                    try_success("GetMatrix(int,int,int,int)... ", "");
                }
                catch (System.SystemException e)
                {
                    errorCount = try_failure(errorCount, "GetMatrix(int,int,int,int)... ", "submatrix not successfully retreived");
开发者ID:eylvisaker,项目名称:tbsuite,代码行数:67,代码来源:TestMatrix.cs

示例9: Negative_BadRowIndexSet

        public void Negative_BadRowIndexSet()
        {
            int jb = 1, je = 3; /* index ranges for sub GeneralMatrix */
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            int[] badrowindexset = new int[]{1, 3};

            GeneralMatrix B = new GeneralMatrix(avals);
            M = B.GetMatrix(badrowindexset, jb, je);
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:9,代码来源:SubMatrixTests.cs

示例10: SubMatrixWithRowIndexSetColumnIndexSet

        public void SubMatrixWithRowIndexSetColumnIndexSet()
        {
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            double[][] subavals = {new double[]{5.0, 8.0, 11.0}, new double[]{6.0, 9.0, 12.0}};
            int[] rowindexset = new int[]{1, 2};
            int[] columnindexset = new int[]{1, 2, 3};

            GeneralMatrix B = new GeneralMatrix(avals);
            M = B.GetMatrix(rowindexset, columnindexset);
            SUB = new GeneralMatrix(subavals);

            Assert.IsTrue(GeneralTests.Check(SUB, M));
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:13,代码来源:SubMatrixTests.cs

示例11: SubMatrixWithRowIndexSet

        public void SubMatrixWithRowIndexSet()
        {
            int jb = 1, je = 3; /* index ranges for sub GeneralMatrix */
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            double[][] subavals = {new double[]{5.0, 8.0, 11.0}, new double[]{6.0, 9.0, 12.0}};
            int[] rowindexset = new int[]{1, 2};

            GeneralMatrix B = new GeneralMatrix(avals);
            M = B.GetMatrix(rowindexset, jb, je);
            SUB = new GeneralMatrix(subavals);

            Assert.IsTrue(GeneralTests.Check(SUB, M));
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:13,代码来源:SubMatrixTests.cs

示例12: SubMatrixWithColumnIndex

        public void SubMatrixWithColumnIndex()
        {
            int ib = 1, ie = 2; /* index ranges for sub GeneralMatrix */
            double[][] avals = {new double[]{1.0, 4.0, 7.0, 10.0}, new double[]{2.0, 5.0, 8.0, 11.0}, new double[]{3.0, 6.0, 9.0, 12.0}};
            double[][] subavals = {new double[]{5.0, 8.0, 11.0}, new double[]{6.0, 9.0, 12.0}};

            GeneralMatrix B = new GeneralMatrix(avals);
            M = B.GetMatrix(ib, ie, columnindexset);
            SUB = new GeneralMatrix(subavals);

            Assert.IsTrue(GeneralTests.Check(SUB, M));
        }
开发者ID:kriskniaz,项目名称:pCode,代码行数:12,代码来源:SubMatrixTests.cs

示例13: GetSubMatrixUsingColumnStartStopAndRowIdexArrayGetsCorrectSubMatrix

 public void GetSubMatrixUsingColumnStartStopAndRowIdexArrayGetsCorrectSubMatrix()
 {
     var matrix = new GeneralMatrix(avals);
     var expected = new GeneralMatrix(subavals);
     var actual = matrix.GetMatrix(rowindexset,jb,je);
     Assert.AreEqual(expected, actual);
 }
开发者ID:firestrand,项目名称:DotNetMatrix,代码行数:7,代码来源:MatrixTests.cs

示例14: decompose

        public GeneralMatrix[] decompose(int svCount, GeneralMatrix m)
        {
            SingularValueDecomposition s = new SingularValueDecomposition(m);
            try
            {
                sv = svCount;
                frameScale = m.RowDimension;

                if (m.RowDimension > m.ColumnDimension)
                {
                    frameScale = m.ColumnDimension;
                }
                else if (m.RowDimension < m.ColumnDimension)
                {
                    frameScale = m.RowDimension;
                }

                // Make square matrix of data
                if (m.RowDimension != m.ColumnDimension)
                {
                    squareM = m.GetMatrix(0, frameScale - 1, 0, frameScale - 1);
                }
                else
                {
                    squareM = m;
                }

                //perform the SVD here:
                SingularValueDecomposition svd = new SingularValueDecomposition(squareM);

                GeneralMatrix U = svd.GetU().GetMatrix(0, frameScale - 1, 0, sv - 1);
                GeneralMatrix V = svd.GetV();
                double[] D = svd.SingularValues;

                GeneralMatrix dMat = makeDiagonalSquare(D, sv);
                GeneralMatrix vMat = V.Transpose().GetMatrix(0, sv - 1, 0, frameScale - 1);

                /*Console.WriteLine(U.RowDimension + "x" + U.ColumnDimension
                        + " * " + dMat.RowDimension + "x" + dMat.ColumnDimension
                        + " * " + vMat.RowDimension + "x" + vMat.ColumnDimension);

                recomposition = U.Multiply(dMat).Multiply(vMat);

                int[,] recompositionData = new int[recomposition.ColumnDimension, recomposition.RowDimension];

                for (int i = 0; i < recomposition.ColumnDimension; i++)
                {
                    for (int j = 0; j < recomposition.RowDimension; j++)
                    {
                        recompositionData[j, i] = (int)(recomposition.GetElement(j, i));
                    }
                }*/

                GeneralMatrix[] result = new GeneralMatrix[2];
                result[0] = U;
                result[1] = vMat;
                return result;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            return null;
        }
开发者ID:Samangan,项目名称:automatic-galaxy-classification-tool,代码行数:65,代码来源:Decomposition.cs

示例15: GetSubMatrixThrowsAnIndexOutOfRangeExceptionWhenAColumnIndexInTheIndexArrayExceedsColumnDimension

 public void GetSubMatrixThrowsAnIndexOutOfRangeExceptionWhenAColumnIndexInTheIndexArrayExceedsColumnDimension()
 {
     var matrix = new GeneralMatrix(avals);
     matrix.GetMatrix(ib, ie, badcolumnindexset);
 }
开发者ID:firestrand,项目名称:DotNetMatrix,代码行数:5,代码来源:MatrixTests.cs


注:本文中的DotNetMatrix.GeneralMatrix.GetMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。