Constructor
new Vector(data)
- Description:
Initializes a Vector from a size, an existing array, or another Vector.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
data |
number | Array.<(number|string|BigFloat)> | Vector |
Classes
Members
length
Dimension of the vector.
Methods
add(other) → {Vector}
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Vector |
Returns:
- Type
- Vector
clone() → {Vector}
Returns:
- Type
- Vector
dot(other) → {BigFloat}
- Description:
Computes the dot product of this vector and another vector.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Vector |
Returns:
- Type
- BigFloat
get(i) → {BigFloat}
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number |
Returns:
- Type
- BigFloat
norm() → {BigFloat}
Returns:
- Type
- BigFloat
scale(scalar) → {Vector}
Parameters:
| Name | Type | Description |
|---|---|---|
scalar |
number | string | BigFloat |
Returns:
- Type
- Vector
set(i, val)
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number | |
val |
number | string | BigFloat |
sub(other) → {Vector}
- Description:
Subtracts another vector from this vector (v = this - other).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Vector |
Returns:
- Type
- Vector
toArray() → {Array.<BigFloat>}
- Description:
Converts the vector to a standard Javascript Array of BigFloats.
- Source:
Returns:
- Type
- Array.<BigFloat>
toString(radix, prec, maxItem) → {string}
- Description:
Returns a string representation of the vector. Truncates the middle part with "..." if the length exceeds maxItem.
- Source:
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
radix |
number |
10
|
The base for number representation (e.g., 10). |
prec |
number |
2
|
The number of decimal places for BigFloat. |
maxItem |
number |
10
|
Maximum number of elements to show before truncating. |
Returns:
- Type
- string