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
TThe underlying numeric type.
- Inheritance
-
ObjectBaseLargeArray<T>
- Implements
-
IEquatable<IObjectBase>ILargeArray<T>
- 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
samplingPointsVectorNumber of values in x- and y-direction.
initializeValuesboolIf 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
samplingPointsVectorNumber of values in x- and y-direction.
valueGeneratorFunc<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
samplingPointsVectorNumber of values in x- and y-direction.
valueTValue 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
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
Property Value
- T
Exceptions
SamplingPoints
Gets the number of sampling points in the array.
public Vector SamplingPoints { get; }
Property Value
Methods
Clone()
Clones this large array.
public override object Clone()
Returns
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
samplingPointsVectorThe desired number of sampling points.
initializeValuesboolIf 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
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
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or physical equality.
Returns
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
sizeVectorsize of the region to extract.
positionVectorPosition at which field is to be extracted.
ellipticalboolElliptical extraction?
Returns
- LargeArray<T>
The extracted field
Exceptions
ExtractColumn(int)
Extracts a column out of the current array.
public T[] ExtractColumn(int columnIndex)
Parameters
columnIndexintindex 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
rowIndexintindex 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
Fill(T)
Fills whole array with the specified value.
public void Fill(T value)
Parameters
valueTValue 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
cTComplex value to fill the field with.
markerRectangleRegion that decides where to fill.
insideboolFill inside or outside of the marker.
ellipticalboolFill 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
otherArrayILargeArray<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
otherArrayILargeArray<O>The other array.
Returns
- LargeArray<T>
The converted array.
Type Parameters
OThe 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()