Click or drag to resize

ComplexMatrixRow Class

Represents a row in a matrix of complex values.
Inheritance Hierarchy
SystemObject
  Novacta.AnalyticsComplexMatrixRow

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public sealed class ComplexMatrixRow : IEnumerable<Complex>, 
	IEnumerable, INotifyPropertyChanged, IEquatable<ComplexMatrixRow>

The ComplexMatrixRow type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleIndex
Gets or sets the index of the ComplexMatrixRow.
Public propertyCode exampleItemInt32
Gets or sets the entry of the ComplexMatrixRow having the specified column index.
Public propertyItemString
Gets or sets the entry of the ComplexMatrixRow having the specified column index.
Public propertyLength
Gets the length of the ComplexMatrixRow.
Public propertyName
Gets the name of the ComplexMatrixRow.
Public propertyCode exampleXData
Gets or sets the entry of the ComplexMatrixRow having the column index specified by the XDataColumn property of the ComplexMatrixRowCollection of which the row is an item.
Public propertyCode exampleYData
Gets or sets the entry of the ComplexMatrixRow having the column index specified by the YDataColumn property of the ComplexMatrixRowCollection of which the row is an item.
Public propertyCode exampleZData
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.
Top
Methods
  NameDescription
Public methodEquals(ComplexMatrixRow)
Indicates whether the current object is equal to another object of the same type.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Overrides ObjectEquals(Object).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through a collection.
Public methodGetHashCode
Returns a hash code for this instance.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberToComplexMatrix
Converts from ComplexMatrixRow to ComplexMatrix.
Public methodToString
Returns a String that represents this instance.
(Overrides ObjectToString.)
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property of the ComplexMatrixRow changed.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Returns a value that indicates whether a ComplexMatrixRow instance is equal to another ComplexMatrixRow instance.
Public operatorStatic member(ComplexMatrixRow to ComplexMatrix)
Performs an implicit conversion from ComplexMatrixRow to ComplexMatrix.
Public operatorStatic memberInequality
Returns a value that indicates whether a ComplexMatrixRow instance is not equal to another ComplexMatrixRow instance.
Top
Explicit Interface Implementations
Remarks

Instantiation

You cannot directly instantiate a ComplexMatrixRow. Instead, rows in a ComplexMatrix instance can be collected by calling the overloaded method AsRowCollection. Such methods return a ComplexMatrixRowCollection object, whose items have type ComplexMatrixRow.

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.

Equality

When tested for equality, ComplexMatrixRow instances are considered equal if and only if they have the same Length and, for each column index, entries corresponding to such index are equal, too.

Data binding

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 XData property. This property returns a specific entry of the row, that one having as column index the value returned by the XDataColumn property of the ComplexMatrixRowCollection which the row belongs to. In this way, XData can be easily used as a path property when binding to ComplexMatrixRow sources.

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

Additional not indexed properties are YData and ZData.

Examples

In the following example, the rows of a matrix are enumerated.

C#
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexRowsEnumeratorExample0  
    {
        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();

            // Enumerate matrix rows.
            foreach (var row in rows)
            {
                Console.WriteLine("Row {0}: ", row.Index);
                Console.WriteLine(row);
            }
        }
    }
}

// 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) 
// 
// 
// 
// Row 0: 
// (                1,               -1) (                5,               -5) 
// Row 1: 
// (                2,               -2) (                6,               -6) 
// Row 2: 
// (                3,               -3) (                7,               -7) 
// Row 3: 
// (                4,               -4) (                8,               -8)

In the following example, the first half of the rows in a matrix is collected. Then the Index of the items in the collection is modified so that, after that change, the same items represent the second half of the matrix rows.

C#
using System;
using System.Numerics;

namespace Novacta.Analytics.CodeExamples
{
    public class ComplexRowIndexDataExample1  
    {
        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 the first two matrix rows.
            var rows = matrix.AsRowCollection(IndexCollection.Range(0, 1));

            // Enumerate the specified matrix rows.
            foreach (var row in rows)
            {
                Console.WriteLine("Row {0}: ", row.Index);
                Console.WriteLine(row);
            }

            // Change the indexes of the rows in the collection,
            // so that they represent the last two matrix rows.
            rows[0].Index = 2;
            rows[1].Index = 3;

            // Enumerate the specified matrix rows.
            Console.WriteLine();
            foreach (var row in rows)
            {
                Console.WriteLine("Row {0}: ", row.Index);
                Console.WriteLine(row);
            }

        }
    }
}

// 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) 
// 
// 
// 
// Row 0: 
// (                1,               -1) (                5,               -5) 
// Row 1: 
// (                2,               -2) (                6,               -6) 
// 
// Row 2: 
// (                3,               -3) (                7,               -7) 
// Row 3: 
// (                4,               -4) (                8,               -8)

See Also