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


C# MatrixValue.Transpose方法代碼示例

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


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

示例1: Function

        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 3 && M.DimensionY != 3)
                throw new YAMPMatrixDimensionException(3, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 3;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(3, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var r = M[1, i].Re;
                var theta = M[2, i].Re;
                var phi = M[3, i].Re;
                var rt = r * Math.Sin(theta);
                m[1, i] = new ScalarValue(rt * Math.Cos(phi));
                m[2, i] = new ScalarValue(rt * Math.Sin(phi));
                m[3, i] = new ScalarValue(r * Math.Cos(theta));
            }

            return isTransposed ? m.Transpose() : m;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:27,代碼來源:Sph2CartFunction.cs

示例2: Function

        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 2 && M.DimensionY != 2)
                throw new YAMPMatrixDimensionException(2, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 2;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(2, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var x = M[1, i].Re;
                var y = M[2, i].Re;
                var phi = Math.Atan2(y, x);
                var r = x == 0.0 ? y : (y == 0.0 ? x : x / Math.Cos(phi));
                m[1, i] = new ScalarValue(r * Math.Cos(phi));
                m[2, i] = new ScalarValue(r * Math.Sin(phi));
            }

            return isTransposed ? m.Transpose() : m;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:26,代碼來源:Cart2PolFunction.cs

示例3: Function

        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 3 && M.DimensionY != 3)
                throw new YAMPMatrixDimensionException(3, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 3;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(3, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var x = M[1, i].Re;
                var y = M[2, i].Re;
                var z = M[3, i].Re;
                var r = Math.Sqrt(x * x + y * y + z * z);
                var phi = Math.Atan2(y, x);
                var theta = Math.Acos(z / r);
                m[1, i] = new ScalarValue(r);
                m[2, i] = new ScalarValue(theta);
                m[3, i] = new ScalarValue(phi);
            }

            return isTransposed ? m.Transpose() : m;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:29,代碼來源:Cart2SphFunction.cs

示例4: Function

        public MatrixValue Function(MatrixValue M)
        {
            var transpose = false;

            if (M.DimensionX > M.DimensionY)
            {
                transpose = true;
                M = M.Transpose();
            }

            var fft = new Fourier(M.DimensionY);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var values = new ScalarValue[M.DimensionY];

                for (var j = 1; j <= M.DimensionY; j++)
                {
                    values[j - 1] = M[j, i];
                }

                values = fft.Transform(values);

                for (var j = 1; j <= M.DimensionY; j++)
                {
                    M[j, i] = values[j - 1];
                }
            }

            if (transpose)
            {
                return M.Transpose();
            }

            return M;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:36,代碼來源:FFTFunction.cs


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