Skip to content

Move to Infinities.jl #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
matrix:
version:
- '1.5'
- '^1.6.0-0'
os:
- ubuntu-latest
- macOS-latest
Expand Down
8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
name = "ContinuumArrays"
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
version = "0.5.1"
version = "0.6.0"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
ArrayLayouts = "0.5"
ArrayLayouts = "0.5, 0.6"
BandedMatrices = "0.16"
BlockArrays = "0.14"
FillArrays = "0.11"
InfiniteArrays = "0.9"
InfiniteArrays = "0.9, 0.10"
Infinities = "0.0.1, 0.0.2"
IntervalSets = "0.5"
LazyArrays = "0.20"
QuasiArrays = "0.4.1"
Expand Down
49 changes: 1 addition & 48 deletions src/ContinuumArrays.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ContinuumArrays
using IntervalSets, LinearAlgebra, LazyArrays, FillArrays, BandedMatrices, QuasiArrays, InfiniteArrays, StaticArrays, BlockArrays
using IntervalSets, LinearAlgebra, LazyArrays, FillArrays, BandedMatrices, QuasiArrays, Infinities, InfiniteArrays, StaticArrays, BlockArrays
import Base: @_inline_meta, @_propagate_inbounds_meta, axes, getindex, convert, prod, *, /, \, +, -, ==, ^,
IndexStyle, IndexLinear, ==, OneTo, _maybetail, tail, similar, copyto!, copy, diff,
first, last, show, isempty, findfirst, findlast, findall, Slice, union, minimum, maximum, sum, _sum,
Expand All @@ -22,59 +22,12 @@ import InfiniteArrays: Infinity, InfAxes

export Spline, LinearSpline, HeavisideSpline, DiracDelta, Derivative, ℵ₁, Inclusion, Basis, WeightedBasis, grid, transform, affine, ..

####
# Interval indexing support
####
struct AlephInfinity{N} <: Integer end

isone(::AlephInfinity) = false
iszero(::AlephInfinity) = false

==(::AlephInfinity, ::Int) = false
==(::Int, ::AlephInfinity) = false

*(::AlephInfinity{N}, ::AlephInfinity{N}) where N = AlephInfinity{N}()
*(::AlephInfinity{N}, ::Infinity) where N = AlephInfinity{N}()
*(::Infinity, ::AlephInfinity{N}) where N = AlephInfinity{N}()
function *(a::Integer, b::AlephInfinity)
a > 0 || throw(ArgumentError("$a is negative"))
b
end

*(a::AlephInfinity, b::Integer) = b*a


abs(a::AlephInfinity) = a
zero(::AlephInfinity) = 0

for OP in (:<, :≤)
@eval begin
$OP(::Real, ::AlephInfinity) = true
$OP(::AlephInfinity, ::Real) = false
end
end

for OP in (:>, :≥)
@eval begin
$OP(::Real, ::AlephInfinity) = false
$OP(::AlephInfinity, ::Real) = true
end
end


const ℵ₁ = AlephInfinity{1}()

string(::AlephInfinity{1}) = "ℵ₁"

show(io::IO, F::AlephInfinity{1}) where N =
print(io, "ℵ₁")


const QMul2{A,B} = Mul{<:Any, <:Any, <:A,<:B}
const QMul3{A,B,C} = Mul{<:AbstractQuasiArrayApplyStyle, <:Tuple{A,B,C}}

cardinality(::AbstractInterval) = ℵ₁
*(ℵ::AlephInfinity) = ℵ

Inclusion(d::AbstractInterval{T}) where T = Inclusion{float(T)}(d)
first(S::Inclusion{<:Any,<:AbstractInterval}) = leftendpoint(S.domain)
Expand Down
16 changes: 0 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,6 @@ import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, Adj
import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle

@testset "AlephInfinity" begin
@test !isone(ℵ₁)
@test !iszero(ℵ₁)
@test ℵ₁ ≠ 4
@test ℵ₁ * ∞ == ∞ * ℵ₁ == ℵ₁
@test 2 * ℵ₁ == ℵ₁ * 2 == ℵ₁
@test abs(ℵ₁) == ℵ₁
@test zero(ℵ₁) == 0
@test 5 < ℵ₁
@test 5 ≤ ℵ₁
@test !(ℵ₁ ≤ 5)
@test ℵ₁ > 5
@test !(5 > ℵ₁)

@test string(ℵ₁) == "ℵ₁"
end

@testset "Inclusion" begin
x = Inclusion(-1..1)
Expand Down