Skip to content

Commit edbc8eb

Browse files
Add ToeplitzFactorization (#60)
* Add `ToeplitzFactorization` * Update tests * Update README * Fix CI workflow * Bump version Co-authored-by: Sheehan Olver <[email protected]>
1 parent c317a81 commit edbc8eb

File tree

5 files changed

+378
-268
lines changed

5 files changed

+378
-268
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
- master
77
pull_request:
88

99
jobs:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ToeplitzMatrices"
22
uuid = "c751599d-da0a-543b-9d20-d0a503d91d24"
3-
version = "0.6.3"
3+
version = "0.7.0"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

README.md

Lines changed: 73 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ for Toeplitz, Hankel and circulant matrices in Julia
1010

1111
# Note
1212

13-
Some computations such as multiplication of large matrices are performed with FFTs.
13+
Multiplication of large matrices and `sqrt`, `inv`, `LinearAlgebra.eigvals`,
14+
`LinearAlgebra.ldiv!`, and `LinearAlgebra.pinv` for circulant matrices
15+
are computed with FFTs.
1416
To be able to use these methods, you have to install and load a package that implements
1517
the [AbstractFFTs.jl](https://github.com/JuliaMath/AbstractFFTs.jl) interface such
1618
as [FFTW.jl](https://github.com/JuliaMath/FFTW.jl):
@@ -19,15 +21,22 @@ as [FFTW.jl](https://github.com/JuliaMath/FFTW.jl):
1921
using FFTW
2022
```
2123

22-
## ToeplitzMatrix
24+
If you perform multiple calculations with FFTs, it can be more efficient to
25+
initialize the required arrays and plan the FFT only once. You can precompute
26+
the FFT factorization with `LinearAlgebra.factorize` and then use the factorization
27+
for the FFT-based computations.
2328

24-
A Toeplitz matrix has constant diagonals. It can be constructed using
29+
# Supported matrices
30+
31+
## Toeplitz
32+
33+
A Toeplitz matrix has constant diagonals. It can be constructed using
2534

2635
```julia
2736
Toeplitz(vc,vr)
2837
```
2938

30-
where `vc` are the entries in the first column and `vr` are the entries in the first row, where `vc[1]` must equal `vr[1]`. For example.
39+
where `vc` are the entries in the first column and `vr` are the entries in the first row, where `vc[1]` must equal `vr[1]`. For example.
3140

3241
```julia
3342
Toeplitz(1:3, [1.,4.,5.])
@@ -41,6 +50,28 @@ is a sparse representation of the matrix
4150
3.0 2.0 1.0 ]
4251
```
4352

53+
## SymmetricToeplitz
54+
55+
A symmetric Toeplitz matrix is a symmetric matrix with constant diagonals. It can be constructed with
56+
57+
```julia
58+
SymmetricToeplitz(vc)
59+
```
60+
61+
where `vc` are the entries of the first column. For example,
62+
63+
```julia
64+
SymmetricToeplitz([1.0, 2.0, 3.0])
65+
```
66+
67+
is a sparse representation of the matrix
68+
69+
```julia
70+
[ 1.0 2.0 3.0
71+
2.0 1.0 2.0
72+
3.0 2.0 1.0 ]
73+
```
74+
4475
## TriangularToeplitz
4576

4677
A triangular Toeplitz matrix can be constructed using
@@ -52,57 +83,56 @@ TriangularToeplitz(ve,uplo)
5283
where uplo is either `:L` or `:U` and `ve` are the rows or columns, respectively. For example,
5384

5485
```julia
55-
TriangularToeplitz([1.,2.,3.],:L)
56-
```
86+
TriangularToeplitz([1.,2.,3.],:L)
87+
```
88+
89+
is a sparse representation of the matrix
5790

58-
is a sparse representation of the matrix
91+
```julia
92+
[ 1.0 0.0 0.0
93+
2.0 1.0 0.0
94+
3.0 2.0 1.0 ]
95+
```
5996

60-
```julia
61-
[ 1.0 0.0 0.0
62-
2.0 1.0 0.0
63-
3.0 2.0 1.0 ]
64-
```
97+
## Hankel
6598

66-
# Hankel
99+
A Hankel matrix has constant anti-diagonals. It can be constructed using
67100

68-
A Hankel matrix has constant anti-diagonals. It can be constructed using
101+
```julia
102+
Hankel(vc,vr)
103+
```
69104

70-
```julia
71-
Hankel(vc,vr)
72-
```
105+
where `vc` are the entries in the first column and `vr` are the entries in the last row, where `vc[end]` must equal `vr[1]`. For example.
73106

74-
where `vc` are the entries in the first column and `vr` are the entries in the last row, where `vc[end]` must equal `vr[1]`. For example.
107+
```julia
108+
Hankel([1.,2.,3.], 3:5)
109+
```
75110

76-
```julia
77-
Hankel([1.,2.,3.], 3:5)
78-
```
111+
is a sparse representation of the matrix
79112

80-
is a sparse representation of the matrix
113+
```julia
114+
[ 1.0 2.0 3.0
115+
2.0 3.0 4.0
116+
3.0 4.0 5.0 ]
117+
```
81118

82-
```julia
83-
[ 1.0 2.0 3.0
84-
2.0 3.0 4.0
85-
3.0 4.0 5.0 ]
86-
```
119+
## Circulant
87120

121+
A circulant matrix is a special case of a Toeplitz matrix with periodic end conditions.
122+
It can be constructed using
88123

89-
# Circulant
90-
91-
A circulant matrix is a special case of a Toeplitz matrix with periodic end conditions.
92-
It can be constructed using
93-
94-
```julia
95-
Circulant(vc)
96-
```
124+
```julia
125+
Circulant(vc)
126+
```
97127
where `vc` is a vector with the entries for the first column.
98128
For example:
99129
```julia
100-
Circulant(1:3)
101-
```
102-
is a sparse representation of the matrix
130+
Circulant([1.0, 2.0, 3.0])
131+
```
132+
is a sparse representation of the matrix
103133

104-
```julia
105-
[ 1.0 3.0 2.0
106-
2.0 1.0 3.0
107-
3.0 2.0 1.0 ]
108-
```
134+
```julia
135+
[ 1.0 3.0 2.0
136+
2.0 1.0 3.0
137+
3.0 2.0 1.0 ]
138+
```

0 commit comments

Comments
 (0)