Skip to content

Commit

Permalink
remove some invalidations
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Apr 2, 2023
1 parent 44713fc commit dafec3d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/field_vectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ end
end

function pinv!(dst::StaticMatrix{2,2,<:DiagOp}, src::StaticMatrix{2,2,<:DiagOp})
a,c,b,d = src
a, c, b, d = src[1,1], src[2,1], src[2,1], src[2,2]
det⁻¹ = pinv(@. a*d-b*c)
@. dst[1,1] = det⁻¹ * d
@. dst[1,2] = -det⁻¹ * b
Expand Down
2 changes: 1 addition & 1 deletion src/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ basis(::Union{Number,AbstractVector}) = Basis # allows them to be in FieldTuple

### printing
typealias(::Type{B}) where {B<:Basis} = string(B)
Base.show_datatype(io::IO, t::Type{<:Union{Field,FieldOp}}) = print(io, typealias(t))
# Base.show_datatype(io::IO, t::Type{<:Union{Field,FieldOp}}) = print(io, typealias(t))
Base.isempty(::ImplicitOp) = true
Base.isempty(::ImplicitField) = true
Base.isempty(::Diagonal{<:Any,<:ImplicitField}) = true
Expand Down
4 changes: 2 additions & 2 deletions src/lenseflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function precompute!!(Lϕ::LenseFlow{S,T}, f) where {S<:RK4Solver, T}
# p & M precomputed matrix elements will use exactly same type as ϕ
Łϕ, Ðϕ = Ł(ϕ), Ð(ϕ)
p, M⁻¹ = Dict(), Dict()
τs = τ.(range(t₀, t₁, length=2nsteps+1))
τs = τ.(range(t₀, stop=t₁, length=2nsteps+1))
p = Dict(map->=> Diagonal.(similar.(@SVector[Łϕ, Łϕ]))), τs))
M⁻¹ = Dict(map->=> Diagonal.(similar.(@SMatrix[Łϕ Łϕ; Łϕ Łϕ]))), τs))

Expand Down Expand Up @@ -132,7 +132,7 @@ function precompute!(Lϕ::CachedLenseFlow{S,T}) where {S,T}
# @info "Precomputing $T"
@unpack (ϕ, t₀, t₁, odesolve) =
@unpack nsteps = odesolve
ts = range(t₀, t₁, length=2nsteps+1)
ts = range(t₀, stop=t₁, length=2nsteps+1)
∇ϕ, ∇∇ϕ = map(Ł, gradhess(ϕ[]))
for (t, τ) in zip(ts,τ.(ts))
@!.M⁻¹[τ] = pinv(Diagonal.(I + T(t)*∇∇ϕ))
Expand Down
2 changes: 1 addition & 1 deletion src/numerical_algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function (solver::RK4Solver)(F!::Function, y₀, (t₀, t₁)::Pair)
h, h½, h⅙ = (t₁-t₀)/solver.nsteps ./ (1,2,6)
y = copy(y₀)
k₁, k₂, k₃, k₄, y′ = @repeated(similar(y₀),5)
for t in range(t₀,t₁,length=solver.nsteps+1)[1:end-1]
for t in range(t₀, stop=t₁, length=solver.nsteps+1)[1:end-1]
@! k₁ = F(t, y)
@! k₂ = F(t + h½, (@. y′ = y +*k₁))
@! k₃ = F(t + h½, (@. y′ = y +*k₂))
Expand Down
2 changes: 1 addition & 1 deletion src/specialops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct BandPass{W<:Cℓs} <: ImplicitField{HarmonicBasis,Bottom}
end
BandPassOp(ℓ,Wℓ) = Diagonal(BandPass(Cℓs(promote(collect(ℓ),collect(Wℓ))...)))
BandPassOp(Wℓ::Cℓs) = Diagonal(BandPass(Wℓ))
cos_ramp_up(length) = @. (cos($range(π,0,length=length))+1)/2
cos_ramp_up(length) = @. (cos($range(π, stop=0, length=length))+1)/2
cos_ramp_down(length) = 1 .- cos_ramp_up(length)
HighPass(ℓ; Δℓ=50) = BandPassOp(ℓ:20000, [cos_ramp_up(Δℓ); ones(20000--Δℓ+1)])
LowPass(ℓ; Δℓ=50) = BandPassOp(0:ℓ, [ones(ℓ-Δℓ+1); cos_ramp_down(Δℓ)])
Expand Down

0 comments on commit dafec3d

Please sign in to comment.