Click or drag to resize

ComplexMatrixDense Method (Int32, Int32, Complex)

Creates a dense ComplexMatrix instance having the specified size, and assigns the same value to each matrix entry.

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public static ComplexMatrix Dense(
	int numberOfRows,
	int numberOfColumns,
	Complex data
)

Parameters

numberOfRows
Type: SystemInt32
The number of matrix rows.
numberOfColumns
Type: SystemInt32
The number of matrix columns.
data
Type: System.NumericsComplex
The value assigned to each matrix entry.

Return Value

Type: ComplexMatrix
The matrix having the specified size and data.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionnumberOfRows is not positive.
-or-
numberOfColumns is not positive.
Remarks

ComplexMatrix dense instances allocate storage for each matrix entry. Sparse ComplexMatrix instances can be created by calling method Sparse(Int32, Int32, Int32).

Examples

In the following example, a dense matrix is created having all its entries equal to a given value.

Creation of a dense matrix with all entries equal to a given value
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexDenseExample4  
    {
        public void Main()
        {
            // Set matrix dimensions.
            int numberOfRows = 3;
            int numberOfColumns = 2;

            // Set the value for each entry.
            Complex data = new(1, -1);

            // Create the matrix. All entries will be equal to the
            // same value.
            var matrix = ComplexMatrix.Dense(
                numberOfRows, numberOfColumns, data);
            Console.WriteLine("Each entry is equal to the same value.");
            Console.WriteLine("The data matrix:");
            Console.WriteLine(matrix);
        }
    }
}

// Executing method Main() produces the following output:
// 
// Each entry is equal to the same value.
// The data matrix:
// (                1,               -1) (                1,               -1) 
// (                1,               -1) (                1,               -1) 
// (                1,               -1) (                1,               -1) 
// 

See Also