Skip to content

Changes for InfintieArrays v0.10 #68

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 19, 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
20 changes: 10 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFunBase"
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
version = "0.3.14"
version = "0.4"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand All @@ -27,25 +27,25 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"

[compat]
AbstractFFTs = "0.4, 0.5, 1"
BandedMatrices = "0.14, 0.15, 0.16"
BlockArrays = "0.12.11, 0.13, 0.14"
BlockBandedMatrices = "0.7, 0.8, 0.9, 0.10"
AbstractFFTs = "0.5, 1"
BandedMatrices = "0.16"
BlockArrays = "0.14"
BlockBandedMatrices = "0.10"
Calculus = "0.5"
DSP = "0.6"
DomainSets = "0.4"
DualNumbers = "0.6.2"
FFTW = "0.3, 1"
FastGaussQuadrature = "0.4"
FillArrays = "0.8, 0.9, 0.10, 0.11"
InfiniteArrays = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10"
FillArrays = "0.11"
InfiniteArrays = "0.10"
IntervalSets = "0.5"
LazyArrays = "0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20"
LazyArrays = "0.20"
LowRankApprox = "0.2, 0.3, 0.4"
SpecialFunctions = "0.8, 0.9, 0.10, 1.0"
SpecialFunctions = "0.10, 1.0"
StaticArrays = "0.12, 1.0"
ToeplitzMatrices = "0.6"
julia = "1.3"
julia = "1.5"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
2 changes: 1 addition & 1 deletion src/ApproxFunBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import BlockBandedMatrices: blockbandwidth, blockbandwidths, blockcolstop, block

import FillArrays: AbstractFill, getindex_value
import LazyArrays: cache
import InfiniteArrays: Infinity, InfRanges, AbstractInfUnitRange, OneToInf
import InfiniteArrays: PosInfinity, InfRanges, AbstractInfUnitRange, OneToInf, InfiniteCardinal


# convenience for 1-d block ranges
Expand Down
8 changes: 4 additions & 4 deletions src/LinearAlgebra/helper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ pad(A::AbstractMatrix,::Colon,m::Integer) = pad(A,size(A,1),m)
pad(A::AbstractMatrix,n::Integer,::Colon) = pad(A,n,size(A,2))


function pad(v, ::Infinity)
function pad(v, ::PosInfinity)
if isinf(length(v))
v
else
Vcat(v, Zeros{Int}(∞))
end
end

function pad(v::AbstractVector{T}, ::Infinity) where T
function pad(v::AbstractVector{T}, ::PosInfinity) where T
if isinf(length(v))
v
else
Expand Down Expand Up @@ -530,8 +530,8 @@ slnorm(m::AbstractMatrix,::Colon,j::Integer) = slnorm(m,1:size(m,1),j)



Base.isless(x::Block{1}, y::Infinity) = isless(Int(x), y)
Base.isless(x::Infinity, y::Block{1}) = isless(x, Int(y))
Base.isless(x::Block{1}, y::PosInfinity) = isless(Int(x), y)
Base.isless(x::PosInfinity, y::Block{1}) = isless(x, Int(y))


## BandedMatrix
Expand Down
4 changes: 2 additions & 2 deletions src/Multivariate/TensorSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ end


blockstart(it,K)::Int = K==1 ? 1 : sum(blocklengths(it)[1:K-1])+1
blockstop(it,::Infinity) =
blockstop(it,::PosInfinity) = ℵ₀
_K_sum(bl::AbstractVector, K) = sum(bl[1:K])
_K_sum(bl::Integer, K) = bl
blockstop(it, K)::Int = _K_sum(blocklengths(it), K)
Expand Down Expand Up @@ -453,7 +453,7 @@ end

for OP in (:block,:blockstart,:blockstop)
@eval begin
$OP(s::TensorSpace, ::Infinity) =
$OP(s::TensorSpace, ::PosInfinity) = ℵ₀
$OP(s::TensorSpace, M::Block) = $OP(tensorizer(s),M)
$OP(s::TensorSpace, M) = $OP(tensorizer(s),M)
end
Expand Down
10 changes: 5 additions & 5 deletions src/Operators/Operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ macro functional(FF)
Base.size(A::$FF,k::Integer) = k==1 ? 1 : dimension(domainspace(A))
ApproxFunBase.rangespace(F::$FF) = ConstantSpace(eltype(F))
ApproxFunBase.isafunctional(::$FF) = true
ApproxFunBase.blockbandwidths(A::$FF) = 0,hastrivialblocks(domainspace(A)) ? bandwidth(A,2) :
ApproxFunBase.blockbandwidths(A::$FF) = 0,hastrivialblocks(domainspace(A)) ? bandwidth(A,2) : ℵ₀
function ApproxFunBase.defaultgetindex(f::$FF,k::Integer,j::Integer)
@assert k==1
f[j]::eltype(f)
Expand Down Expand Up @@ -101,7 +101,7 @@ function lastindex(A::Operator, n::Integer)
elseif n==2
size(A,2)
elseif isinf(size(A,2)) || isinf(size(A,1))
ℵ₀
else
size(A,1)
end
Expand Down Expand Up @@ -371,8 +371,8 @@ end
for OP in (:colstart,:colstop,:rowstart,:rowstop)
defOP = Meta.parse("default_"*string(OP))
@eval begin
$OP(A::Operator,i::Integer) = $defOP(A,i)
$OP(A::Operator,i::Infinity) =
$OP(A::Operator, i::Integer) = $defOP(A,i)
$OP(A::Operator, i::PosInfinity) = ℵ₀
end
end

Expand Down Expand Up @@ -461,7 +461,7 @@ macro wrapperstructure(Wrap)
$ret

$func(D::$Wrap,k::Integer) = $func(D.op,k)
$func(A::$Wrap,i::ApproxFunBase.Infinity) = # $func(A.op,i) | see PR #42
$func(A::$Wrap,i::ApproxFunBase.PosInfinity) = ℵ₀ # $func(A.op,i) | see PR #42
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/Operators/SubOperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function view(A::Operator,kr::InfRanges,jr::InfRanges)
jr1=first(jr)
l,u=(bandwidth(A,1)+jr1-kr1)÷st,(bandwidth(A,2)+kr1-jr1)÷st
else
l,u=∞,∞
l,u=ℵ₀,ℵ₀
end
SubOperator(A,(kr,jr),size(A),(l,u))
end
Expand Down
4 changes: 2 additions & 2 deletions src/Operators/general/algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ for TYP in (:Matrix, :BandedMatrix, :RaggedMatrix)

# find optimal truncations for each operator
# by finding the non-zero entries
krlin = Matrix{Union{Int,Infinity}}(undef,length(P.ops),2)
krlin = Matrix{Union{Int,InfiniteCardinal{0}}}(undef,length(P.ops),2)

krlin[1,1],krlin[1,2]=kr[1],kr[end]
for m=1:length(P.ops)-1
Expand Down Expand Up @@ -465,7 +465,7 @@ for TYP in (:BlockBandedMatrix, :BandedBlockBandedMatrix)

# find optimal truncations for each operator
# by finding the non-zero entries
KRlin = Matrix{Union{Block,Infinity}}(undef,length(P.ops),2)
KRlin = Matrix{Union{Block,InfiniteCardinal{0}}}(undef,length(P.ops),2)

KRlin[1,1],KRlin[1,2] = first(KR),last(KR)
for m=1:length(P.ops)-1
Expand Down
4 changes: 2 additions & 2 deletions src/PDE/KroneckerOperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function rowstop(A::KroneckerOperator,k::Integer)
end


bandwidths(K::KroneckerOperator) = (∞,∞)
bandwidths(K::KroneckerOperator) = (ℵ₀,ℵ₀)

isblockbanded(K::KroneckerOperator) = all(isblockbanded,K.ops)
isbandedblockbanded(K::KroneckerOperator) =
Expand All @@ -123,7 +123,7 @@ subblock_blockbandwidths(K::KroneckerOperator) =

# If each block were in turn BandedMatrix, these are the bandwidths
function subblockbandwidths(K::KroneckerOperator)
isbandedblockbanded(K) || return (∞,∞)
isbandedblockbanded(K) || return (ℵ₀,ℵ₀)

if all(hastrivialblocks,domainspace(K).spaces) &&
all(hastrivialblocks,rangespace(K).spaces)
Expand Down
4 changes: 2 additions & 2 deletions src/Spaces/ConstantSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ getindex(f::Fun{SequenceSpace}, k::Integer) =
getindex(f::Fun{SequenceSpace},K::CartesianIndex{0}) = f[1]
getindex(f::Fun{SequenceSpace},K) = cfstype(f)[f[k] for k in K]

length(f::Fun{SequenceSpace}) =
length(f::Fun{SequenceSpace}) = ℵ₀


dotu(f::Fun{SequenceSpace},g::Fun{SequenceSpace}) =
Expand Down Expand Up @@ -171,7 +171,7 @@ rangespace(D::ConcreteMultiplication{CS1,CS2,T}) where {CS1<:ConstantSpace,CS2<:
rangespace(D::ConcreteMultiplication{F,UnsetSpace,T}) where {F<:ConstantSpace,T} =
UnsetSpace()
bandwidths(D::ConcreteMultiplication{F,UnsetSpace,T}) where {F<:ConstantSpace,T} =
(∞,∞)
(ℵ₀,ℵ₀)
getindex(D::ConcreteMultiplication{F,UnsetSpace,T},k::Integer,j::Integer) where {F<:ConstantSpace,T} =
error("No range space attached to Multiplication")

Expand Down
2 changes: 1 addition & 1 deletion src/Spaces/SubSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dimension(sp::SubSpace) = length(sp.indexes)


function |(f::Fun,kr::AbstractInfUnitRange)
@assert dimension(space(f)) == ∞
@assert dimension(space(f)) ≡ ℵ₀
Fun(space(f)|kr,f.coefficients[kr[1]:end])
end

Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ApproxFunBase, LinearAlgebra, Random, Test
import ApproxFunBase: Infinity,
import ApproxFunBase: ∞

@testset "Helper" begin
@testset "interlace" begin
Expand Down