From a95f35507a5c88abfae3eadc9df98f5a14dcbc62 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Mon, 27 Aug 2018 17:47:29 +0100 Subject: [PATCH] Update README --- README.md | 145 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 134 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1fb9e78..0d942ea 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,140 @@ [![codecov](https://codecov.io/gh/JuliaApproximation/InfiniteArrays.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaApproximation/InfiniteArrays.jl) -A Julia package for representing infinite-dimensional arrays +A Julia package for representing infinite-dimensional arrays, designed to work +with other array types. Infinite arrays are by necessity lazy, and so this +package is closely linked to [LazyArrays.jl](https://github.com/JuliaArrays/LazyArrays.jl). +The package currently supports construction, but future versions will include +support for linear algebra operations like matrix multiplication, LU decompositions, +and QR decompositions. + + +Here are some examples of current functionality: -This is a WIP package. When finished, the following behaviour should work: ```julia -B = Ones(1,∞) # creates 1 x ∞ InfMatrix of all ones -T = diagm(Fill(0.5,∞)) + diagm(Fill(-0.5,∞),2) # a Toeplitz operator -e₁ = [1; Zeros(∞)] # a PaddedInfVector -(e₁*e₁')/2 # a PaddedInfMatrix: it knows to manipulate on the data -C = T + (e₁*e₁')/2 # a PlusInfMatrix, it adds the rank-1 perturbation lazily -D = diagm(1:∞,1) # Chebyshev derivative, represented as a Diagonal{<:InfUnitRange} -A = [B; D+C] # A ConcatenatedInfMatrix -u = A \ [2; Zeros(∞)] # Finds Chebyshev coefficients of solution to u'+u = 0, u(1) = 2, using adaptive QR -``` +julia> using InfiniteArrays, LinearAlgebra + +julia> x = Ones(∞) # infinite vector of all ones +Ones{Float64,1,Tuple{InfiniteArrays.Infinity}} with indices OneToInf(): + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + ⋮ + +julia> cumsum(x) # infinite sum +1.0:1.0:+∞ + +julia> exp.(-(1:∞)) .+ 2 # broadcasting supported +BroadcastArray{Float64,1,Base.Broadcast.Broadcasted{LazyArrays.LazyArrayStyle{1},Tuple{InfiniteArrays.OneToInf{Int64}},typeof(+),Tuple{BroadcastArray{Float64,1,Base.Broadcast.Broadcasted{LazyArrays.LazyArrayStyle{1},Tuple{InfiniteArrays.OneToInf{Int64}},typeof(exp),Tuple{InfiniteArrays.InfStepRange{Int64,Int64}}}},Int64}}} with indices OneToInf(): + 2.3678794411714423 + 2.135335283236613 + 2.049787068367864 + 2.018315638888734 + 2.0067379469990856 + 2.0024787521766663 + 2.0009118819655547 + 2.0003354626279024 + 2.0001234098040865 + 2.0000453999297623 + 2.0000167017007904 + 2.000006144212353 + 2.000002260329407 + 2.000000831528719 + 2.0000003059023204 + 2.0000001125351745 + 2.0000000413993773 + 2.00000001522998 + 2.0000000056027964 + 2.0000000020611535 + 2.000000000758256 + 2.0000000002789466 + 2.000000000102619 + 2.000000000037751 + 2.000000000013888 + 2.0000000000051092 + ⋮ + +julia> Diagonal(1:∞) # combines well with Base arrays +Diagonal{Int64,InfiniteArrays.InfUnitRange{Int64}} with indices OneToInf()×OneToInf(): + 1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … + ⋅ 2 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ 3 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ 4 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ 5 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ 6 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 7 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 8 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 9 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 10 ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 11 ⋅ ⋅ ⋅ ⋅ … + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 12 ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 13 ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 14 ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 15 + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ + ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … + ⋮ ⋮ ⋮ ⋱ + + julia> C = cache(Ones(∞)); C[1] = 3; C # Use cache to make mutable +LazyArrays.CachedArray{Float64,1,Array{Float64,1},Ones{Float64,1,Tuple{InfiniteArrays.Infinity}}} with indices OneToInf(): + 3.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + 1.0 + ⋮ + ```