Utils

CosmoParticles.product_preserve_typeFunction
CosmoParticles.product_preserve_type(arr::AbstractArray{T}, b::Real) where {T}

Multiply an array with a scalar while preserving the element type of the array.

For unitful arrays, the scalar factor is converted to the number type of the quantity before multiplying.

This is not exported.

source
CosmoParticles.product_preserve_type!Function
CosmoParticles product_preserve_type!(arr::AbstractArray{T}, b::Real) where {T}

Multiply an array with a scalar in-place while preserving the element type of the array.

By converting the scalar factor to the array element type, this can be more performant than a normal broadcasted product. For unitful arrays, the scalar factor is converted to the number type of the quantity before multiplying.

This is not exported.

source
CosmoParticles.ustrip_lazyFunction
CosmoParticles.ustrip_lazy([unit,] a::Number)
CosmoParticles.ustrip_lazy([unit,] a::AbstractArray)
CosmoParticles.ustrip_lazy!(unit, a::AbstractArray)

Strips off the units of unitful arrays in a performant way while keeping the number type conserved (not always the case for ustrip).

Like ustrip for normal unitful arrays, but without reallocating non-unitful or lazy arrays.

Note that after calling this method with a different conversion unit, the original array still has the old units, but the numerical values correspond to the new units. This method should always be called as a = uconvert_lazy!(u, a).

This is not exported.

source
CosmoParticles.uconvert_lazyFunction
CosmoParticles.uconvert_lazy(u::Unitful.Units, a::AbstractArray{<:Quantity})

Converts the unitful array to the given units while preserving the number type passed (not always the case for uconvert).

This is not exported.

source
CosmoParticles.uconvert_lazy!Function
CosmoParticles.uconvert_lazy!(u::Unitful.Units, a::AbstractArray{<:Quantity{T,D,U}}) where {T,D,U}

Converts the unitful array to the specified units in-place.

Note that after calling this method the original array still has the old units, but the numerical values correspond to the new units. This method should always be called as a = uconvert_lazy!(u, a).

This is not exported.

source