Table of Contents

Class LargeArray<T>

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

This class is a two-dimensional array of up to MaxValue times MaxValue entries. the values can be one of the base numeric types of .Net (byte, short, float, and so on).

public class LargeArray<T> : ObjectBase, IEquatable<IObjectBase>, ILargeArray<T>, ICloneable, IDisposable where T : unmanaged, IConvertible, INumber<T>

Type Parameters

T

The underlying numeric type.

Inheritance
ObjectBase
LargeArray<T>
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

LargeArray()

Creates a Large Array with 3 × 3 sampling points.

public LargeArray()

LargeArray(Vector, bool)

Creates a LargeArray<T> with given number of sampling points.

public LargeArray(Vector samplingPoints, bool initializeValues = true)

Parameters

samplingPoints Vector

Number of values in x- and y-direction.

initializeValues bool

If this optional parameter is set to false, the field values are not initialized. Should be used only if the values are initialized immediately afterwards, but then performance is better.

LargeArray(Vector, Func<int, int, T>)

Creates a LargeArray<T> with given number of sampling points. Field is filled with constant value.

public LargeArray(Vector samplingPoints, Func<int, int, T> valueGenerator)

Parameters

samplingPoints Vector

Number of values in x- and y-direction.

valueGenerator Func<int, int, T>

Function generating a value depending on the x- and y-index.

LargeArray(Vector, T)

Creates a LargeArray<T> with given number of sampling points. Field is filled with constant value.

public LargeArray(Vector samplingPoints, T value)

Parameters

samplingPoints Vector

Number of values in x- and y-direction.

value T

Value with which the field is to be initialized.

Fields

Zero

The zero value of the given type.

public static readonly T Zero

Field Value

T

_isDisposed

If the LargeArray<T> was disposed this variable is true.

protected bool _isDisposed

Field Value

bool

Properties

this[int, int]

Indexer to get and set the value at a certain position.

public T this[int x, int y] { get; set; }

Parameters

x int

Index for x-direction.

y int

Index for y-direction.

Property Value

T

Exceptions

IndexOutOfRangeException

SamplingPoints

Gets the number of sampling points in the array.

public Vector SamplingPoints { get; }

Property Value

Vector

Methods

Clone()

Clones this large array.

public override object Clone()

Returns

object

CreateData(Vector, bool)

Initializes the VirtualLabAPI.Core.Numerics.LargeArray<T>._data field with the specified SamplingPoints and sets the SamplingPoints field.

protected void CreateData(Vector samplingPoints, bool initializeValues = true)

Parameters

samplingPoints Vector

The desired number of sampling points.

initializeValues bool

If this optional parameter is set to false, the field values are not initialized. Should be used only if the values are initialized immediately afterwards, but then performance is better.

Exceptions

ComplexField.FieldIsDiposed
OutOfMemoryException

Dispose()

Frees all memory that is used to save the sampling points. After disposing it is not possible to access sampling points.

public void Dispose()

Equals(object?, EqualityIntent)

Determines whether the specified object is equal to this instance.

public override bool Equals(object? otherObject, EqualityIntent equalityIntent)

Parameters

otherObject object

The object to compare with this instance.

equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

Extract(Vector, Vector, bool)

Extracts the given region at given position out of the current field. Points exceeding boundaries of current field will be ignored.

public LargeArray<T> Extract(Vector size, Vector position, bool elliptical = false)

Parameters

size Vector

size of the region to extract.

position Vector

Position at which field is to be extracted.

elliptical bool

Elliptical extraction?

Returns

LargeArray<T>

The extracted field

Exceptions

IndexOutOfRangeException

ExtractColumn(int)

Extracts a column out of the current array.

public T[] ExtractColumn(int columnIndex)

Parameters

columnIndex int

index of the row to extract.

Returns

T[]

A normal array with only the extracted row.

ExtractRow(int)

Extracts a row out of the current array.

public T[] ExtractRow(int rowIndex)

Parameters

rowIndex int

index of the row to extract.

Returns

T[]

A normal array with only the extracted row.

Fill(Func<int, int, T>)

Fills whole array with by the specified value generating function.

public void Fill(Func<int, int, T> valueGenerator)

Parameters

valueGenerator Func<int, int, T>

Function generating a value depending on the x- and y-index.

Fill(T)

Fills whole array with the specified value.

public void Fill(T value)

Parameters

value T

Value to fill the array with.

Fill(T, Rectangle, bool, bool)

Fills whole \markAsCode{ComplexField} inside marker with the specified complex value. If inside is set to false, field outside marker will be filled.

public void Fill(T c, Rectangle marker, bool inside, bool elliptical = false)

Parameters

c T

Complex value to fill the field with.

marker Rectangle

Region that decides where to fill.

inside bool

Fill inside or outside of the marker.

elliptical bool

Fill elliptical instead of rectangular region?

FromArrayOfComplex(ILargeArray<Complex>)

Creates a LargeArray<T> from an ILargeArray<T> with complex values. Only the real part is extracted.

public static LargeArray<T> FromArrayOfComplex(ILargeArray<Complex> otherArray)

Parameters

otherArray ILargeArray<Complex>

The other array with complex values.

Returns

LargeArray<T>

The converted array.

FromArrayOfOtherType<O>(ILargeArray<O>)

Creates a LargeArray<T> from an ILargeArray<T> of another base type.

public static LargeArray<T> FromArrayOfOtherType<O>(ILargeArray<O> otherArray) where O : unmanaged, IConvertible

Parameters

otherArray ILargeArray<O>

The other array.

Returns

LargeArray<T>

The converted array.

Type Parameters

O

The base type of the other array.

InvertValues()

Sets all points where field is zero to one, and all other points of the field to zero

public void InvertValues()