@@ -121,13 +121,13 @@ end
121121
122122function factorize (A:: Toeplitz )
123123 T = eltype (A)
124- m, n = size (A)
125- S = promote_type (float (T) , Complex{Float32})
126- tmp = Vector {S} (undef, m + n - 1 )
124+ n, m = size (A)
125+ S = promote_type (T , Complex{Float32})
126+ tmp = Vector {S} (undef, n + m - 1 )
127127 copyto! (tmp, A. vc)
128- copyto! (tmp, m + 1 , Iterators. reverse (A. vr), 1 , n - 1 )
128+ copyto! (tmp, n + 1 , Iterators. reverse (A. vr), 1 , m - 1 )
129129 dft = plan_fft! (tmp)
130- return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft)
130+ return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft, n, m )
131131end
132132
133133function ldiv! (A:: Toeplitz , b:: StridedVector )
@@ -146,7 +146,7 @@ function factorize(A::SymmetricToeplitz{T}) where {T<:Number}
146146 @inbounds tmp[m + 1 ] = zero (T)
147147 copyto! (tmp, m + 2 , Iterators. reverse (vc), 1 , m - 1 )
148148 dft = plan_fft! (tmp)
149- return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft)
149+ return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft, m, m )
150150end
151151
152152ldiv! (A:: SymmetricToeplitz , b:: StridedVector ) = copyto! (b, IterativeLinearSolvers. cg (A, zeros (length (b)), b, strang (A), 1000 , 100 eps ())[1 ])
@@ -184,11 +184,12 @@ const CirculantFactorization{T, V<:AbstractVector{T}} = ToeplitzFactorization{T,
184184function factorize (C:: Circulant )
185185 T = eltype (C)
186186 vc = C. vc
187+ m = length (vc)
187188 S = promote_type (float (T), Complex{Float32})
188- tmp = Vector {S} (undef, length (vc) )
189+ tmp = Vector {S} (undef, m )
189190 copyto! (tmp, vc)
190191 dft = plan_fft! (tmp)
191- return ToeplitzFactorization {T,typeof(C),S,typeof(dft)} (dft * tmp, similar (tmp), dft)
192+ return ToeplitzFactorization {T,typeof(C),S,typeof(dft)} (dft * tmp, similar (tmp), dft, m, m )
192193end
193194
194195Base.:* (A:: Circulant , B:: Circulant ) = factorize (A) * factorize (B)
@@ -420,7 +421,7 @@ function factorize(A::LowerTriangularToeplitz)
420421 tmp = zeros (S, 2 * n - 1 )
421422 copyto! (tmp, v)
422423 dft = plan_fft! (tmp)
423- return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft)
424+ return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft, n, n )
424425end
425426function factorize (A:: UpperTriangularToeplitz )
426427 T = eltype (A)
@@ -431,5 +432,5 @@ function factorize(A::UpperTriangularToeplitz)
431432 tmp[1 ] = v[1 ]
432433 copyto! (tmp, n + 1 , Iterators. reverse (v), 1 , n - 1 )
433434 dft = plan_fft! (tmp)
434- return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft)
435+ return ToeplitzFactorization {T,typeof(A),S,typeof(dft)} (dft * tmp, similar (tmp), dft, n, n )
435436end
0 commit comments