Contains the Vector class, which encodes vector quantities of any number of entries in linear algebra.
Author: Zach / cszach@proton.me
Array.<number>
object
number
Vector
boolean
Vector
Vector
Vector
Vector
Vector
Encodes vectors and vector operations. Compatible for use with matrices (e.g. for matrix-vector multiplications).
For optimal performance, use Vector2, Vector3, Vector4 if possible.
Kind: inner class of Vector
Array.<number>
object
number
Vector
boolean
Vector
Vector
Vector
Vector
Vector
Constructs a new Vector
instance, which encodes a vector and its
operations.
Param | Type | Description |
---|---|---|
entries | Array.<number> |
Entries of the new vector. |
Array.<number>
Stores the entries of this vector in order.
Kind: instance property of Vector
object
Contains the dimensions of this vector as an object in the
form { rows, columns }
. Serve for compatibility with matrix classes.
Kind: instance property of Vector
number
The number of entries in this vector.
Kind: instance property of Vector
Vector
Creates and returns a clone of this vector instance.
Kind: instance method of Vector
Returns: Vector
- A clone of this vector
boolean
Checks if this vector and another vector are equal.
Kind: instance method of Vector
Returns: boolean
- true
if the two vectors are equal, false
otherwise
Param | Type | Description |
---|---|---|
vector | Vector |
The vector to compare this vector to. |
Vector
Multiplies this vector by a scalar.
Kind: instance method of Vector
Returns: Vector
- This vector
Param | Type | Description |
---|---|---|
k | number |
The scalar to multiply this vector by. |
Vector
Multiplies this vector by -1.
Kind: instance method of Vector
Returns: Vector
- This vector
Vector
Adds a vector to this vector.
Kind: instance method of Vector
Returns: Vector
- This vector
Param | Type | Description |
---|---|---|
vector | Vector |
The vector to add to this vector. |
Vector
Subtracts a vector from this vector.
Kind: instance method of Vector
Returns: Vector
- This vector
Param | Type | Description |
---|---|---|
vector | Vector |
The vector to subtract this vector to. |
Vector
Returns the dot product of this vector and another vector.
Kind: instance method of Vector
Returns: Vector
- The dot product of this vector and the given vector
Param | Type | Description |
---|---|---|
vector | Vector |
The vector to perform a dot product with this vector. |