Contains the Vector class, which encodes vector quantities of any number of entries in linear algebra.
Author: Zach / cszach@proton.me
Array.<number>objectnumberVectorbooleanVectorVectorVectorVectorVectorEncodes 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>objectnumberVectorbooleanVectorVectorVectorVectorVectorConstructs 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
objectContains the dimensions of this vector as an object in the
form { rows, columns }. Serve for compatibility with matrix classes.
Kind: instance property of Vector
numberThe number of entries in this vector.
Kind: instance property of Vector
VectorCreates and returns a clone of this vector instance.
Kind: instance method of Vector
Returns: Vector - A clone of this vector
booleanChecks 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. |
VectorMultiplies 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. |
VectorMultiplies this vector by -1.
Kind: instance method of Vector
Returns: Vector - This vector
VectorAdds 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. |
VectorSubtracts 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. |
VectorReturns 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. |