Vector Class |
Namespace: Algs4Net
public class Vector
The Vector type exposes the following members.
Name | Description | |
---|---|---|
Vector(Double) |
Initializes a vector from either an array or a vararg list.
The vararg syntax supports a constructor that takes a variable number of
arugments such as Vector x = new Vector(1.0, 2.0, 3.0, 4.0). | |
Vector(Int32) | Initializes a d-dimensional zero vector. |
Name | Description | |
---|---|---|
Dimension |
Returns the dimension of this vector. | |
Length |
Returns the length (dimenstion) of this vector. For better semantics, use Dimension |
Name | Description | |
---|---|---|
Cartesian |
Returns the ith cartesian coordinate. | |
Direction |
Returns a unit vector in the direction of this vector. | |
DistanceTo |
Returns the Euclidean distance between this vector and the specified vector. | |
Dot |
Returns the do product of this vector with the specified vector. | |
Magnitude |
Returns the magnitude of this vector.
This is also known as the L2 norm or the Euclidean norm. | |
MainTest |
Demo test the Vector data type. | |
Minus |
Returns the difference between this vector and the specified vector. | |
Plus |
Returns the sum of this vector and the specified vector. | |
Scale |
Returns the scalar-vector product of this vector and the specified scalar | |
Times |
Returns the scalar-vector product of this vector and the specified scalar.
Use Scale(Double) for better semantics. | |
ToString |
Returns a string representation of this vector. (Overrides ObjectToString.) |
For additional documentation, see Section 1.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class Vector implementation by the respective authors.