代写代考 Untitled18

Untitled18

Copyright By PowCoder代写 加微信 powcoder

using InfiniteArrays, LinearAlgebra, BandedMatrices, InfiniteLinearAlgebra

] add InfiniteLinearAlgebra

Resolving package versions…
Updating `~/.julia/environments/v1.7/Project.toml`
[cde9dba0] + InfiniteLinearAlgebra v0.6.5
No Changes to `~/.julia/environments/v1.7/Manifest.toml`

exp.(x) |> typeof

BroadcastVector{Float64, typeof(exp), Tuple{InfUnitRange{Int64}}} (alias for BroadcastArray{Float64, 1, typeof(exp), Tuple{InfiniteArrays.InfUnitRange{Int64}}})

B = BandedMatrix(2 => 1 ./(exp.(x) .+ 1), 0 => 2:∞, -2 => Fill(2,∞))

ℵ₀×ℵ₀ BandedMatrix{Float64} with bandwidths (2, 2) with data (5×3 Matrix{Float64}) * (vcat(hcat(1×2 Zeros{Float64}, 1×ℵ₀ InfiniteArrays.ReshapedArray{Float64, 2, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{Int64, LazyArrays.BroadcastVector{Float64, typeof(+), Tuple{LazyArrays.BroadcastVector{Float64, typeof(exp), Tuple{InfiniteArrays.InfUnitRange{Int64}}}, Int64}}}}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(1)×OneToInf(), hcat(1×0 Zeros{Float64}, 1×ℵ₀ InfiniteArrays.ReshapedArray{Int64, 2, InfiniteArrays.InfUnitRange{Int64}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(1)×OneToInf(), 1×ℵ₀ Fill{Int64, 2, Tuple{Base.OneTo{Int64}, InfiniteArrays.OneToInf{Int64}}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(3)×OneToInf()) with indices Base.OneTo(5)×OneToInf() with indices OneToInf()×OneToInf():
2.0 0.0 0.119203 ⋅ …
0.0 3.0 0.0 0.0474259
2.0 0.0 4.0 0.0
⋅ 2.0 0.0 5.0
⋅ ⋅ 2.0 0.0
⋅ ⋅ ⋅ 2.0 …
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ …
⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅
⋮ ⋱

ℵ₀×ℵ₀ MatrixFactorizations.QRPackedQ{Float64, InfiniteLinearAlgebra.AdaptiveQRFactors{Float64, BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, BandedMatrix{Float64, LazyArrays.ApplyArray{Float64, 2, typeof(*), Tuple{Matrix{Float64}, LazyArrays.ApplyArray{Float64, 2, typeof(vcat), Tuple{LazyArrays.ApplyArray{Float64, 2, typeof(hcat), Tuple{Zeros{Float64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, InfiniteArrays.ReshapedArray{Float64, 2, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{Int64, LazyArrays.BroadcastVector{Float64, typeof(+), Tuple{LazyArrays.BroadcastVector{Float64, typeof(exp), Tuple{InfiniteArrays.InfUnitRange{Int64}}}, Int64}}}}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}}}}, Fill{Int64, 2, Tuple{Base.OneTo{Int64}, InfiniteArrays.OneToInf{Int64}}}}}}}, InfiniteArrays.OneToInf{Int64}}}, InfiniteLinearAlgebra.AdaptiveQRTau{Float64, BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, BandedMatrix{Float64, LazyArrays.ApplyArray{Float64, 2, typeof(*), Tuple{Matrix{Float64}, LazyArrays.ApplyArray{Float64, 2, typeof(vcat), Tuple{LazyArrays.ApplyArray{Float64, 2, typeof(hcat), Tuple{Zeros{Float64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, InfiniteArrays.ReshapedArray{Float64, 2, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{Int64, LazyArrays.BroadcastVector{Float64, typeof(+), Tuple{LazyArrays.BroadcastVector{Float64, typeof(exp), Tuple{InfiniteArrays.InfUnitRange{Int64}}}, Int64}}}}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}}}}, Fill{Int64, 2, Tuple{Base.OneTo{Int64}, InfiniteArrays.OneToInf{Int64}}}}}}}, InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf()×OneToInf():
0.0 -0.0594959 -8.23994e-17 0.0 …
0.0 0.0 -0.0237063 0.0
-1.0 0.0 0.0 0.0
0.0 -0.998229 6.93889e-18 0.0
0.0 0.0 -0.999719 0.0
0.0 0.0 0.0 -1.0 …
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 …
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
⋮ ⋱

b = [randn(1000); zeros(∞)]
@time x = B \ b

0.000497 seconds (1.02 k allocations: 817.266 KiB)

ℵ₀-element LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Zeros{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf():
0.39134204255400545
0.01234323396819117
0.059097404220803194
0.02970021202214158
-0.07296603611475548
0.1156408985879014
-0.12887769102686933
0.07773309615416192
-0.05889165649950909
-0.17624418351580798
-0.11068103653173865
-0.062448931200840496
0.1489057736432325

inv(ℵ₀×ℵ₀ BandedMatrix{Float64} with bandwidths (2, 2) with data (5×3 Matrix{Float64}) * (vcat(hcat(1×2 Zeros{Float64}, 1×ℵ₀ InfiniteArrays.ReshapedArray{Float64, 2, LazyArrays.BroadcastVector{Float64, typeof(/), Tuple{Int64, LazyArrays.BroadcastVector{Float64, typeof(+), Tuple{LazyArrays.BroadcastVector{Float64, typeof(exp), Tuple{InfiniteArrays.InfUnitRange{Int64}}}, Int64}}}}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(1)×OneToInf(), hcat(1×0 Zeros{Float64}, 1×ℵ₀ InfiniteArrays.ReshapedArray{Int64, 2, InfiniteArrays.InfUnitRange{Int64}, Tuple{Int64, Infinities.InfiniteCardinal{0}}, Tuple{}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(1)×OneToInf(), 1×ℵ₀ Fill{Int64, 2, Tuple{Base.OneTo{Int64}, InfiniteArrays.OneToInf{Int64}}} with indices Base.OneTo(1)×OneToInf()) with indices Base.OneTo(3)×OneToInf()) with indices Base.OneTo(5)×OneToInf() with indices OneToInf()×OneToInf()) with indices OneToInf()×OneToInf():
0.515382 -0.0 -0.0153818 …
-0.0 0.335455 -0.0
-0.258078 -0.0 0.258078
-0.0 -0.134233 -0.0
0.0860348 -0.0 -0.0860348
-0.0 0.0383535 -0.0 …
-0.0215089 -0.0 0.0215089
-0.0 -0.00852303 -0.0
0.00430178 -0.0 -0.00430178
-0.0 0.00154964 -0.0
-0.000716963 -0.0 0.000716963 …
-0.0 -0.000238406 -0.0
0.000102423 -0.0 -0.000102423
⋮ ⋱

b = zeros(∞)

Diagonal(1:∞) \ b

ℵ₀-element LazyArrays.CachedArray{Float64, 1, Vector{Float64}, Zeros{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf():

using ArrayLayouts

MemoryLayout(b)

LazyArrays.PaddedLayout{DenseColumnMajor}()

A = randn(100,100)
@which MemoryLayout(typeof(view(A,1:5,2:6)))

MemoryLayout(A::Type{) where {T, N, P, I} in ArrayLayouts at /Users/sheehanolver/.julia/packages/ArrayLayouts/CV0IA/src/memorylayout.jl:186

MemoryLayout(B)

BandedMatrices.BandedColumns{LazyArrays.LazyLayout}()

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com