Class VectorNd
Multidimensional vector.
Inheritance
Implements
Namespace: Paramdigma.Core.Geometry
Assembly: Paramdigma.Core.dll
Syntax
public class VectorNd : IEnumerable<double>, IEquatable<VectorNd>
Constructors
| Improve this Doc View SourceVectorNd(List<Double>)
Initializes a new instance of the VectorNd class from a given list of coordinates.
Declaration
public VectorNd(List<double> values)
Parameters
Type | Name | Description |
---|---|---|
List<System.Double> | values | List of values for the vector. |
VectorNd(VectorNd)
Initializes a new instance of the VectorNd class.
Declaration
public VectorNd(VectorNd vector)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to copy. |
VectorNd(Double[])
Initializes a new instance of the VectorNd class from a given list of parameters.
Declaration
public VectorNd(params double[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | values | Number parameters. |
VectorNd(Int32)
Initializes a new instance of the VectorNd class. Constructs a zero vector of a given dimension.
Declaration
public VectorNd(int dimension)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dimension | Dimension. |
Properties
| Improve this Doc View SourceDimension
Gets the current dimension of the vector.
Declaration
public int Dimension { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Gets or sets the coordinate at the given dimension.
Declaration
public double this[int dimension] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dimension |
Property Value
Type | Description |
---|---|
System.Double | The value of the specified dimension. |
Length
Gets the length of the vector.
Declaration
public double Length { get; }
Property Value
Type | Description |
---|---|
System.Double |
Length2
Gets the squared length of the vector.
Declaration
public double Length2 { get; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceAdd(VectorNd, VectorNd)
Adds two N dimensional vectors.
Declaration
public static VectorNd Add(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
VectorNd | Vector addition result. |
AngularDistance(VectorNd, VectorNd)
Computes the angular distance between two vectors.
Declaration
public static double AngularDistance(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
System.Double | Angular distance value. |
AngularSimilarity(VectorNd, VectorNd)
Angular similarity value between two vectors.
Declaration
public static double AngularSimilarity(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
System.Double | Angular similarity value. |
CosineSimilarity(VectorNd, VectorNd)
Computes the cosine similarity between two vectors.
Declaration
public static double CosineSimilarity(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
System.Double | Cosine similarity value. |
Distance(VectorNd, VectorNd)
Computes the distance between two N-dimensional vectors.
Declaration
public static double Distance(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
System.Double | Distance between vectors. |
Distance2(VectorNd, VectorNd)
Computes the square distance between two N-dimensional vectors.
Declaration
public static double Distance2(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
System.Double | Squared distance. |
Divide(VectorNd, Double)
Divide an N dimensional vector by a number.
Declaration
public static VectorNd Divide(VectorNd vector, double scalar)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to divide. |
System.Double | scalar | Number to divide by. |
Returns
Type | Description |
---|---|
VectorNd | Vector division result. |
Dot(VectorNd)
Gets the dot product of this vector with another.
Declaration
public double Dot(VectorNd vector)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to compute dot product with. |
Returns
Type | Description |
---|---|
System.Double | Dot product result. |
DotProduct(VectorNd, VectorNd)
Computes the dot product between two vectors.
Declaration
public static double DotProduct(VectorNd vectorA, VectorNd vectorB)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vectorA | Vector A. |
VectorNd | vectorB | Vector B. |
Returns
Type | Description |
---|---|
System.Double |
Equals(VectorNd)
Compare this vector with another.
Declaration
public bool Equals(VectorNd vector)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Comparison result. |
Equals(Object)
Compare this vector with another object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | Comparison result. |
GetEnumerator()
Declaration
public IEnumerator<double> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<System.Double> |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Multiply(VectorNd, Double)
Multiply an N dimensional vector by a number.
Declaration
public static VectorNd Multiply(VectorNd vector, double scalar)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to multiply. |
System.Double | scalar | Number to multiply by. |
Returns
Type | Description |
---|---|
VectorNd | Vector multiplication result. |
Negate(VectorNd)
Negate a given vector.
Declaration
public static VectorNd Negate(VectorNd vector)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector to negate. |
Returns
Type | Description |
---|---|
VectorNd | Vector negation result. |
Substract(VectorNd, VectorNd)
Subtract two N dimensional vectors.
Declaration
public static VectorNd Substract(VectorNd a, VectorNd b)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | a | Vector A. |
VectorNd | b | Vector B. |
Returns
Type | Description |
---|---|
VectorNd | Vector substraction result. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
| Improve this Doc View SourceAddition(VectorNd, VectorNd)
Adds two vectors.
Declaration
public static VectorNd operator +(VectorNd vectorA, VectorNd vectorB)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vectorA | Vector A. |
VectorNd | vectorB | Vector B. |
Returns
Type | Description |
---|---|
VectorNd | Vector result of the addition. |
Division(VectorNd, Double)
Divides a vector by a scalar number.
Declaration
public static VectorNd operator /(VectorNd vector, double scalar)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector. |
System.Double | scalar | Scalar. |
Returns
Type | Description |
---|---|
VectorNd | Vector result of the division. |
Multiply(VectorNd, Double)
Multiplies a vector by a scalar number.
Declaration
public static VectorNd operator *(VectorNd vector, double scalar)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vector | Vector. |
System.Double | scalar | Scalar. |
Returns
Type | Description |
---|---|
VectorNd | Vector result of the multiplication. |
Subtraction(VectorNd, VectorNd)
Subtracts one vector from another.
Declaration
public static VectorNd operator -(VectorNd vectorA, VectorNd vectorB)
Parameters
Type | Name | Description |
---|---|---|
VectorNd | vectorA | Vector A |
VectorNd | vectorB | Vector B |
Returns
Type | Description |
---|---|
VectorNd | Vector result of the subtraction. |