arrays
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
arrays.type
Members list
Extensions
Extensions
Returns the index of the maximum element in the array using SIMD operations for performance.
Returns the index of the maximum element in the array using SIMD operations for performance.
This method processes the array in blocks to maximize instruction-level parallelism (ILP) and minimize synchronization overhead.
https://en.algorithmica.org/hpc/algorithms/argmin/
For small arrays, perhaps 2x slower. For larger arrays (e.g. 1000 elements, at least 2x faster)
Attributes
- Returns
-
The index of the maximum element, or -1 if the array is empty.
Returns the index of the minimum element in the array using SIMD operations for performance.
Returns the index of the minimum element in the array using SIMD operations for performance.
This method processes the array in blocks to maximize instruction-level parallelism (ILP) and minimize synchronization overhead.
For small arrays, perhaps 2x slower. For larger arrays (e.g. 1000 elements, at least 2x faster)
Attributes
- Returns
-
The index of the minimum element, or -1 if the array is empty.
Clamps the values in the array to a specified range.
Clamps the values in the array to a specified range.
Value parameters
- ceil
-
The maximum value to clamp to.
- floor
-
The minimum value to clamp to.
Attributes
- Returns
-
A new array with values clamped to the specified range.
Clamps the values in the array to a maximum value.
Clamps the values in the array to a maximum value.
Value parameters
- floor
-
The maximum value to clamp to.
Attributes
- Returns
-
A new array with values clamped to the specified maximum.
Clamps the values in the array to a minimum value.
Clamps the values in the array to a minimum value.
Value parameters
- ceil
-
The minimum value to clamp to.
Attributes
- Returns
-
A new array with values clamped to the specified minimum.
The formula for the logarithm of the sum of exponentials is:
The formula for the logarithm of the sum of exponentials is:
logSumExp(x) = log(sum(exp(x_i))) for i = 1 to n
This is computed in a numerically stable way by subtracting the maximum value in the array before taking the exponentials:
logSumExp(x) = max(x) + log(sum(exp(x_i - max(x)))) for i = 1 to n
Attributes
Given an array nums
of n integers where n > 1, returns an array output
such that output[i]
is equal to the product of all the elements of nums
except nums[i]
.
Given an array nums
of n integers where n > 1, returns an array output
such that output[i]
is equal to the product of all the elements of nums
except nums[i]
.
This method does not use division and runs in O(n) time complexity.
Value parameters
- nums
-
An array of integers.
Attributes
- Returns
-
An array where each element is the product of all the elements of
nums
except the element at the same index.