QInchworm.utility
Interpolations.jl addon: Neumann boundary conditions for the cubic spline
QInchworm.utility.NeumannBC
— Typestruct NeumannBC{GT<:Union{Nothing, Interpolations.GridType}, T<:Number} <: Interpolations.BoundaryCondition
Interpolations.jl addon: Implementation of the Neumann boundary conditions for the cubic spline.
Fields
gt::Union{Nothing, Interpolations.GridType}
: Grid typeleft_derivative::Number
: Function derivative at the left boundaryright_derivative::Number
: Function derivative at the right boundary
Interpolations.prefiltering_system
— Methodprefiltering_system(
_::Type{T},
_::Type{TC},
n::Int64,
degree::Interpolations.Cubic{BC<:(QInchworm.utility.NeumannBC{Interpolations.OnGrid})}
) -> Tuple{WoodburyMatrices.Woodbury{_A, LinearAlgebra.LU{T, S, P}, SparseArrays.SparseMatrixCSC{Tv, Int64}, SparseArrays.SparseMatrixCSC{Tv1, Int64}, Matrix{_A1}} where {_A, T, S<:(LinearAlgebra.Tridiagonal{T, _B} where _B), P<:(AbstractVector{<:Integer}), Tv, Tv1, _A1}, Vector}
Compute the system used to prefilter cubic spline coefficients when using the Neumann boundary conditions.
Parameters
T
,TC
: Element types.n
: The number of rows in the data input.degree
: Interpolation degree information.
Returns
Woodbury matrix and the RHS of the computed system.
Quadratic spline that allows for incremental construction
QInchworm.utility.IncrementalSpline
— Typestruct IncrementalSpline{KnotT<:Number, T<:Number}
Quadratic spline on an equidistant grid that allows for incremental construction.
Fields
knots::AbstractRange{KnotT} where KnotT<:Number
: Locations of interpolation knotsdata::Vector{T} where T<:Number
: Values of the interpolated function at the knotsder_data::Vector{T} where T<:Number
: Values of the interpolated function derivative at the knots
QInchworm.utility.extend!
— Functionextend!(
G_int::QInchworm.spline_gf.IncSplineImaginaryTimeGF,
val
) -> Any
Extend the underlying IncrementalSpline
objects stored in G_int
with a value val
.
extend!(
spline::QInchworm.utility.IncrementalSpline,
val
) -> Vector{T} where T<:Number
Add a segment to an incremental spline by fixing value val
of the interpolated function at the next knot.
Lazy matrix product
QInchworm.utility.LazyMatrixProduct
— Typemutable struct LazyMatrixProduct{T<:Number}
A matrix product of the form $A_N A_{N-1} \ldots A_1$.
Functions pushfirst!()
and popfirst!()
can be used to add and remove multipliers to/from the left of the product. The product is lazy in the sense that the actual multiplication takes place only when the eval!()
function is called. The structure keeps track of previously evaluated partial products and reuses them upon successive calls to eval!()
.
Base.pushfirst!
— Methodpushfirst!(
lmp::QInchworm.utility.LazyMatrixProduct{T<:Number},
A::Array{T<:Number, 2}
) -> Matrix{T} where T<:Number
Add a new matrix A
to the left of the product lmp
.
Base.popfirst!
— Methodpopfirst!(
lmp::QInchworm.utility.LazyMatrixProduct{T<:Number}
) -> Int64
popfirst!(
lmp::QInchworm.utility.LazyMatrixProduct{T<:Number},
n::Int64
) -> Int64
Remove n
matrices from the left of the product lmp
. By default, n = 1
.
QInchworm.utility.eval!
— Methodeval!(
lmp::QInchworm.utility.LazyMatrixProduct{T<:Number}
) -> Any
Evaluate the matrix product lmp
.
Random sequence
QInchworm.utility.RandomSeq
— Typestruct RandomSeq{RNG<:Random.AbstractRNG, D}
This structure wraps a random number generator (a subtype of AbstractRNG
) and implements a subset of ScrambledSobolSeq
's interface.
QInchworm.utility.seed!
— Functionseed!(s::QInchworm.utility.RandomSeq, seed)
Seed the underlying random number generator of the sequence s
with a given integer.
Serialization using IOBuffer
QInchworm.utility.iobuffer_serialize
— Functioniobuffer_serialize(data)
Serialize data using an IOBuffer
object.
QInchworm.utility.iobuffer_deserialize
— Functioniobuffer_deserialize(data_raw)
Deserialize data using an IOBuffer
object.
Range partitioning utilities
QInchworm.utility.split_count
— Functionsplit_count(N::Integer, n::Integer) -> Any
Return a vector of n
integers which are approximately equal and sum to N
.
QInchworm.utility.range_from_chunks_and_idx
— Functionrange_from_chunks_and_idx(
chunk_sizes::AbstractVector,
idx::Integer
) -> Any
Given a list of chunk sizes, return the range that enumerates elements in the idx
-th chunk.