Programming Reference for VirtualLab Fusion  2025.1
Loading...
Searching...
No Matches
ComplexField Class Reference

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
This class is a matrix of complex values. If no imaginary part is needed (real valued fields) one can set a special flag that indicates a real valued field (ComplexField with imaginary part zero). This different internal representations are used to optimize the computer memory and computational time.
Operators ( \(a+b\), \(a-b\), \(a*b\) and \(a/b\)) can be used. Passing \(a\) or \(b\) as Complex or double is supported (Except of \(/\), only \(b\) may be a scalar). Operator \(a|b\) is used for calculation of inner product of two ComplexFields: \(a|b=\sum _{j=0}^{m}\sum _{i=0}^{n}a_{{i,j}}b_{{i,j}^{\star}}\) ( \(z^{\star}\) means conjugation of complex number.). IsComplex property is always taken from first operand. More...

Inheritance diagram for ComplexField:
ComplexFieldDerivative1D CFieldDerivative1DReal

Public Member Functions

void AddConjugate ()
 Adds conjugated ComplexField to current one.
 
void AddEqual (Complex c)
 Adds a Complex to current ComplexField. See important note on ComplexField.
 
void AddEqual (ComplexField field)
 Adds a ComplexField to current one. Both field must have same number of sampling points. See important note on ComplexField.
 
void ClipAmplitude (double clippingLevel)
 Sets all amplitude value greater than clippingLevel to clippingLevel.
 
 ComplexField ()
 Creates a ComplexField with 1x1 sampling points. The default precision is used and the internal data presentation is complex.
 
 ComplexField (ComplexField field)
 Copy constructor.
 
 ComplexField (Vector samplingPoints)
 Creates a ComplexField with given number of sampling points. The default precision is used and the internal data presentation is complex.
 
 ComplexField (Vector samplingPoints, bool createComplexField, Func< int, int, double > function, ParallelizationType parallelizationType=ParallelizationType.Always)
 Constructs a ComplexField object with given number of sampling points using a real-valued function which will be evaluated to fill in the complex amplitudes. The parameters x and y of the real function are measured in pixel coordinates whose origin is the upper left corner of the field.
 
 ComplexField (Vector samplingPoints, bool isComplex, PrecisionMode precision, Complex c)
 Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real. Field is filled with constant value. In case of a real valued complex field only the real part of constant value is stored.
 
 ComplexField (Vector samplingPoints, bool isComplex, PrecisionMode precision=PrecisionMode.Double, bool initializeValues=true)
 Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real.
 
 ComplexField (Vector samplingPoints, Complex c, bool isComplex=true)
 Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real. Field is filled with constant value. In case of a real valued complex field only the real part of constant value is stored.
 
 ComplexField (Vector samplingPoints, Func< int, int, Complex > function, ParallelizationType parallelizationType=ParallelizationType.Always)
 Constructs a ComplexField object with given number of sampling points using a complex-valued function which will be evaluated to fill in the complex amplitudes. The parameters x and y of the real function are measured in pixel coordinates whose origin is the upper left corner of the field.
 
void Conjugate ()
 Conjugates current ComplexField.
 
void ConvertTo2DDoubleArray (out double[,] doubleArrayReal, out double[,] doubleArrayImaginary)
 Public support method to convert the complex field into two double arrays. (real and imaginary part will be output separately) Remark: This function was implemented to realize compatibility to Python.
 
void DivEqual (Complex c)
 Divides the present ComplexField by complex number. See important note on ComplexField.
 
void DivEqual (ComplexField field)
 Divides the present ComplexField by passed one. Both field must have same number of sampling points. See important note on ComplexField.
 
void EmbedCorner (Vector newSize)
 Embeds the current ComplexField into double side-length field of zero sampling points and places the original in bottom left corner of the new field. If the ComplexField is one-dimensional, only longer side of field is doubled.
 
virtual void EmbedExtract ()
 Embeds the current ComplexField into double side-length field of zero sampling points and places the original in the middle of the new field. If the ComplexField is one-dimensional, only longer side of field is doubled.
 
virtual ComplexField EmbedExtract (Rectangle rectangle)
 Extract a region of the current ComplexField including the bottom left corner but excluding the top right corner.
 
virtual void EmbedExtract (Vector newSize)
 Embeds the current ComplexField into field of passed size of zero sampling points and places the original in the middle of the new field. By decreasing size, field can be extracted.
 
override bool Equals (Object obj)
 Checks whether two complex fields represent the same values.
 
ComplexField Extract (Vector size, VectorL position, bool elliptical=false)
 Extracts the given region at given position out of the current field. Points exceeding boundaries of current field will be ignored.
 
ComplexField ExtractColumn (int colIndex)
 Extracts a column out of the current field. Points exceeding boundaries of current field will be set to zero.
 
ComplexField ExtractRow (int rowIndex)
 Extracts a row out of the current field. Points exceeding boundaries of current field will be set to zero.
 
void Fill (Complex c)
 Fills whole current ComplexField with the specified complex value.
 
void Fill (Complex c, Rectangle marker, bool inside, bool elliptical=false)
 Fills whole ComplexField inside marker with the specified complex value. If inside is set to false, field outside marker will be filled.
 
void GetAmplitude ()
 Returns ComplexField with zero phase and a magnitude equal to that of current ComplexField.
 
void GetImaginaryPart ()
 Extracts the imaginary part of current ComplexField. The real part is set to zero.
 
void GetIntensity ()
 Extracts the intensity of ComplexField and shifts to the real part of current ComplexField. The imaginary part is set to zero.
 
void GetPhase ()
 Returns ComplexField with unit magnitude and a phase equal to that of current ComplexField.
 
void GetRealPart ()
 Extracts the real part of current ComplexField. The imaginary part is set to zero.
 
void HorizontalMirror ()
 Performs a horizontal mirroring of current ComplexField. [SamplingPoints.X - x - 1, y] = [x, y].
 
void Insert (ComplexField field, VectorL position, bool elliptical=false)
 Inserts the given ComplexField into current field at given position. Points exceeding boundaries of current field will be ignored.
 
void InsertColumn (int colIndex)
 Inserts or appends empty column.
 
void InsertRow (int rowIndex)
 Inserts or appends empty row.
 
void LiftPositive ()
 Lifts real part of current ComplexField to positive numbers. Function detects the minimum real number. If this number is smaller than zero it adds the absolute value of the minimum. If the minimum real number is larger than zero the present object is returned without changes.
 
double[] LinearFit (VectorD samplDist)
 Linear regression on a real valued Complex Field (phase derivative of a CA in x resp. y) Excluded points are assumed to be marked by float.Epsilon.
 
void ModifyComplexPart (ComplexPart complexPart, bool makeRealValuedIfSuitable=false, double thresholdForPhaseArtifacts=0, double amplitudeMaximum=0)
 Extract, shifts or swaps complex parts of the complex field.
 
void ModifyPixels (Func< Complex, Complex > modificationMethod)
 Modifies all pixels in parallel. Can be used if the new pixel value depends only on the old pixel value (and maybe some fixed parameters).
 
void ModifyPixels (Func< Complex, int, int, Complex > modificationMethod)
 Modifies all pixels in parallel. Can be used if the new pixel value depends on the old pixel value and the current position in pixel coordinates (and maybe some fixed parameters).
 
void MultEqual (Complex c)
 Multiplies a Complex number to current ComplexField. See important note on ComplexField.
 
void MultEqual (ComplexField field)
 Multiplies a ComplexField with current one. Both field must have same number of sampling points. See important note on ComplexField.
 
void MultEqual (IRegion1D2D region, SamplingParameters samplingParameters)
 Multiplies a IRegion1D2D with this ComplexField.
 
void Normalize (System.Drawing.Rectangle? rectangle=null)
 Normalizes ComplexField so that maximal amplitude inside rectangle is one.
 
void PowerEqual (Complex c)
 Raises every element of current ComplexField to the power of passed complex number. See important note on ComplexField.
 
double RadiusError (double constPart, double radius, double k, VectorD dist, bool computeInX)
 compute the fit measure of the spherical phase dependent on radius in partial phase derivative
 
void Replicate (Vector newSize, VectorL shift)
 Replicates current ComplexField periodically. Needs new size.
 
void Replicate_Periodic (Vector newSize)
 Replicates current ComplexField periodically, old field is at (0,0). Needs new size.
 
void Rotate180 ()
 Rotates this ComplexField through 180° about the field center.
 
void Shift (Vector shift, bool assumePeriodicField=false)
 Shifts current ComplexField by a specified distance. Size is not modified, so sampling points can get lost.
 
void ShiftColumnFromOnePositionToAnother (int oldColIndex, int newColIndex)
 Shifts a single column from one pixel index to another.
 
void ShiftRowFromOnePositionToAnother (int oldRowIndex, int newRowIndex)
 Shifts a single row from one pixel index to another.
 
void SortColumns (int[] newColIndices)
 Method which brings all columns into a new, given order. Since this is not optimized, it shall not be used if a) the field is to be mirrored or b) only a single column is to be shifted.
 
void SortRows (int[] newRowIndices)
 Method which brings all rows into a new, given order. Since this is not optimized, it shall not be used if a) the field is to be mirrored or b) only a single row is to be shifted.
 
void SubEqual (Complex c)
 Subtracts a Complex from current ComplexField. See important note on ComplexField.
 
void SubEqual (ComplexField field)
 Subtracts a ComplexField from current one. Both field must have same number of sampling points. See important note on ComplexField.
 
void Transpose ()
 Transposes current ComplexField. This means [x, y] = [y, x].
 
void VerticalMirror ()
 Performs a vertical mirroring of current ComplexField. [x, SamplingPoints.Y - y - 1] = [x, y].
 

Static Public Member Functions

static ComplexField ConvertFrom2_1D_DoubleArrays (double[] doubleArray1, double[] doubleArray2)
 Converts two one-dimensional double arrays to a two dimensional complex field of dimensions 2 x doubleArray1.Length.
 
static ComplexField ConvertFrom2D_DoubleArray (double[,] doubleArray)
 Converts a two dimensional double array to a two dimensional complex field.
 
static ComplexFieldDerivative1D ConvertFrom_1D_ComplexArray (Complex[] complexArray)
 Converts one one-dimensional complex array to a one-dimensional complex field.
 
static CFieldDerivative1DReal ConvertFrom_1D_DoubleArray (double[] doubleArray)
 Converts one one-dimensional double array to a one-dimensional complex field.
 
static double[] ConvertTo1D_DoubleArray (ComplexField complexField, bool errorWhenComplex)
 Converts a one dimensional complex field to a one dimensional double array.
 
static double[,] ConvertTo2D_DoubleArray (ComplexField complexField, bool errorWhenComplex)
 Converts a two dimensional complex field to a two dimensional double array.
 
static bool operator!= (ComplexField field1, ComplexField field2)
 Compares two complex fields for equality.
 
static ComplexField operator* (Complex c, ComplexField field)
 Multiplies a complex value to a complex field.
 
static ComplexField operator* (ComplexField field, Complex c)
 Multiplies a complex value to a complex field.
 
static ComplexField operator* (ComplexField field1, ComplexField field2)
 Multiplies two complex fields.
 
static ComplexField operator+ (ComplexField field, Complex c)
 Adds a complex value to a complex field.
 
static ComplexField operator+ (ComplexField field1, ComplexField field2)
 Adds two complex fields.
 
static ComplexField operator- (Complex c, ComplexField field)
 Subtracts a complex number and a complex field.
 
static ComplexField operator- (ComplexField field, Complex c)
 Subtracts a complex field and a complex number.
 
static ComplexField operator- (ComplexField field1, ComplexField field2)
 Subtracts two complex fields.
 
static ComplexField operator/ (ComplexField field, Complex c)
 Divides a complex field by a complex number.
 
static ComplexField operator/ (ComplexField field1, ComplexField field2)
 Divide two complex fields.
 
static bool operator== (ComplexField field1, ComplexField field2)
 Compares two complex fields for equality.
 
static Complex operator| (ComplexField field1, ComplexField field2)
 Computes the inner (or scalar) product of two complex fields as defined by (u|v) := Integrate[u(x) * v^(x), {x, -Infinity, Infinity}].
 

Properties

virtual bool IsComplex [get, set]
 Gets or sets the internal representation of the values of ComplexFieldGenerate Spheric. If IsComplex = true the real and imaginary part is stored. Is IsComplex = false only the real part is stored. It is assumed that the imagary part is zero. Setting the IsComplex property will convert the ComplexField from present representation to new one. Information can be lost during this conversion.
 
virtual bool IsOneD [get]
 Indicates whether field is one-dimensional or not.
 
PrecisionMode Precision [get, set]
 Changes the precision of the internal number representation. It is possible to switch between double (64 bit), single (32 bit) and integer precision (16bit). The different precisions are realized by using 3 different arrays of numbers. Only the array that corresponds to the selected precision is used and contains the values of the ComplexField. All other arrays are empty. Setting a different precision than the present will start a conversion of the ComplexField data to the new precision format. Information can be lost in case of a conversions to a lower accuracy.
 
virtual Vector SamplingPoints [get, set]
 Gets or sets number of sampling points of ComplexField. Setting a new number of sampling points will embed the sampling points in zero samples or extract the central sampling points. See also EmbedExtract.
 
int SamplingPointsOneD [get]
 Number of sampling points of one-dimensional field. An exception will be thrown, if field is two-dimensional.
 
virtual Complex this[int x, int y] [get, set]
 Indexer to access complex values of complex field. Property performs a range checking before every access. If you try to read a complex value and index is out of range Complex(0) is returned. If you try to set a complex value and index is out of range nothing will happen. Indexer returns always a complex number in double precision independent on the internal complex number representation. During the setting of a complex value the indexer converts the complex number from double precision to the internal data representation. If internal precision is less accurate double precision information will be lost. Conversion to the less accurate precision is done by truncating the numbers after the last digit of the new precision. If IsComplex = false only the real part is stored.
 
Complex this[long x, long y] [get, set]
 Indexer to access complex values of complex field. Property performs a range checking before every access. If you try to read a complex value and index is out of range Complex(0) is returned. If you try to set a complex value and index is out of range nothing will happen. Indexer returns always a complex number in double precision independent on the internal complex number representation. During the setting of a complex value the indexer converts the complex number from double precision to the internal data representation. If internal precision is less accurate double precision information will be lost. Conversion to the less accurate precision is done by truncating the numbers after the last digit of the new precision. If IsComplex = false only the real part is stored.
 

Detailed Description

This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
This class is a matrix of complex values. If no imaginary part is needed (real valued fields) one can set a special flag that indicates a real valued field (ComplexField with imaginary part zero). This different internal representations are used to optimize the computer memory and computational time.
Operators ( \(a+b\), \(a-b\), \(a*b\) and \(a/b\)) can be used. Passing \(a\) or \(b\) as Complex or double is supported (Except of \(/\), only \(b\) may be a scalar). Operator \(a|b\) is used for calculation of inner product of two ComplexFields: \(a|b=\sum _{j=0}^{m}\sum _{i=0}^{n}a_{{i,j}}b_{{i,j}^{\star}}\) ( \(z^{\star}\) means conjugation of complex number.). IsComplex property is always taken from first operand.

Constructor & Destructor Documentation

◆ ComplexField() [1/7]

ComplexField ( Vector  samplingPoints)

Creates a ComplexField with given number of sampling points. The default precision is used and the internal data presentation is complex.

Parameters
samplingPointsNumber of points in x and y direction.

◆ ComplexField() [2/7]

Copy constructor.

Parameters
fieldField to copy.

◆ ComplexField() [3/7]

ComplexField ( Vector  samplingPoints,
bool  isComplex,
PrecisionMode  precision = PrecisionMode::Double,
bool  initializeValues = true 
)

Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real.

Parameters
samplingPointsNumber of values in x and y direction.
isComplexIndicates if new ComplexField should internally store real + imaginary part (complex = true) or the real part only (complex = false) (imaginary part is zero).
precisionOptional and obsolete PrecisionMode. Should not be used.
initializeValuesIf 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.

◆ ComplexField() [4/7]

ComplexField ( Vector  samplingPoints,
bool  isComplex,
PrecisionMode  precision,
Complex  c 
)

Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real. Field is filled with constant value. In case of a real valued complex field only the real part of constant value is stored.

Parameters
samplingPointsNumber of values in x and y direction.
precisionDesired PrecisionMode.
isComplexIndicates if the new ComplexField should internally store real + imaginary part (complex = true) or the real part only (complex = false) (imaginary part is zero).
cComplex number with which the field is to be initialized.

◆ ComplexField() [5/7]

ComplexField ( Vector  samplingPoints,
Complex  c,
bool  isComplex = true 
)

Creates a ComplexField with given number of sampling points using specified precision. The internal data representation can be complex or real. Field is filled with constant value. In case of a real valued complex field only the real part of constant value is stored.

Parameters
samplingPointsNumber of values in x and y direction.
isComplexThis optional parameter indicates if the new ComplexField should internally store real + imaginary part (true, which is the default) or the real part only (false) (imaginary part is zero).
cComplex number with which the field is to be initialized.

◆ ComplexField() [6/7]

ComplexField ( Vector  samplingPoints,
bool  createComplexField,
Func< int, int, double >  function,
ParallelizationType  parallelizationType = ParallelizationType::Always 
)

Constructs a ComplexField object with given number of sampling points using a real-valued function which will be evaluated to fill in the complex amplitudes. The parameters x and y of the real function are measured in pixel coordinates whose origin is the upper left corner of the field.

Parameters
samplingPointsNumber of pixels in x-and y-direction.
createComplexFieldIndicates if new ComplexField should internally store real + imaginary part (createComplexField = true) or the real part only (createComplexField = false).
functionFunction to be evaluated.
parallelizationTypeOptional type of the parallelization (ParallelizationType.AutomaticMeasure by default). Set it to ParallelizationType.NoParallelization if the method passed by the function is not thread-safe.

◆ ComplexField() [7/7]

ComplexField ( Vector  samplingPoints,
Func< int, int, Complex function,
ParallelizationType  parallelizationType = ParallelizationType::Always 
)

Constructs a ComplexField object with given number of sampling points using a complex-valued function which will be evaluated to fill in the complex amplitudes. The parameters x and y of the real function are measured in pixel coordinates whose origin is the upper left corner of the field.

Parameters
samplingPointsNumber of pixels in x-and y-direction.
functionFunction to be evaluated.
parallelizationTypeOptional type of the parallelization (ParallelizationType.AutomaticMeasure by default). Set it to ParallelizationType.NoParallelization if the method passed by the function is not thread-safe.

Member Function Documentation

◆ AddEqual() [1/2]

void AddEqual ( Complex  c)

Adds a Complex to current ComplexField. See important note on ComplexField.

Parameters
cComplex number to add to current field.

◆ AddEqual() [2/2]

void AddEqual ( ComplexField  field)

Adds a ComplexField to current one. Both field must have same number of sampling points. See important note on ComplexField.

Parameters
fieldComplex field to add to current field.

◆ ClipAmplitude()

void ClipAmplitude ( double  clippingLevel)

Sets all amplitude value greater than clippingLevel to clippingLevel.

Parameters
clippingLevelMaximal value of amplitude.

◆ ConvertFrom2_1D_DoubleArrays()

static ComplexField ConvertFrom2_1D_DoubleArrays ( double[]  doubleArray1,
double[]  doubleArray2 
)
static

Converts two one-dimensional double arrays to a two dimensional complex field of dimensions 2 x doubleArray1.Length.

Parameters
doubleArray1The first double array to convert
doubleArray2The second double array to convert
Returns
Complex field, created from the double arrays

◆ ConvertFrom2D_DoubleArray()

static ComplexField ConvertFrom2D_DoubleArray ( double  doubleArray[,])
static

Converts a two dimensional double array to a two dimensional complex field.

Parameters
doubleArrayThe double array to convert
Returns
Complex field, created from the double array

◆ ConvertFrom_1D_ComplexArray()

static ComplexFieldDerivative1D ConvertFrom_1D_ComplexArray ( Complex[]  complexArray)
static

Converts one one-dimensional complex array to a one-dimensional complex field.

Parameters
complexArrayThe complex array to convert
Returns
Complex field, created from the complex array

◆ ConvertFrom_1D_DoubleArray()

static CFieldDerivative1DReal ConvertFrom_1D_DoubleArray ( double[]  doubleArray)
static

Converts one one-dimensional double array to a one-dimensional complex field.

Parameters
doubleArrayThe double array to convert
Returns
Complex field, created from the double array

◆ ConvertTo1D_DoubleArray()

static double[] ConvertTo1D_DoubleArray ( ComplexField  complexField,
bool  errorWhenComplex 
)
static

Converts a one dimensional complex field to a one dimensional double array.

Parameters
complexFieldComplex field to convert
errorWhenComplexShall an exception be thrown if the complex field is not real valued? Please note: The Imaginary part will be ignored in every case!
Returns
Double array, created from the complex field

◆ ConvertTo2D_DoubleArray()

static double[,] ConvertTo2D_DoubleArray ( ComplexField  complexField,
bool  errorWhenComplex 
)
static

Converts a two dimensional complex field to a two dimensional double array.

Parameters
complexFieldComplex field to convert
errorWhenComplexShall an exception be thrown if the complex field is not real valued? Please note: The Imaginary part will be ignored in every case!
Returns
Double array, created from the complex field

◆ ConvertTo2DDoubleArray()

void ConvertTo2DDoubleArray ( out double  doubleArrayReal[,],
out double  doubleArrayImaginary[,] 
)

Public support method to convert the complex field into two double arrays. (real and imaginary part will be output separately) Remark: This function was implemented to realize compatibility to Python.

Parameters
doubleArrayRealThe double array storing real part
doubleArrayImaginaryThe double array storing imaginary part (remark: if the underlying complex field is real values, this data array will only contain zeroths

◆ DivEqual() [1/2]

void DivEqual ( Complex  c)

Divides the present ComplexField by complex number. See important note on ComplexField.

Parameters
cComplex number to divide.

◆ DivEqual() [2/2]

void DivEqual ( ComplexField  field)

Divides the present ComplexField by passed one. Both field must have same number of sampling points. See important note on ComplexField.

Parameters
fieldComplex field used as divisor.

◆ EmbedCorner()

void EmbedCorner ( Vector  newSize)

Embeds the current ComplexField into double side-length field of zero sampling points and places the original in bottom left corner of the new field. If the ComplexField is one-dimensional, only longer side of field is doubled.

Parameters
newSizeNew Size in pixel.

◆ EmbedExtract() [1/2]

virtual ComplexField EmbedExtract ( Rectangle  rectangle)
virtual

Extract a region of the current ComplexField including the bottom left corner but excluding the top right corner.

Parameters
rectangleRegion to extract.
Returns
Result of Operation.

Reimplemented in ComplexFieldDerivative1D.

◆ EmbedExtract() [2/2]

virtual void EmbedExtract ( Vector  newSize)
virtual

Embeds the current ComplexField into field of passed size of zero sampling points and places the original in the middle of the new field. By decreasing size, field can be extracted.

Parameters
newSizeNew size in pixel.

Reimplemented in ComplexFieldDerivative1D.

◆ Equals()

override bool Equals ( Object  obj)

Checks whether two complex fields represent the same values.

Parameters
objComplex field to be compared
Returns
True if both fields have the same size and the same values.

◆ Extract()

ComplexField Extract ( Vector  size,
VectorL  position,
bool  elliptical = false 
)

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

Parameters
sizesize of the region to extract.
positionPosition at which field is to be extracted.
ellipticalElliptical extraction?
Returns
The extracted field

◆ ExtractColumn()

ComplexField ExtractColumn ( int  colIndex)

Extracts a column out of the current field. Points exceeding boundaries of current field will be set to zero.

Parameters
colIndexIndex of the column to extract.
Returns
A ComplexField with only the extracted column.

◆ ExtractRow()

ComplexField ExtractRow ( int  rowIndex)

Extracts a row out of the current field. Points exceeding boundaries of current field will be set to zero.

Parameters
rowIndexindex of the row to extract.
Returns
A ComplexField with only the extracted row.

◆ Fill() [1/2]

void Fill ( Complex  c)

Fills whole current ComplexField with the specified complex value.

Parameters
cComplex value to fill the field with.

◆ Fill() [2/2]

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

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

Parameters
markerRegion that decides where to fill.
cComplex value to fill the field with.
insideFill inside or outside of the marker.
ellipticalFill elliptical instead of rectangular region?

◆ Insert()

void Insert ( ComplexField  field,
VectorL  position,
bool  elliptical = false 
)

Inserts the given ComplexField into current field at given position. Points exceeding boundaries of current field will be ignored.

Parameters
fieldComplex field to insert.
positionPosition at which field is to be inserted (offset of 'field' to 'this').
ellipticalElliptical insertion?

◆ InsertColumn()

void InsertColumn ( int  colIndex)

Inserts or appends empty column.

Parameters
colIndexIndex of column left of inserted column or -1 to append column.

◆ InsertRow()

void InsertRow ( int  rowIndex)

Inserts or appends empty row.

Parameters
rowIndexIndex of row below inserted row or -1 to append row.

◆ LinearFit()

double[] LinearFit ( VectorD  samplDist)

Linear regression on a real valued Complex Field (phase derivative of a CA in x resp. y) Excluded points are assumed to be marked by float.Epsilon.

Parameters
samplDistdimensions of independent parameters (x,y)
Returns
model coefficients for linear fit dPhi = p0 + p1*x + p2*y

◆ ModifyComplexPart()

void ModifyComplexPart ( ComplexPart  complexPart,
bool  makeRealValuedIfSuitable = false,
double  thresholdForPhaseArtifacts = 0,
double  amplitudeMaximum = 0 
)

Extract, shifts or swaps complex parts of the complex field.

Parameters
complexPartEnumerator element for desired action on ComplexField.
makeRealValuedIfSuitableIf this optional parameter is set to true the field is made real-valued if the imaginary part is zeroized. This is e.g. the case for extract amplitude and shift phase to real.
thresholdForPhaseArtifactsThreshold for suppressing phase artifacts.
amplitudeMaximumAmplitude maximum, needed for calculating an absolute artifacts threshold from the relative one.

◆ ModifyPixels() [1/2]

void ModifyPixels ( Func< Complex, Complex modificationMethod)

Modifies all pixels in parallel. Can be used if the new pixel value depends only on the old pixel value (and maybe some fixed parameters).

Parameters
modificationMethodThe modification method for each pixel.

◆ ModifyPixels() [2/2]

void ModifyPixels ( Func< Complex, int, int, Complex modificationMethod)

Modifies all pixels in parallel. Can be used if the new pixel value depends on the old pixel value and the current position in pixel coordinates (and maybe some fixed parameters).

Parameters
modificationMethodThe modification method for each pixel.

◆ MultEqual() [1/3]

void MultEqual ( Complex  c)

Multiplies a Complex number to current ComplexField. See important note on ComplexField.

Parameters
cComplex number used as factor.

◆ MultEqual() [2/3]

void MultEqual ( ComplexField  field)

Multiplies a ComplexField with current one. Both field must have same number of sampling points. See important note on ComplexField.

Parameters
fieldComplex field used as factor.

◆ MultEqual() [3/3]

void MultEqual ( IRegion1D2D  region,
SamplingParameters  samplingParameters 
)

Multiplies a IRegion1D2D with this ComplexField.

Parameters
regionRegion used as factor.
samplingParametersThe sampling parameters which apply to this complex field.

◆ Normalize()

void Normalize ( System::Drawing::Rectangle?  rectangle = null)

Normalizes ComplexField so that maximal amplitude inside rectangle is one.

Parameters
rectangleIf this optional parameter is set only the region within the specified rectangle is taken into account for the calculation of the maximum being the normalization reference.

◆ operator!=()

static bool operator!= ( ComplexField  field1,
ComplexField  field2 
)
static

Compares two complex fields for equality.

Parameters
field1first field
field2second field
Returns
True if both fields do not represent the same data.

◆ operator*() [1/3]

static ComplexField operator* ( Complex  c,
ComplexField  field 
)
static

Multiplies a complex value to a complex field.

Parameters
cthe complex value
fieldthe field
Returns
The result of the operator.

◆ operator*() [2/3]

static ComplexField operator* ( ComplexField  field,
Complex  c 
)
static

Multiplies a complex value to a complex field.

Parameters
fieldthe field
cthe complex value
Returns
The result of the operator.

◆ operator*() [3/3]

static ComplexField operator* ( ComplexField  field1,
ComplexField  field2 
)
static

Multiplies two complex fields.

Parameters
field1the first field
field2the second field
Returns
The result of the operator.
Exceptions
FieldSizesDontMatch

◆ operator+() [1/2]

static ComplexField operator+ ( ComplexField  field,
Complex  c 
)
static

Adds a complex value to a complex field.

Parameters
fieldthe field
cthe complex value
Returns
The result of the operator.

◆ operator+() [2/2]

static ComplexField operator+ ( ComplexField  field1,
ComplexField  field2 
)
static

Adds two complex fields.

Parameters
field1the first field to be added
field2the second field to be added
Returns
The result of the operator.
Exceptions
FieldSizesDontMatch

◆ operator-() [1/3]

static ComplexField operator- ( Complex  c,
ComplexField  field 
)
static

Subtracts a complex number and a complex field.

Parameters
cComplex number.
fieldComplex Field to subtract.
Returns
Difference of the complex field and the complex number.

◆ operator-() [2/3]

static ComplexField operator- ( ComplexField  field,
Complex  c 
)
static

Subtracts a complex field and a complex number.

Parameters
fieldComplex Field.
cComplex number to subtract.
Returns
Difference of the complex field and the complex number.

◆ operator-() [3/3]

static ComplexField operator- ( ComplexField  field1,
ComplexField  field2 
)
static

Subtracts two complex fields.

Parameters
field1the first field
field2the second field
Returns
The result of the operator.
Exceptions
FieldSizesDontMatch

◆ operator/() [1/2]

static ComplexField operator/ ( ComplexField  field,
Complex  c 
)
static

Divides a complex field by a complex number.

Parameters
fieldcomplex field
ccomplex number
Returns
The result of the operation

◆ operator/() [2/2]

static ComplexField operator/ ( ComplexField  field1,
ComplexField  field2 
)
static

Divide two complex fields.

Parameters
field1the first field
field2the second field
Returns
The result of the operation

◆ operator==()

static bool operator== ( ComplexField  field1,
ComplexField  field2 
)
static

Compares two complex fields for equality.

Parameters
field1first field
field2second field
Returns
True if both fields represent the same data.

◆ operator|()

static Complex operator| ( ComplexField  field1,
ComplexField  field2 
)
static

Computes the inner (or scalar) product of two complex fields as defined by (u|v) := Integrate[u(x) * v^(x), {x, -Infinity, Infinity}].

Parameters
field1the first field
field2the second field
Returns
The inner product.

◆ PowerEqual()

void PowerEqual ( Complex  c)

Raises every element of current ComplexField to the power of passed complex number. See important note on ComplexField.

Parameters
cComplex exponent.

◆ RadiusError()

double RadiusError ( double  constPart,
double  radius,
double  k,
VectorD  dist,
bool  computeInX 
)

compute the fit measure of the spherical phase dependent on radius in partial phase derivative

Parameters
constPartvalue of phase derivative at x = y = 0
radiusradius of spherical phase
kproportionality factor of spherical phase function
distsampling distance in original ComplexAmplitude
computeInXis the ComplexField d_phi/dx or d_phi/dy
Returns
computed test value

◆ Replicate()

void Replicate ( Vector  newSize,
VectorL  shift 
)

Replicates current ComplexField periodically. Needs new size.

Parameters
newSizeNew Size in pixel.
shiftIntroduces a shift in pixels. If the shift is zero then the left bottom corner of the field to replicate is in the left bottom corner of the replicated field. Else the replication starts with the sampling point of the field to replicate at the position shift on the left bottom corner of the replicated field.

◆ Replicate_Periodic()

void Replicate_Periodic ( Vector  newSize)

Replicates current ComplexField periodically, old field is at (0,0). Needs new size.

Parameters
newSizeNew Size in pixel.

◆ Shift()

void Shift ( Vector  shift,
bool  assumePeriodicField = false 
)

Shifts current ComplexField by a specified distance. Size is not modified, so sampling points can get lost.

Parameters
shiftShift in pixel.
assumePeriodicFieldIf this optional parameter is set to true a periodic field is assumed. Else zeros occur outside of the shifted original field.

◆ ShiftColumnFromOnePositionToAnother()

void ShiftColumnFromOnePositionToAnother ( int  oldColIndex,
int  newColIndex 
)

Shifts a single column from one pixel index to another.

Parameters
oldColIndexOld pixel index of column.
newColIndexNew pixel index of column.

◆ ShiftRowFromOnePositionToAnother()

void ShiftRowFromOnePositionToAnother ( int  oldRowIndex,
int  newRowIndex 
)

Shifts a single row from one pixel index to another.

Parameters
oldRowIndexOld pixel index of row.
newRowIndexNew pixel index of row.

◆ SortColumns()

void SortColumns ( int[]  newColIndices)

Method which brings all columns into a new, given order. Since this is not optimized, it shall not be used if a) the field is to be mirrored or b) only a single column is to be shifted.

Parameters
newColIndicesArray with the new indices for all columns: the array index is the new index, the array item is the old index.

◆ SortRows()

void SortRows ( int[]  newRowIndices)

Method which brings all rows into a new, given order. Since this is not optimized, it shall not be used if a) the field is to be mirrored or b) only a single row is to be shifted.

Parameters
newRowIndicesArray with the new indices for all rows: the array index is the new index, the array item is the old index.

◆ SubEqual() [1/2]

void SubEqual ( Complex  c)

Subtracts a Complex from current ComplexField. See important note on ComplexField.

Parameters
cComplex number to subtract form current field.

◆ SubEqual() [2/2]

void SubEqual ( ComplexField  field)

Subtracts a ComplexField from current one. Both field must have same number of sampling points. See important note on ComplexField.

Parameters
fieldComplex field to subtract form current field.

Property Documentation

◆ this[int x, int y]

virtual Complex this[int x, int y]
getset

Indexer to access complex values of complex field. Property performs a range checking before every access. If you try to read a complex value and index is out of range Complex(0) is returned. If you try to set a complex value and index is out of range nothing will happen. Indexer returns always a complex number in double precision independent on the internal complex number representation. During the setting of a complex value the indexer converts the complex number from double precision to the internal data representation. If internal precision is less accurate double precision information will be lost. Conversion to the less accurate precision is done by truncating the numbers after the last digit of the new precision. If IsComplex = false only the real part is stored.

Parameters
xIndex for x-coordinate
yIndex for y-coordinate

◆ this[long x, long y]

Complex this[long x, long y]
getset

Indexer to access complex values of complex field. Property performs a range checking before every access. If you try to read a complex value and index is out of range Complex(0) is returned. If you try to set a complex value and index is out of range nothing will happen. Indexer returns always a complex number in double precision independent on the internal complex number representation. During the setting of a complex value the indexer converts the complex number from double precision to the internal data representation. If internal precision is less accurate double precision information will be lost. Conversion to the less accurate precision is done by truncating the numbers after the last digit of the new precision. If IsComplex = false only the real part is stored.

Parameters
xIndex for x-coordinate
yIndex for y-coordinate