Click or drag to resize

ComplexMatrixRowItem Property (Int32)

Gets or sets the entry of the ComplexMatrixRow having the specified column index.

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public Complex this[
	int columnIndex
] { get; set; }

Parameters

columnIndex
Type: SystemInt32

Property Value

Type: Complex
The row entry corresponding to the specified column index.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptioncolumnIndex is not a valid column index for the matrix from which this row has been collected.
Remarks

A ComplexMatrixRow instance represents a row of a ComplexMatrix. More thoroughly, since each ComplexMatrixRow is an item in a ComplexMatrixRowCollection, such matrix can be inspected by getting the Matrix property of the given collection.

If setting, the ItemInt32 indexer fires the PropertyChanged event notifying that the name of the changed property is "[" + j + ]", where j is a string representation of columnIndex, and the new value becomes the entry of Matrix having row and column indexes given by Index and columnIndex, respectively.

If columnIndex equals any value returned by XDataColumn, YDataColumn, or ZDataColumn, then the PropertyChanged event is also fired to notify that properties XData, YData, or ZData have changed values, respectively.

Examples

In the following example, all rows in a matrix are collected, and the indexer is applied to set specific row entries.

C#
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexRowIndexerExample0  
    {
        public void Main()
        {
            // Create a matrix.
            var data = new Complex[8] {
                new Complex(1, -1), new Complex(5, -5),
                new Complex(2, -2), new Complex(6, -6),
                new Complex(3, -3), new Complex(7, -7),
                new Complex(4, -4), new Complex(8, -8)
            };
            var matrix = ComplexMatrix.Dense(4, 2, data, StorageOrder.RowMajor);
            Console.WriteLine("Data matrix:");
            Console.WriteLine(matrix);
            Console.WriteLine();

            // Get the collection of matrix rows.
            var rows = matrix.AsRowCollection();

            // Set a column index.
            var columnIndex = 1;

            // Set the row entries corresponding to the specified column index:
            // this code updates the data matrix, too.
            foreach (var row in rows)
            {
                row[columnIndex] = new Complex(row.Index * 100.0, 0);
            }

            Console.WriteLine("Updated data matrix:");
            Console.WriteLine(matrix);
            Console.WriteLine();
        }
    }
}

// Executing method Main() produces the following output:
// 
// Data matrix:
// (                1,               -1) (                5,               -5) 
// (                2,               -2) (                6,               -6) 
// (                3,               -3) (                7,               -7) 
// (                4,               -4) (                8,               -8) 
// 
// 
// 
// Updated data matrix:
// (                1,               -1) (                0,                0) 
// (                2,               -2) (              100,                0) 
// (                3,               -3) (              200,                0) 
// (                4,               -4) (              300,                0) 
// 
// 

See Also