本文整理汇总了C#中Complex32.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Complex32.GetLength方法的具体用法?C# Complex32.GetLength怎么用?C# Complex32.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex32
的用法示例。
在下文中一共展示了Complex32.GetLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DenseMatrix
/// <summary>
/// Initializes a new instance of the <see cref="DenseMatrix"/> class from a 2D array. This constructor
/// will allocate a completely new memory block for storing the dense matrix.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
public DenseMatrix(Complex32[,] array)
: base(array.GetLength(0), array.GetLength(1))
{
_rowCount = array.GetLength(0);
_columnCount = array.GetLength(1);
Data = new Complex32[_rowCount * _columnCount];
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
Data[(j * _rowCount) + i] = array[i, j];
}
}
}
示例2: DiagonalMatrix
/// <summary>
/// Initializes a new instance of the <see cref="DiagonalMatrix"/> class from a 2D array.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
/// <exception cref="IndexOutOfRangeException">When <paramref name="array"/> contains an off-diagonal element.</exception>
/// <exception cref="IndexOutOfRangeException">Depending on the implementation, an <see cref="IndexOutOfRangeException"/>
/// may be thrown if one of the indices is outside the dimensions of the matrix.</exception>
public DiagonalMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
{
var rows = array.GetLength(0);
var columns = array.GetLength(1);
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < columns; j++)
{
if (i == j)
{
Data[i] = array[i, j];
}
else if (((array[i, j].Real != 0.0) && !double.IsNaN(array[i, j].Real)) || ((array[i, j].Imaginary != 0.0) && !double.IsNaN(array[i, j].Imaginary)))
{
throw new IndexOutOfRangeException("Cannot set an off-diagonal element in a diagonal matrix.");
}
}
}
}
示例3: SparseMatrix
/// <summary>
/// Initializes a new instance of the <see cref="SparseMatrix"/> class from a 2D array.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
public SparseMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
{
var rows = array.GetLength(0);
var columns = array.GetLength(1);
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < columns; j++)
{
SetValueAt(i, j, array[i, j]);
}
}
}
示例4: DenseMatrix
/// <summary>
/// Initializes a new instance of the <see cref="DenseMatrix"/> class from a 2D array. This constructor
/// will allocate a completely new memory block for storing the dense matrix.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
public DenseMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
{
for (var i = 0; i < _rowCount; i++)
{
for (var j = 0; j < _columnCount; j++)
{
_data[(j * _rowCount) + i] = array[i, j];
}
}
}
示例5: SparseMatrix
/// <summary>
/// Initializes a new instance of the <see cref="SparseMatrix"/> class from a 2D array.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
public SparseMatrix(Complex32[,] array)
: this(array.GetLength(0), array.GetLength(1))
{
for (var i = 0; i < _storage.RowCount; i++)
{
for (var j = 0; j < _storage.ColumnCount; j++)
{
_storage.At(i, j, array[i, j]);
}
}
}
示例6: DenseMatrix
/// <summary>
/// Initializes a new instance of the <see cref="DenseMatrix"/> class from a 2D array. This constructor
/// will allocate a completely new memory block for storing the dense matrix.
/// </summary>
/// <param name="array">The 2D array to create this matrix from.</param>
public DenseMatrix(Complex32[,] array)
: base(array.GetLength(0), array.GetLength(1))
{
var rows = array.GetLength(0);
var columns = array.GetLength(1);
Data = new Complex32[rows * columns];
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < columns; j++)
{
Data[(j * rows) + i] = array[i, j];
}
}
}