Efficient growing and shrinking of positive definite matrices thanks to preallocated memory.
In addition to the functions defined in the common PDMats
ElasticPDMat <: AbstractPDMat can grow with
a = rand(10, 10); m = a'a; e = ElasticPDMat(m[1:8, 1:8)) append!(e, m[:, 9:10])
and shrink with
deleteat!(e, [3, 8, 7])
Growing and shrinking is usually efficient, because no entries are recomputed
and (basically no) new memory needs to be allocated.
ElasticMat(capacity = 10^3, stepsize = 10^3) allocates
capacity x capacity matrices and creates
0-dimensional) views to represent positive definite matrices.
Whenever the current
capacity is reached, e.g. due to several
capacity increases to
capacity += stepsize. Caution:
capacity involves allocating new memory and copying old values,
which is slow. For optimal performance, the
capacity and the
be chosen wisely. For an already initialized
e = ElasticPDMat() they can be
set with the helper functions
setcapacity!(e, 100) and
ElasticPDMat this package exports view based elastic arrays of
the helper functions