cummin
cummin(A, [dim])
Cumulative minimum along a dimension. The dimension defaults to 1.
Examples
-
Calculate cumulative minimum of a vector:
julia> v = [3, 1, 5, 2, 4]; julia> cummin(v) 5-element Array{Int64,1}: 3 1 1 1 1
This example calculates the cumulative minimum of the vector
v
along the default dimension (dimension 1). -
Calculate cumulative minimum of a matrix along rows:
julia> m = [4 6 3; 2 5 1; 9 7 8]; julia> cummin(m, dims=1) 3×3 Array{Int64,2}: 2 5 1 2 5 1 2 5 1
It calculates the cumulative minimum of the matrix
m
along the rows (dimension 1). - Calculate cumulative minimum of a matrix along columns:
julia> m = [4 6 3; 2 5 1; 9 7 8]; julia> cummin(m, dims=2) 3×3 Array{Int64,2}: 4 4 3 2 2 1 9 7 7
It calculates the cumulative minimum of the matrix
m
along the columns (dimension 2).
Common mistake example:
julia> v = [5, 3, 9];
julia> cummin(v, dims=2)
ERROR: ArgumentError: invalid dimensions for array: 2
In this example, the specified dimension is invalid for a 1-dimensional vector. The cummin
function can only operate along existing dimensions of the given array. Make sure to choose a valid dimension when using cummin
.
See Also
abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.