本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}