maxabs!

maxabs!(r, A)

Compute the maximum absolute values over the singleton dimensions of r, and write values to r.

Examples

julia> r = [0, 0, 0];
julia> A = [-3, 2, -5];
julia> maxabs!(r, A)
3-element Array{Int64,1}:
 3
 2
 5

This example calculates the maximum absolute values of the elements in array A and writes the results to array r. The resulting array r contains the maximum absolute values for each corresponding element in A.

julia> r = [0, 0, 0];
julia> A = [1, -2, 3];
julia> maxabs!(r, A)
3-element Array{Int64,1}:
 1
 2
 3

In this case, since all the elements in A are positive or zero, the resulting array r will be the same as A itself.

Common mistake example:

julia> r = [0, 0, 0];
julia> A = [1, -2, 3];
julia> maxabs!(r, A')
ERROR: DimensionMismatch("arrays could not be broadcast to a common size")

In this example, the dimensions of r and A' (transpose of A) do not match, resulting in a DimensionMismatch error. Make sure to provide compatible arrays to the maxabs! function to avoid such errors.

See Also

cummax, eigmax, findmax, hist, hist!, hist2d, hist2d!, histrange, indmax, maxabs, maxabs!, maximum!, mean, mean!, median, median!, minabs, minabs!, minimum!, minmax, quantile!, realmax, std, stdm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: