Skip to content

Commit d7be08c

Browse files
authored
Less allocations in TH (#211)
1 parent daafeb3 commit d7be08c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/toeplitzhankel.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function hankel_partialchol(v::Vector, D::AbstractVector)
108108
# Assumes positive definite
109109
σ = T[]
110110
n = isempty(v) ? 0 : (length(v)+2) ÷ 2
111-
C = Matrix{T}(undef, n, n)
111+
C = Matrix{T}(undef, n, 100)
112112
d = v[1:2:end] .* D.^2 # diag of D .* H .* D'
113113
@assert length(v) 2n-1
114114
reltol = maximum(abs,d)*eps(T)*log(n)
@@ -127,6 +127,7 @@ function hankel_partialchol(v::Vector, D::AbstractVector)
127127
end
128128
r += 1
129129
end
130+
r == 100 && error("ranks more than 100 not yet supported")
130131
for k=1:length(σ) rmul!(view(C,:,k), sqrt(σ[k])) end
131132
C[:,1:r]
132133
end

0 commit comments

Comments
 (0)