ArrayAllez.Array_
— Methodsimilar_(name, A) ≈ similar(A)
Array_{T}(name, size) ≈ Array{T}(undef, size)
New arrays for intermediate results, drawn from an LRU cache when length(A) >= 2000
. The cache's key uses name::Symbol
as well as type & size to ensure different uses don't collide.
copy_(name, A) = copyto!(similar_(name, A), A)
Just like that.
ArrayAllez.copy_
— Methodsimilar_(name, A) ≈ similar(A)
Array_{T}(name, size) ≈ Array{T}(undef, size)
New arrays for intermediate results, drawn from an LRU cache when length(A) >= 2000
. The cache's key uses name::Symbol
as well as type & size to ensure different uses don't collide.
copy_(name, A) = copyto!(similar_(name, A), A)
Just like that.
ArrayAllez.exp!
— Functionexp!(A)
exp_(A) = exp!(similar(A), A)
exp0(A) ≈ exp.(A)
Element-wise in-place exponential, and friends. Multi-threaded when length(A) >= 5000
. Will be handled by Yeppp
or AppleAccelerate
or IntelVectorMath
if you load one of them, note that Yeppp
may well be slower.
ArrayAllez.exp_
— Methodexp!(A)
exp_(A) = exp!(similar(A), A)
exp0(A) ≈ exp.(A)
Element-wise in-place exponential, and friends. Multi-threaded when length(A) >= 5000
. Will be handled by Yeppp
or AppleAccelerate
or IntelVectorMath
if you load one of them, note that Yeppp
may well be slower.
ArrayAllez.inv!
— Functioninv!(A) ≈ 1 ./ A
inv!(A, b::Number) ≈ b ./ A
And inv_(A)
which copies, and inv0(A)
simple broadcasting. Multi-threaded when length(A) >= 100000
. Will be handled by AppleAccelerate
if you load it.
ArrayAllez.inv_
— Functioninv!(A) ≈ 1 ./ A
inv!(A, b::Number) ≈ b ./ A
And inv_(A)
which copies, and inv0(A)
simple broadcasting. Multi-threaded when length(A) >= 100000
. Will be handled by AppleAccelerate
if you load it.
ArrayAllez.iscale!
— Functioniscale!(A, b::Number) ≈ A ./ b
iscale!(A, v::Vector) ≈ A ./ v # A::Matrix
iscale!(A, r::Adjoint) ≈ A ./ r # r::RowVector / Transpose etc.
iscale!(A, B) ≈ A ./ B
For each of these, there is also iscale_(A, ...)
non-mutating but perhaps accellerated, and iscale0(A, ...)
simple broadcasting. Finally there is iscale!!(A, x)
which mutate both arguments, wihch may be a terrible idea.
ArrayAllez.iscale_
— Methodiscale!(A, b::Number) ≈ A ./ b
iscale!(A, v::Vector) ≈ A ./ v # A::Matrix
iscale!(A, r::Adjoint) ≈ A ./ r # r::RowVector / Transpose etc.
iscale!(A, B) ≈ A ./ B
For each of these, there is also iscale_(A, ...)
non-mutating but perhaps accellerated, and iscale0(A, ...)
simple broadcasting. Finally there is iscale!!(A, x)
which mutate both arguments, wihch may be a terrible idea.
ArrayAllez.log!
— Functionlog!(A)
log_(A) ≈ log!(similar(A), A)
log0(A) = log.(A)
Element-wise in-place natural logarithm, and friends. Multi-threaded when length(A) >= 5000
. Will be handled by Yeppp
or AppleAccelerate
or IntelVectorMath
if you load one of them.
ArrayAllez.log_
— Methodlog!(A)
log_(A) ≈ log!(similar(A), A)
log0(A) = log.(A)
Element-wise in-place natural logarithm, and friends. Multi-threaded when length(A) >= 5000
. Will be handled by Yeppp
or AppleAccelerate
or IntelVectorMath
if you load one of them.
ArrayAllez.scale!
— Functionscale!(A, b::Number) ≈ A .* b
scale!(M, v::Vector) ≈ A .* v # M::Matrix
scale!(M, r::Adjoint) ≈ A .* r # r::RowVector / Transpose etc.
scale!(A, B) ≈ A .* B # A,B same ndims
In-place scaling by a constant or (in the case of a matrix) by a row- or column-vector. For each of these, there is also also scale_(A, ...)
non-mutating but perhaps accellerated, and scale0(A, ...)
simple broadcasting.
ArrayAllez.scale_
— Methodscale!(A, b::Number) ≈ A .* b
scale!(M, v::Vector) ≈ A .* v # M::Matrix
scale!(M, r::Adjoint) ≈ A .* r # r::RowVector / Transpose etc.
scale!(A, B) ≈ A .* B # A,B same ndims
In-place scaling by a constant or (in the case of a matrix) by a row- or column-vector. For each of these, there is also also scale_(A, ...)
non-mutating but perhaps accellerated, and scale0(A, ...)
simple broadcasting.
ArrayAllez.similar_
— Methodsimilar_(name, A) ≈ similar(A)
Array_{T}(name, size) ≈ Array{T}(undef, size)
New arrays for intermediate results, drawn from an LRU cache when length(A) >= 2000
. The cache's key uses name::Symbol
as well as type & size to ensure different uses don't collide.
copy_(name, A) = copyto!(similar_(name, A), A)
Just like that.
ArrayAllez.@dropdims
— Macro@dropdims sum(A; dims=1)
Macro which wraps such reductions in dropdims(...; dims=1)
. Allows sum(A; dims=1) do x stuff end
, and works on whole blocks of code like @views
. Does not handle other keywords, like reduce(...; dims=..., init=...)
.
ArrayAllez.@threads
— MacroThis is the replacement for Julia's @threads
macro proposed in https://github.com/JuliaLang/julia/pull/35003