Class Vector
Class defining a vector in a real vector space.
Implements
Namespace: BRIDGES.LinearAlgebra.Vectors
Assembly: BRIDGES.dll
Syntax
public abstract class Vector : IEquatable<Vector>, IDotProduct<Vector, double>, INorm<Vector>, IMetric<Vector>, IGroupAction<Vector, double>
Constructors
| Improve this Doc View SourceVector(Int32)
Initialises a new instance of the Vector class.
Declaration
protected Vector(int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Number of compoenent of the new Vector. |
Properties
| Improve this Doc View SourceItem[Int32]
Gets or sets the component at a given index.
Declaration
public abstract double this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the component to get or set. |
Property Value
Type | Description |
---|---|
Double | The value of the component. |
Size
Number of component of this vector.
Declaration
public abstract int Size { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAdd(Vector, Vector)
Computes the addition of two Vector.
Declaration
public static Vector Add(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector for the addition. |
Vector | right | Right Vector for the addition. |
Returns
Type | Description |
---|---|
Vector | The Vector resulting from the addition. |
Divide(Vector, Double)
Computes the scalar division of a Vector with a
Declaration
public static Vector Divide(Vector operand, double divisor)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector to divide. |
Double | divisor |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the scalar division. |
Equals(Vector)
Class defining a vector in a real vector space.
Declaration
public virtual bool Equals(Vector other)
Parameters
Type | Name | Description |
---|---|---|
Vector | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Class defining a vector in a real vector space.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
GetEnumerator()
Class defining a vector in a real vector space.
Declaration
public abstract IEnumerator<double> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Double> |
GetHashCode()
Class defining a vector in a real vector space.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
GramSchmidt(IEnumerable<Vector>)
Ortho-normalise the set of Vector using a Gram-Schimdt process.
Declaration
public static Vector[] GramSchmidt(IEnumerable<Vector> vectors)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Vector> | vectors | Set of Vector to operate on. |
Returns
Type | Description |
---|---|
Vector[] | The ortho-normal set of Vector. |
Remarks
If the vectors are not linearly independent the number of vectors will change.
Multiply(Vector, Double)
Computes the right scalar multiplication of a Vector with a
Declaration
public static Vector Multiply(Vector operand, double factor)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector to multiply on the right. |
Double | factor |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the right scalar multiplication. |
Multiply(Double, Vector)
Computes the left scalar multiplication of a Vector with a
Declaration
public static Vector Multiply(double factor, Vector operand)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | |
Vector | operand | Vector to multiply on the left. |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the left scalar multiplication. |
Norm()
Computes the length of this vector.
Declaration
public virtual double Norm()
Returns
Type | Description |
---|---|
Double | The value of the vector length. |
Opposite(Vector)
Computes the opposite of the Vector.
Declaration
public static Vector Opposite(Vector operand)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector whose opposite is to be computed. |
Returns
Type | Description |
---|---|
Vector | The Vector, opposite of the initial one. |
SquaredNorm()
Computes the squared norm of this vector.
Declaration
public virtual double SquaredNorm()
Returns
Type | Description |
---|---|
Double | The value of the vector squared norm. |
Subtract(Vector, Vector)
Computes the subtraction of two Vector.
Declaration
public static Vector Subtract(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector to subtract. |
Vector | right | Right Vector to subtract with. |
Returns
Type | Description |
---|---|
Vector | The Vector resulting from the subtraction. |
ToArray()
Translates this vector into its array representation.
Declaration
public abstract double[] ToArray()
Returns
Type | Description |
---|---|
Double[] | The array representing the vector. |
ToString()
Class defining a vector in a real vector space.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
TransposeMultiply(Vector, Vector)
Declaration
public static double TransposeMultiply(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector to transpose, then multiply. |
Vector | right | Right Vector to multiply. |
Returns
Type | Description |
---|---|
Double | The scalar value resulting from the operation. |
Operators
| Improve this Doc View SourceAddition(Vector, Vector)
Computes the addition of two Vector.
Declaration
public static Vector operator +(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector for the addition. |
Vector | right | Right Vector for the addition. |
Returns
Type | Description |
---|---|
Vector | The Vector resulting from the addition. |
Division(Vector, Double)
Computes the scalar division of a Vector with a
Declaration
public static Vector operator /(Vector operand, double divisor)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector to divide. |
Double | divisor |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the scalar division. |
Equality(Vector, Vector)
Evaluates whether two Vector are equal or not.
Declaration
public static bool operator ==(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector for the comparison. |
Vector | right | Right Vector for the comparison. |
Returns
Type | Description |
---|---|
Boolean | true if the two Vector are equal, false otherwise. |
Inequality(Vector, Vector)
Evaluates whether two Vector are different.
Declaration
public static bool operator !=(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector for the comparison. |
Vector | right | Right Vector for the comparison. |
Returns
Type | Description |
---|---|
Boolean | true if the two Vector are different, false otherwise. |
Multiply(Vector, Double)
Computes the right scalar multiplication of a Vector with a
Declaration
public static Vector operator *(Vector operand, double factor)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector to multiply on the right. |
Double | factor |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the right scalar multiplication. |
Multiply(Double, Vector)
Computes the left scalar multiplication of a Vector with a
Declaration
public static Vector operator *(double factor, Vector operand)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | |
Vector | operand | Vector to multiply on the left. |
Returns
Type | Description |
---|---|
Vector | The new Vector resulting from the left scalar multiplication. |
Subtraction(Vector, Vector)
Computes the subtraction of two Vector.
Declaration
public static Vector operator -(Vector left, Vector right)
Parameters
Type | Name | Description |
---|---|---|
Vector | left | Left Vector to subtract. |
Vector | right | Right Vector to subtract with. |
Returns
Type | Description |
---|---|
Vector | The Vector resulting from the subtraction. |
UnaryNegation(Vector)
Computes the opposite of the Vector.
Declaration
public static Vector operator -(Vector operand)
Parameters
Type | Name | Description |
---|---|---|
Vector | operand | Vector whose opposite is to be computed. |
Returns
Type | Description |
---|---|
Vector | The Vector, opposite of the initial one. |
Explicit Interface Implementations
| Improve this Doc View SourceIDotProduct<Vector, Double>.DotProduct(Vector)
Computes the dot product of this element with another element.
Declaration
double IDotProduct<Vector, double>.DotProduct(Vector other)
Parameters
Type | Name | Description |
---|---|---|
Vector | other |
Returns
Type | Description |
---|---|
Double | The value of the dot product of the two elements. |
IMetric<Vector>.DistanceTo(Vector)
Computes the distance of this element to another element.
Declaration
double IMetric<Vector>.DistanceTo(Vector other)
Parameters
Type | Name | Description |
---|---|---|
Vector | other |
Returns
Type | Description |
---|---|
Double | The value of the distance between the two elements. |
IGroupAction<Vector, Double>.Divide(Double)
Computes the right scalar division of the current element.
Declaration
Vector IGroupAction<Vector, double>.Divide(double divisor)
Parameters
Type | Name | Description |
---|---|---|
Double | divisor |
Returns
Type | Description |
---|---|
Vector | The new element resulting from the scalar dividion. |
IGroupAction<Vector, Double>.Multiply(Double)
Computes the right scalar multiplication of the current element.
Declaration
Vector IGroupAction<Vector, double>.Multiply(double factor)
Parameters
Type | Name | Description |
---|---|---|
Double | factor |
Returns
Type | Description |
---|---|
Vector | The new element resulting from the scalar multiplication. |