(array: number[]|Float32Array)
| 59 | * @return minimum value. |
| 60 | */ |
| 61 | export function min(array: number[]|Float32Array): number { |
| 62 | // same behavior as tf.min() |
| 63 | if (array.length === 0) { |
| 64 | return Number.NaN; |
| 65 | } |
| 66 | let min = Number.POSITIVE_INFINITY; |
| 67 | for (let i = 0; i < array.length; i++) { |
| 68 | const value = array[i]; |
| 69 | if (value < min) { |
| 70 | min = value; |
| 71 | } |
| 72 | } |
| 73 | return min; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Compute maximum value. |
no outgoing calls
no test coverage detected