Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ContinuumArrays"
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
version = "0.20.3"
version = "0.20.4"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
3 changes: 3 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ weaklaplacian

## Routines

```@docs
affine
```
```@docs
transform
```
Expand Down
7 changes: 6 additions & 1 deletion src/ContinuumArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using IntervalSets, DomainSets, LinearAlgebra, LazyArrays, FillArrays, BandedMat
import Base: @_inline_meta, @_propagate_inbounds_meta, axes, size, getindex, convert, prod, *, /, \, +, -, ==, ^,
IndexStyle, IndexLinear, ==, OneTo, tail, similar, copyto!, copy, diff,
first, last, show, isempty, findfirst, findlast, findall, Slice, union, minimum, maximum, extrema, sum, _sum, _maximum, _minimum,
getproperty, isone, iszero, zero, abs, <, ≤, >, ≥, string, summary, to_indices, view, @propagate_inbounds
getproperty, isone, iszero, zero, abs, <, ≤, >, ≥, string, summary, to_indices, view, @propagate_inbounds, collect
import Base.Broadcast: materialize, BroadcastStyle, broadcasted, Broadcasted
import LazyArrays: MemoryLayout, Applied, ApplyStyle, flatten, _flatten, colsupport, combine_mul_styles, AbstractArrayApplyStyle,
adjointlayout, arguments, _mul_arguments, call, broadcastlayout, layout_getindex, UnknownLayout,
Expand Down Expand Up @@ -37,6 +37,7 @@ cardinality(::AbstractInterval) = ℵ₁
cardinality(::Union{FullSpace{<:AbstractFloat},EuclideanDomain,DomainSets.RealNumbers,DomainSets.ComplexNumbers}) = ℵ₁
cardinality(::Union{DomainSets.Integers,DomainSets.Rationals,DomainSets.NaturalNumbers}) = ℵ₀

Inclusion(d::ProductDomain{T}) where T = Inclusion{float(T)}(d)
Inclusion(d::AbstractInterval{T}) where T = Inclusion{float(T)}(d)
first(S::Inclusion{<:Any,<:AbstractInterval}) = leftendpoint(S.domain)
last(S::Inclusion{<:Any,<:AbstractInterval}) = rightendpoint(S.domain)
Expand Down Expand Up @@ -102,6 +103,10 @@ checkpoints(d::AbstractInterval{T}) where T = width(d) .* SVector{3,float(T)}(0.
checkpoints(d::UnionDomain) = mapreduce(checkpoints,union,d.domains)
checkpoints(x::Inclusion) = checkpoints(x.domain)
checkpoints(A::AbstractQuasiMatrix) = checkpoints(axes(A,1))
function checkpoints(P::ProductDomain)
x,y = map(checkpoints, components(P))
SVector.(x, y')
end


include("operators.jl")
Expand Down
4 changes: 3 additions & 1 deletion src/bases/bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ function expand(v)
end



expand(g::Base.Generator{<:Inclusion}) = expand(g.f.(g.iter))
expand(g::Base.Generator{<:Domain}) = expand(Base.Generator(g.f, Inclusion(g.iter)))
expand(g::Base.Generator{<:Base.Iterators.ProductIterator{<:Tuple{Vararg{Domain}}}}) = expand(Base.Generator(g.f, ×(g.iter.iterators...)))


@inline copy(L::Ldiv{<:AbstractBasisLayout}) = basis_ldiv_size(size(L), L.A, L.B)
Expand Down
7 changes: 7 additions & 0 deletions src/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ end
first(A::AffineMap{T}) where T = convert(T, first(A.range))::T
last(A::AffineMap{T}) where T = convert(T, last(A.range))::T

"""
affine(a, b)

constructs a quasivector corresponding to the affine map between two domains/quasivectors. For example:

affine(1..2, 2..3)[1.5] == 2.5
"""
affine(a::AbstractQuasiVector, b::AbstractQuasiVector) = AffineMap(a, b)
affine(a, b::AbstractQuasiVector) = affine(Inclusion(a), b)
affine(a::AbstractQuasiVector, b) = affine(a, Inclusion(b))
Expand Down
5 changes: 5 additions & 0 deletions test/test_chebyshev.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,9 @@ Base.:(==)(::FooBasis, ::FooBasis) = true
@test_throws ErrorException maximum(exp.(x))
@test_throws ErrorException minimum(exp.(x))
end

@testset "generator" begin
@test expand(exp(t) for t in -1..1)[0.1] ≈ [exp(t) for t in -1..1][0.1] ≈ exp(0.1)
@test [exp(x*cos(y)) for x in Inclusion(0:0.5:1), y in Inclusion(1:0.5:2)][0.5,1.5] ≈ exp(0.5*cos(1.5))
end
end
Loading