# cummin

cummin(A, [dim])

Cumulative minimum along a dimension. The dimension defaults to 1.

## Examples

1. 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).

2. 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).

3. 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`.