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
indexintThe 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
vectorVectorValueThe 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
leftVectorValueThe left vector.
rightVectorValueThe 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
valueNumberValueThe 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
arrayNumberValue[]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
leftVectorValueThe multiplier vector.
rightVectorValueThe 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
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
otherVectorValueAn 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.
[ExcludeFromCodeCoverage]
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
leftVectorValueThe left vector.
rightVectorValueThe 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
vectorVectorValueThe vector.
numberNumberValueThe 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
leftVectorValueThe left vector.
rightVectorValueThe 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
vectorVectorValueThe vector.
Returns
- MatrixValue
The transposed matrix.
Operators
operator +(VectorValue, VectorValue)
Adds two objects of VectorValue.
public static VectorValue operator +(VectorValue left, VectorValue right)
Parameters
leftVectorValueThe first object to add.
rightVectorValueThe second object to add.
Returns
- VectorValue
An object that is the sum of
leftandright.
operator ==(VectorValue, VectorValue)
Determines whether two specified instances of VectorValue are equal.
public static bool operator ==(VectorValue left, VectorValue right)
Parameters
leftVectorValueThe first object to compare.
rightVectorValueThe second object to compare.
Returns
- bool
trueifleftis 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
leftVectorValueThe first object to compare.
rightVectorValueThe second object to compare.
Returns
- bool
trueifleftis not equal toright; otherwise,false.
operator *(VectorValue, VectorValue)
Multiplies two objects of VectorValue.
public static NumberValue operator *(VectorValue left, VectorValue right)
Parameters
leftVectorValueThe first object to multiply.
rightVectorValueThe second object to multiply.
Returns
- NumberValue
An object that is the product of
leftandright.
operator *(VectorValue, NumberValue)
Multiplies VectorValue and NumberValue.
public static VectorValue operator *(VectorValue left, NumberValue right)
Parameters
leftVectorValueThe first object to multiply.
rightNumberValueThe second object to multiply.
Returns
- VectorValue
An object that is the product of
leftandright.
operator -(VectorValue, VectorValue)
Subtracts two objects of VectorValue.
public static VectorValue operator -(VectorValue left, VectorValue right)
Parameters
leftVectorValueThe first object to sub.
rightVectorValueThe second object to sub.
Returns
- VectorValue
An object that is the difference of
leftandright.