當前位置: 首頁>>代碼示例>>C#>>正文


C# Matrix.ShouldNotBeNull方法代碼示例

本文整理匯總了C#中System.Matrix.ShouldNotBeNull方法的典型用法代碼示例。如果您正苦於以下問題:C# Matrix.ShouldNotBeNull方法的具體用法?C# Matrix.ShouldNotBeNull怎麽用?C# Matrix.ShouldNotBeNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Matrix的用法示例。


在下文中一共展示了Matrix.ShouldNotBeNull方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetMatrix

        /// <summary>
        /// <paramref name="m"/> matrix 의 요소값을 <paramref name="s"/>의 요소로 설정합니다.
        /// </summary>
        /// <param name="m"></param>
        /// <param name="s"></param>
        /// <param name="rows"></param>
        /// <param name="c0"></param>
        /// <param name="c1"></param>
        public static void SetMatrix(this Matrix m, Matrix s, int[] rows, int c0, int c1) {
            m.ShouldNotBeNull("m");
            s.ShouldNotBeNull("s");
            rows.ShouldNotBeNull("rows");
            Guard.Assert(c1 > c0, "c1 should be greater than c0, c0=[{0}], c1=[{1}]", c0, c1);

            var cols = new int[c1 - c0 + 1];
            for(var c = 0; c < cols.Length; c++)
                cols[c] = c0 + c;

            SetMatrix(m, s, rows, cols);
        }
開發者ID:debop,項目名稱:NFramework,代碼行數:20,代碼來源:MatrixTool.cs

示例2: IsSameDimension

        /// <summary>
        /// 두개의 <see cref="Matrix"/>가 같은 차원인지 검사합니다.
        /// </summary>
        /// <param name="m1"></param>
        /// <param name="m2"></param>
        /// <returns></returns>
        public static bool IsSameDimension(this Matrix m1, Matrix m2) {
            m1.ShouldNotBeNull("m1");
            m2.ShouldNotBeNull("m2");

            return IsSameDimension(m1.Data, m2.Data);
        }
開發者ID:debop,項目名稱:NFramework,代碼行數:12,代碼來源:MatrixTool.cs

示例3: Divide

        /// <summary>
        /// result = a  / s 
        /// </summary>
        /// <param name="result"></param>
        /// <param name="a"></param>
        /// <param name="s"></param>
        public static void Divide(this Matrix result, Matrix a, double s) {
            result.ShouldNotBeNull("result");
            a.ShouldNotBeNull("a");
            Guard.Assert<DivideByZeroException>(s != 0.0, @"s is zero.");
            CheckSameDimension(result, a);

            for(var r = 0; r < a.Rows; r++)
                for(var c = 0; c < a.Cols; c++)
                    result[r, c] = a[r, c] / s;
        }
開發者ID:debop,項目名稱:NFramework,代碼行數:16,代碼來源:MatrixTool.cs

示例4: Multiply

        /// <summary>
        /// result = a * s
        /// </summary>
        /// <param name="result"></param>
        /// <param name="a"></param>
        /// <param name="s"></param>
        public static void Multiply(this Matrix result, Matrix a, double s) {
            result.ShouldNotBeNull("result");
            a.ShouldNotBeNull("a");
            CheckSameDimension(result, a);

            for(var r = 0; r < a.Rows; r++)
                for(var c = 0; c < a.Cols; c++)
                    result[r, c] = a[r, c] * s;
        }
開發者ID:debop,項目名稱:NFramework,代碼行數:15,代碼來源:MatrixTool.cs

示例5: Subtract

        /// <summary>
        /// result = a  b
        /// </summary>
        /// <param name="result"></param>
        /// <param name="a"></param>
        /// <param name="b"></param>
        public static void Subtract(this Matrix result, Matrix a, Matrix b) {
            result.ShouldNotBeNull("result");
            a.ShouldNotBeNull("a");
            b.ShouldNotBeNull("b");
            CheckSameDimension(a, b);
            CheckSameDimension(a, result);

            for(var r = 0; r < a.Rows; r++)
                for(var c = 0; c < a.Cols; c++)
                    result[r, c] = a[r, c] - b[r, c];
        }
開發者ID:debop,項目名稱:NFramework,代碼行數:17,代碼來源:MatrixTool.cs


注:本文中的System.Matrix.ShouldNotBeNull方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。