Struct VectorValue
- Namespace
- xFunc.Maths.Expressions.Matrices
- Assembly
- xFunc.Maths.dll
Represent the Vector value.
public readonly struct VectorValue : IEquatable<VectorValue>, IEnumerable<NumberValue>, IEnumerable
- Implements
- Inherited Members
Properties
this[int]
Gets the double at the specified index.
public NumberValue this[int index] { get; }
Parameters
index
intThe index.
Property Value
- NumberValue
The double.
Size
Gets the size of the current vector.
public int Size { get; }
Property Value
Methods
Abs(VectorValue)
Calculates the absolute value (norm) of vector.
public static object Abs(VectorValue vector)
Parameters
vector
VectorValueThe vector.
Returns
- object
Return the absolute value of vector.
Add(VectorValue, VectorValue)
Adds the right
vector to the left
vector.
public static VectorValue Add(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe left vector.
right
VectorValueThe right vector.
Returns
- VectorValue
The sum of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Average()
Computes the average of a sequence of numeric values.
public NumberValue Average()
Returns
- NumberValue
The average value.
Create(NumberValue)
Creates a new instance of VectorValue.
public static VectorValue Create(NumberValue value)
Parameters
value
NumberValueThe item of a new vector.
Returns
- VectorValue
The vector.
Create(params NumberValue[])
Creates a new instance of VectorValue.
public static VectorValue Create(params NumberValue[] array)
Parameters
array
NumberValue[]The array.
Returns
- VectorValue
The vector.
Cross(VectorValue, VectorValue)
Computes the cross product of two vectors.
public static VectorValue Cross(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe multiplier vector.
right
VectorValueThe multiplicand vector.
Returns
- VectorValue
The cross product.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
Equals(VectorValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(VectorValue other)
Parameters
other
VectorValueAn object to compare with this object.
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<NumberValue> GetEnumerator()
Returns
- IEnumerator<NumberValue>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Mul(VectorValue, VectorValue)
Calculates ths dot product of two vectors.
public static NumberValue Mul(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe left vector.
right
VectorValueThe right vector.
Returns
- NumberValue
The dot product of vectors.
Exceptions
- ArgumentException
The size of vectors is invalid.
Mul(VectorValue, NumberValue)
Multiplies vector
by number
.
public static VectorValue Mul(VectorValue vector, NumberValue number)
Parameters
vector
VectorValueThe vector.
number
NumberValueThe number.
Returns
- VectorValue
The product of matrices.
Sub(VectorValue, VectorValue)
Subtracts the right
vector from the left
vector.
public static VectorValue Sub(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe left vector.
right
VectorValueThe right vector.
Returns
- VectorValue
The difference of matrices.
Exceptions
- ArgumentException
The size of matrices is invalid.
Sum()
Computes the sum of a sequence of numeric values.
public NumberValue Sum()
Returns
- NumberValue
The sum of the values in the vector.
ToArray()
Converts the current vector to an array.
public NumberValue[] ToArray()
Returns
- NumberValue[]
The array.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Transpose(VectorValue)
Transposes the specified vector.
public static MatrixValue Transpose(VectorValue vector)
Parameters
vector
VectorValueThe vector.
Returns
- MatrixValue
The transposed matrix.
Operators
operator +(VectorValue, VectorValue)
Adds two objects of VectorValue.
public static VectorValue operator +(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe first object to add.
right
VectorValueThe second object to add.
Returns
- VectorValue
An object that is the sum of
left
andright
.
operator ==(VectorValue, VectorValue)
Determines whether two specified instances of VectorValue are equal.
public static bool operator ==(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe first object to compare.
right
VectorValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator !=(VectorValue, VectorValue)
Determines whether two specified instances of VectorValue are not equal.
public static bool operator !=(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe first object to compare.
right
VectorValueThe second object to compare.
Returns
- bool
true
ifleft
is not equal toright
; otherwise,false
.
operator *(VectorValue, VectorValue)
Multiplies two objects of VectorValue.
public static NumberValue operator *(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe first object to multiply.
right
VectorValueThe second object to multiply.
Returns
- NumberValue
An object that is the product of
left
andright
.
operator *(VectorValue, NumberValue)
Multiplies VectorValue and NumberValue.
public static VectorValue operator *(VectorValue left, NumberValue right)
Parameters
left
VectorValueThe first object to multiply.
right
NumberValueThe second object to multiply.
Returns
- VectorValue
An object that is the product of
left
andright
.
operator -(VectorValue, VectorValue)
Subtracts two objects of VectorValue.
public static VectorValue operator -(VectorValue left, VectorValue right)
Parameters
left
VectorValueThe first object to sub.
right
VectorValueThe second object to sub.
Returns
- VectorValue
An object that is the difference of
left
andright
.