Skip to content

Commit

Permalink
Size for ToeplitzFactorization (#128)
Browse files Browse the repository at this point in the history
* Size for ToeplitzFactorization

* Add size(::ToeplitzFactorization, i)

* Reorganize code

* Add specific tests
  • Loading branch information
jishnub committed Jan 24, 2024
1 parent 4ee010c commit 135d562
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ToeplitzMatrices"
uuid = "c751599d-da0a-543b-9d20-d0a503d91d24"
version = "0.8.3"
version = "0.8.4"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
2 changes: 2 additions & 0 deletions src/ToeplitzMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ struct ToeplitzFactorization{T,A<:AbstractToeplitz{T},S<:Number,P<:Plan{S}} <: F
tmp::Vector{S}
dft::P
end
Base.size(T::ToeplitzFactorization) = (s = size(T.dft,1); (s, s))
Base.size(T::ToeplitzFactorization, i::Integer) = size(T)[i]

include("toeplitz.jl")
include("special.jl")
Expand Down
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,14 @@ end
end
end
end

@testset "ldiv! for ToeplitzFactorization (#73)" begin
b = rand(6)
x = zero(b)
P = Circulant([1., 0., 0., 0., 0., 0.])
Pfac = factorize(P)
@test size(Pfac) == size(P)
@test size(Pfac, 1) == size(P, 1)
ldiv!(x, Pfac, b)
@test x Pfac \ b
end

0 comments on commit 135d562

Please sign in to comment.