arrays
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
arrays.type
Members list
Extensions
Extensions
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.