# sumabs2(A,dims)

sumabs2(A, dims)

Sum squared absolute values of elements of an array over the given dimensions.

## Examples

1. Calculate the sum of squared absolute values of an array:

``````julia> arr = [1, -2, 3, -4, 5];
julia> sumabs2(arr)
55``````

This example calculates the sum of squared absolute values of all elements in the array `arr`.

2. Calculate the sum of squared absolute values of a range:

``````julia> rng = -5:5;
julia> sumabs2(rng)
110``````

It calculates the sum of squared absolute values of all elements in the range `-5:5`.

3. Calculate the sum of squared absolute values of a vector of complex numbers:
``````julia> complex_nums = [1+2im, -3+4im, 5-6im];
julia> sumabs2(complex_nums)
147.0``````

It computes the sum of squared absolute values of all elements in the vector of complex numbers.

Common mistake example:

``````julia> my_tuple = (1, 2, 3);
julia> sumabs2(my_tuple)
ERROR: MethodError: no method matching sumabs2(::Tuple{Int64, Int64, Int64})``````

In this example, the `sumabs2` function cannot be applied to a tuple. It only works on collections like arrays, ranges, or vectors. Make sure to provide a valid collection as an argument to `sumabs2`.