Skip to content

Commit 602610b

Browse files
committed
AxisArray -> QuasiArray, added delta function
1 parent 354fec7 commit 602610b

File tree

13 files changed

+418
-348
lines changed

13 files changed

+418
-348
lines changed

src/ContinuumArrays.jl

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
module ContinuumArrays
2-
include("axisarrays/AbstractAxisArrays.jl")
3-
using .AbstractAxisArrays
2+
using IntervalSets, LinearAlgebra, LazyArrays
3+
import Base: @_inline_meta, axes, getindex, convert, prod, *, /, \, +, -,
4+
IndexStyle, IndexLinear
5+
import Base.Broadcast: materialize
46

7+
include("QuasiArrays/QuasiArrays.jl")
8+
using .QuasiArrays
9+
import .QuasiArrays: _length, checkindex, Adjoint, Transpose
10+
11+
export Spline, LinearSpline, HeavisideSpline, DiracDelta
512

613
####
714
# Interval indexing support
815
####
16+
struct AlephInfinity{N} <: Integer end
17+
18+
const ℵ₁ = AlephInfinity{1}()
919

10-
using IntervalSets
11-
import .AbstractAxisArrays: _length, checkindex, Adjoint, Transpose
12-
import Base: @_inline_meta
1320

14-
struct ℵ₀ <: Number end
15-
_length(::AbstractInterval) = ℵ₀
21+
_length(::AbstractInterval) = ℵ₁
22+
*(ℵ::AlephInfinity) =
23+
1624

1725
checkindex(::Type{Bool}, inds::AbstractInterval, i::Real) = (leftendpoint(inds) <= i) & (i <= rightendpoint(inds))
1826
function checkindex(::Type{Bool}, inds::AbstractInterval, I::AbstractArray)
@@ -24,4 +32,7 @@ function checkindex(::Type{Bool}, inds::AbstractInterval, I::AbstractArray)
2432
b
2533
end
2634

35+
include("operators.jl")
36+
include("bases/bases.jl")
37+
2738
end

src/axisarrays/AbstractAxisArrays.jl renamed to src/QuasiArrays/QuasiArrays.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
module AbstractAxisArrays
1+
module QuasiArrays
22
using Base, LinearAlgebra, LazyArrays
33
import Base: getindex, size, axes, length, ==, isequal, iterate, CartesianIndices, LinearIndices,
44
Indices, IndexStyle, getindex, setindex!, parent, vec, convert, similar, zero,
55
map, eachindex, eltype
66
import Base: @_inline_meta, DimOrInd, OneTo, @_propagate_inbounds_meta, @_noinline_meta,
77
DimsInteger, error_if_canonical_getindex, @propagate_inbounds, _return_type, _default_type,
88
_maybetail, tail, _getindex, _maybe_reshape, index_ndims, _unsafe_getindex,
9-
index_shape, to_shape, unsafe_length, @nloops, @ncall
9+
index_shape, to_shape, unsafe_length, @nloops, @ncall, Slice
1010
import Base: ViewIndex, Slice, ScalarIndex, RangeIndex
1111
import Base: *, /, \, +, -, inv
1212

13+
import Base.Broadcast: materialize
14+
1315
import LinearAlgebra: transpose, adjoint, checkeltype_adjoint, checkeltype_transpose
1416

1517
import LazyArrays: MemoryLayout, UnknownLayout
1618

17-
export AbstractAxisArray, AbstractAxisMatrix, AbstractAxisVector, materialize
19+
export AbstractQuasiArray, AbstractQuasiMatrix, AbstractQuasiVector, materialize
1820

19-
abstract type AbstractAxisArray{T,N} end
20-
AbstractAxisVector{T} = AbstractAxisArray{T,1}
21-
AbstractAxisMatrix{T} = AbstractAxisArray{T,2}
22-
AbstractAxisVecOrMat{T} = Union{AbstractAxisVector{T}, AbstractAxisMatrix{T}}
21+
abstract type AbstractQuasiArray{T,N} end
22+
AbstractQuasiVector{T} = AbstractQuasiArray{T,1}
23+
AbstractQuasiMatrix{T} = AbstractQuasiArray{T,2}
24+
AbstractQuasiVecOrMat{T} = Union{AbstractQuasiVector{T}, AbstractQuasiMatrix{T}}
2325

2426

2527
_length(d) = length(d)
2628

27-
size(A::AbstractAxisArray) = _length.(axes(A))
28-
axes(A::AbstractAxisArray) = error("Override axes for $(typeof(A))")
29+
size(A::AbstractQuasiArray) = _length.(axes(A))
30+
axes(A::AbstractQuasiArray) = error("Override axes for $(typeof(A))")
2931

3032
include("indices.jl")
31-
include("abstractaxisarray.jl")
33+
include("abstractquasiarray.jl")
3234
include("multidimensional.jl")
3335
include("subarray.jl")
3436
include("matmul.jl")

0 commit comments

Comments
 (0)