Skip to content

Commit

Permalink
migrate imports to toplevel
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Dec 10, 2024
1 parent 9d89635 commit 896b906
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 26 deletions.
25 changes: 25 additions & 0 deletions src/UnallocatedArrays.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
module UnallocatedArrays

using TypeParameterAccessors:
TypeParameterAccessors,
Position,
set_eltype,
set_ndims,
set_type_parameter,
type_parameter
using FillArrays:
AbstractFill,
FillArrays,
AbstractZeros,
Fill,
Zeros,
broadcasted_fill,
broadcasted_zeros,
getindex_value,
kron_fill,
kron_zeros,
mult_zeros,
mult_fill
using UnspecifiedTypes: UnspecifiedArray, UnspecifiedNumber, UnspecifiedZero
using Adapt: adapt

include("abstractfill/abstractfill.jl")

include("unallocatedfill.jl")
Expand All @@ -8,4 +32,5 @@ include("abstractunallocatedarray.jl")
include("set_types.jl")

export UnallocatedFill, UnallocatedZeros, alloctype, set_alloctype, allocate

end
2 changes: 0 additions & 2 deletions src/abstractfill/abstractfill.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using FillArrays: AbstractFill
using TypeParameterAccessors: TypeParameterAccessors, Position, type_parameter
## Here are functions specifically defined for UnallocatedArrays
## not implemented by FillArrays
## TODO this might need a more generic name maybe like compute unit
Expand Down
5 changes: 0 additions & 5 deletions src/abstractunallocatedarray.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using Adapt: adapt
using FillArrays: FillArrays, getindex_value
using TypeParameterAccessors: set_eltype, set_ndims

const UnallocatedArray{ElT,N,AxesT,AllocT} = Union{
UnallocatedFill{ElT,N,AxesT,AllocT},UnallocatedZeros{ElT,N,AxesT,AllocT}
}
Expand All @@ -24,7 +20,6 @@ function Base.adjoint(a::UnallocatedArray)
return set_alloctype(adjoint(parent(a)), alloctype(a))
end

using TypeParameterAccessors: set_type_parameter
function set_alloctype(T::Type{<:UnallocatedArray}, alloc::Type{<:AbstractArray})
return set_type_parameter(T, alloctype, alloc)
end
Expand Down
2 changes: 0 additions & 2 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using FillArrays: broadcasted_fill, broadcasted_zeros, getindex_value

abstract type ZeroPreserving end
struct IsZeroPreserving <: ZeroPreserving end
struct NotZeroPreserving <: ZeroPreserving end
Expand Down
3 changes: 0 additions & 3 deletions src/set_types.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using TypeParameterAccessors: TypeParameterAccessors
using UnspecifiedTypes: UnspecifiedArray, UnspecifiedNumber, UnspecifiedZero

function TypeParameterAccessors.default_type_parameters(::Type{<:UnallocatedArray})
return (
UnspecifiedNumber{UnspecifiedZero},
Expand Down
3 changes: 0 additions & 3 deletions src/unallocatedfill.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using FillArrays:
FillArrays, AbstractFill, Fill, broadcasted_fill, getindex_value, kron_fill, mult_fill

struct UnallocatedFill{ElT,N,Axes,Alloc} <: AbstractFill{ElT,N,Axes}
f::Fill{ElT,N,Axes}
alloc::Alloc
Expand Down
11 changes: 0 additions & 11 deletions src/unallocatedzeros.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
using FillArrays:
FillArrays,
AbstractZeros,
Fill,
Zeros,
broadcasted_fill,
broadcasted_zeros,
kron_fill,
kron_zeros,
mult_zeros

## TODO Should Alloc also be of ElT and N or should there be
## More freedom there?
struct UnallocatedZeros{ElT,N,Axes,Alloc} <: AbstractZeros{ElT,N,Axes}
Expand Down

0 comments on commit 896b906

Please sign in to comment.