Click or drag to resize

ComplexMatrixRowZData Property

Gets or sets the entry of the ComplexMatrixRow having the column index specified by the ZDataColumn property of the ComplexMatrixRowCollection of which the row is an item.

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public Complex ZData { get; set; }

Property Value

Type: Complex
The row entry corresponding to the ZDataColumn column index.
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.

Entries of a ComplexMatrixRow instance corresponding to a specific column index can be get or set through the indexer ItemInt32. When the indexer sets the entry, the row fires the PropertyChanged event, notifying that the name of the changed property is "Item[]"; as a consequence, subscribers to the event can't know what is the column index of the changed entry. This can be problematic if you want to use ComplexMatrixRow instances as binding sources, for example when binding charts or grids to matrix data.

To overcome such difficulties, the ComplexMatrixRow class defines, among others, the ZData property. This property returns a specific entry of the row, that one having as column index the value returned by the ZDataColumn property of the ComplexMatrixRowCollection which the row belongs to. In this way, ZData can be easily used as a path property when binding to ComplexMatrixRow sources.

If set, the ZData property fires the PropertyChanged event, and the new value becomes the entry of Matrix having row and column indexes given by Index and ZDataColumn, respectively.

Examples

In the following example, the ZDataColumn of a collection of matrix rows is set, and the ZData property of its rows is evaluated.

C#
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexRowZDataExample0  
    {
        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 the column corresponding to property ZData.
            rows.ZDataColumn = 0;

            // Get the ZData value for each row.
            foreach (var row in rows)
            {
                Console.WriteLine("ZData for Row {0}: {1}", row.Index, row.ZData);
            }

            // Set the ZData property: this code updates the data matrix, too.
            foreach (var row in rows)
            {
                row.ZData = new Complex(row.Index * 100.0, 0);
            }

            Console.WriteLine();
            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) 
// 
// 
// 
// ZData for Row 0: (1, -1)
// ZData for Row 1: (2, -2)
// ZData for Row 2: (3, -3)
// ZData for Row 3: (4, -4)
// 
// Updated data matrix:
// (                0,                0) (                5,               -5) 
// (              100,                0) (                6,               -6) 
// (              200,                0) (                7,               -7) 
// (              300,                0) (                8,               -8) 
// 
// 

See Also