Programming Reference for VirtualLab Fusion  2025.1
Loading...
Searching...
No Matches
VectorC Struct Reference

This struct defines a two-dimensional vector of complex numbers. Operators \(a+b\), \(a-b\) and \(a|b\) (Scalar product) can be used. One operand on \(a*b\), \(a/b\) (applied separate on components) can also be a Complex. Implicit casting from Vector is supported. More...

Inheritance diagram for VectorC:

Public Member Functions

double Abs ()
 Calculates the absolute value of this VectorC object. The absolute value is defined as the square root of Norm().
 
double Norm ()
 Calculates the norm of the present VectorC object. The norm is defined as (X * Complex.Conjugate(X) + Y * Complex.Conjugate(Y)).Re which is equal to the sum of the norms of the vector components.
 
void Normalize ()
 Normalizes the present VectorC object.
 
VectorC Sqrt ()
 Calculates the square roots of the components of the present VectorC object and returns a new object.
 
override string ToString ()
 Converts this VectorC to a string using the format (real / imaginary, amplitude / phase and so on) defined in the Global Options is used.
 
string ToString (ComplexToStringConversionFormat complexNumberFormat, int numberOfDigits)
 Converts this VectorC to a string.
 
 VectorC (Complex x, Complex y)
 Creates a VectorC from two Complex values.
 
 VectorC (VectorC vec)
 Creates a new VectorC object from an existing object.
 
 VectorC (VectorD Re, VectorD Im)
 Creates a VectorC from two VectorD objects. The first VectorD stands for the real part of x- and y-component and the second VectorD stands for the imaginary part of the two components.
 

Static Public Member Functions

static implicit operator VectorC (VectorD vectorD)
 Converts a VectorD object into a VectorC object.
 
static bool operator!= (VectorC vector1, VectorC vector2)
 Compares two VectorC for inequality. The comparison will be done by comparing the values of the two x- and y- components respectively.
 
static VectorC operator* (Complex factor, VectorC vector)
 Multiplies a VectorC object with a Complex value.
 
static VectorC operator* (VectorC a, VectorC b)
 Multiplies two VectorC objects.
 
static VectorC operator* (VectorC vector, Complex factor)
 Multiplies a VectorC object with a Complex value.
 
static VectorC operator+ (VectorC a, VectorC b)
 Adds two VectorC objects.
 
static VectorC operator- (VectorC a, VectorC b)
 Subtracts two VectorC objects.
 
static VectorC operator/ (Complex number, VectorC vector)
 Performs a component wise division of a double value and a VectorC object. The result is defined as new VectorC(number / vector.X, number / vector.Y).
 
static VectorC operator/ (VectorC a, VectorC b)
 Performs a component wise division of two VectorC objects.
 
static VectorC operator/ (VectorC vector, Complex divisor)
 Performs a component wise division of a VectorC object and a Complex value.
 
static bool operator== (VectorC vector1, VectorC vector2)
 Compares two VectorC for equality. The comparison will be done by comparing the values of the two x- and y- components respectively.
 
static Complex operator| (VectorC a, VectorC b)
 Calculates the scalar product of two VectorC objects. The scalar product is defined as a.X * b.X + a.Y * b.Y.
 
static VectorC Parse (string vectorCAsString, ComplexToStringConversionFormat complexNumberFormat, NumberFormatInfo doubleFormat=null)
 parse function of the VectorC class
 

Public Attributes

Complex X
 X value of the VectorC object.
 
Complex Y
 Y value of the VectorC object.
 

Static Public Attributes

static readonly VectorC UnitVectorX
 A constant containing the unit vector in x-direction.
 
static readonly VectorC UnitVectorY
 A constant containing the unit vector in y-direction.
 
static readonly VectorC ZeroVector
 A constant containing the zero vector (0, 0).
 

Properties

VectorD Im [get, set]
 Sets or gets a VectorD object containing the the imaginary part of the x- and y-components of the VectorC object. If an VectorD object is set then the real parts of both components are not influenced.
 
VectorD Re [get, set]
 Sets or gets a VectorD object containing the the real part of the x- and y-components of the VectorC object. If an VectorD object is set then the imaginary parts of both components are not influenced.
 

Detailed Description

This struct defines a two-dimensional vector of complex numbers. Operators \(a+b\), \(a-b\) and \(a|b\) (Scalar product) can be used. One operand on \(a*b\), \(a/b\) (applied separate on components) can also be a Complex. Implicit casting from Vector is supported.

Constructor & Destructor Documentation

◆ VectorC() [1/3]

VectorC ( Complex  x,
Complex  y 
)

Creates a VectorC from two Complex values.

Parameters
xX value of new VectorC object.
yY value of new VectorC object.

◆ VectorC() [2/3]

VectorC ( VectorD  Re,
VectorD  Im 
)

Creates a VectorC from two VectorD objects. The first VectorD stands for the real part of x- and y-component and the second VectorD stands for the imaginary part of the two components.

Parameters
ReReal part of x- and y-component of new VectorC.
ImImaginary part of x- and y-component of new VectorC.

◆ VectorC() [3/3]

VectorC ( VectorC  vec)

Creates a new VectorC object from an existing object.

Parameters
vecVectorC object to copy.

Member Function Documentation

◆ Abs()

double Abs ( )

Calculates the absolute value of this VectorC object. The absolute value is defined as the square root of Norm().

Returns
The absolute value of the VectorC.

◆ Norm()

double Norm ( )

Calculates the norm of the present VectorC object. The norm is defined as (X * Complex.Conjugate(X) + Y * Complex.Conjugate(Y)).Re which is equal to the sum of the norms of the vector components.

Returns
The norm of the VectorC object.

◆ operator VectorC()

static implicit operator VectorC ( VectorD  vectorD)
static

Converts a VectorD object into a VectorC object.

Parameters
vectorDVectorD object to convert into VectorC object.
Returns
The converted VectorC object.

inheritdoc/>

◆ operator!=()

static bool operator!= ( VectorC  vector1,
VectorC  vector2 
)
static

Compares two VectorC for inequality. The comparison will be done by comparing the values of the two x- and y- components respectively.

Parameters
vector1First VectorC object to compare.
vector2Second VectorC object to compare.
Returns
Returns true if the two objects are unequal.

◆ operator*() [1/3]

static VectorC operator* ( Complex  factor,
VectorC  vector 
)
static

Multiplies a VectorC object with a Complex value.

Parameters
factorThe Complex value to multiply.
vectorThe VectorC object to multiply.
Returns
Returns the product of the VectorC object and the Complex value.

◆ operator*() [2/3]

static VectorC operator* ( VectorC  a,
VectorC  b 
)
static

Multiplies two VectorC objects.

Parameters
aThe first VectorC object to multiply.
bThe second VectorC object to multiply.
Returns
Returns the product of the two VectorC objects.

◆ operator*() [3/3]

static VectorC operator* ( VectorC  vector,
Complex  factor 
)
static

Multiplies a VectorC object with a Complex value.

Parameters
vectorThe VectorC object to multiply.
factorThe Complex value to multiply.
Returns
Returns the product of the VectorC object and the Complex value.

◆ operator+()

static VectorC operator+ ( VectorC  a,
VectorC  b 
)
static

Adds two VectorC objects.

Parameters
aThe first VectorC object to add.
bThe second VectorC object to add.
Returns
Returns the sum of the two VectorC objects.

◆ operator-()

static VectorC operator- ( VectorC  a,
VectorC  b 
)
static

Subtracts two VectorC objects.

Parameters
aThe first VectorC object to subtract from.
bThe second VectorC object to subtract.
Returns
Returns the difference of the two VectorC objects.

◆ operator/() [1/3]

static VectorC operator/ ( Complex  number,
VectorC  vector 
)
static

Performs a component wise division of a double value and a VectorC object. The result is defined as new VectorC(number / vector.X, number / vector.Y).

Parameters
numberThe double value to divide by the components of the VectorD object.
vectorThe VectorC object used as divisor.
Returns
Returns the quotient of the double value and the VectorC object.

◆ operator/() [2/3]

static VectorC operator/ ( VectorC  a,
VectorC  b 
)
static

Performs a component wise division of two VectorC objects.

Parameters
aThe first VectorC object to divide by parameter b.
bThe second VectorC object used as divisor.
Returns
Returns the quotient of the two VectorC objects.

◆ operator/() [3/3]

static VectorC operator/ ( VectorC  vector,
Complex  divisor 
)
static

Performs a component wise division of a VectorC object and a Complex value.

Parameters
vectorThe VectorC object to divide by the Complex value.
divisorThe Complex value used as divisor.
Returns
Returns the quotient of the VectorC object and the Complex value.

◆ operator==()

static bool operator== ( VectorC  vector1,
VectorC  vector2 
)
static

Compares two VectorC for equality. The comparison will be done by comparing the values of the two x- and y- components respectively.

Parameters
vector1First VectorC object to compare.
vector2Second VectorC object to compare.
Returns
Returns true if the two objects are equal.

◆ operator|()

static Complex operator| ( VectorC  a,
VectorC  b 
)
static

Calculates the scalar product of two VectorC objects. The scalar product is defined as a.X * b.X + a.Y * b.Y.

Parameters
aFirst VectorC object.
bSecond VectorC object.
Returns
Scalar product of the two VectorC objects.

◆ Parse()

static VectorC Parse ( string  vectorCAsString,
ComplexToStringConversionFormat  complexNumberFormat,
NumberFormatInfo  doubleFormat = null 
)
static

parse function of the VectorC class

Parameters
vectorCAsStringthe string which should be parsed
complexNumberFormatThe format of the complex numbers (real / imaginary, amplitude / phase and so on).
doubleFormatThe format of the double numbers, especially the decimal separator. If this optional parameter is not specified the default format ('.' as decimal separator) is used.
Returns
the VectorC object which was parsed from input string
Exceptions
System.ArgumentExceptionThe VectorC could not be parsed.

◆ Sqrt()

VectorC Sqrt ( )

Calculates the square roots of the components of the present VectorC object and returns a new object.

Returns
The square root of the components of this VectorC object.

◆ ToString() [1/2]

override string ToString ( )

Converts this VectorC to a string using the format (real / imaginary, amplitude / phase and so on) defined in the Global Options is used.

Returns
String containing the VectorC information.

◆ ToString() [2/2]

string ToString ( ComplexToStringConversionFormat  complexNumberFormat,
int  numberOfDigits 
)

Converts this VectorC to a string.

Parameters
complexNumberFormatThe complex number format (real / imaginary, amplitude / phase and so on) to be used for the conversion.
numberOfDigitsThe number of significant digits.
Returns
String containing the VectorC information.