Skip to content

Commit fc5d2aa

Browse files
committed
minor docs update, mention ArnoldiMethod.jl
1 parent dd146b1 commit fc5d2aa

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

docs/src/index.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,35 @@
66

77
`LinearMaps.jl` is a registered package and can be installed via
88

9-
pkg> add LinearMaps
9+
```julia
10+
pkg> add LinearMaps
11+
```
1012

1113
in package mode, to be entered by typing `]` in the Julia REPL.
1214

1315
## Examples
1416

1517
Let
1618

17-
A = LinearMap(rand(10, 10))
18-
B = LinearMap(cumsum, reverse∘cumsum∘reverse, 10)
19+
```julia
20+
A = LinearMap(rand(10, 10))
21+
B = LinearMap(cumsum, reversecumsumreverse, 10)
22+
```
1923

2024
be a matrix- and function-based linear map, respectively. Then the following code just works,
2125
indistinguishably from the case when `A` and `B` are both `AbstractMatrix`-typed objects.
2226

23-
3.0A + 2B
24-
A + I
25-
A*B'
26-
[A B; B A]
27-
kron(A, B)
27+
```julia
28+
3.0A + 2B
29+
A + I
30+
A*B'
31+
[A B; B A]
32+
kron(A, B)
33+
```
2834

2935
The `LinearMap` type and corresponding methods combine well with the following packages:
3036

37+
* [ArnoldiMethods.jl](https://github.com/haampie/ArnoldiMethod.jl)
3138
* [Arpack.jl](https://github.com/JuliaLinearAlgebra/Arpack.jl): iterative eigensolver
3239
`eigs` and SVD `svds`;
3340
* [IterativeSolvers.jl](https://github.com/JuliaMath/IterativeSolvers.jl): iterative
@@ -38,7 +45,7 @@ The `LinearMap` type and corresponding methods combine well with the following p
3845

3946
```julia
4047
using LinearMaps
41-
import Arpack, IterativeSolvers, KrylovKit, TSVD
48+
import Arpack, IterativeSolvers, KrylovKit, TSVD, ArnoldiMethod
4249

4350
# Example 1, 1-dimensional Laplacian with periodic boundary conditions
4451
function leftdiff!(y::AbstractVector, x::AbstractVector) # left difference assuming periodic boundary conditions
@@ -64,11 +71,15 @@ D = LinearMap(leftdiff!, mrightdiff!, 100; ismutating=true) # by default has elt
6471
Arpack.eigs(D'D; nev=3, which=:SR) # note that D'D is recognized as symmetric => real eigenfact
6572
Arpack.svds(D; nsv=3)
6673

74+
ArnoldiMethod.partialschur(D'D; nev=3, which=ArnoldiMethod.SR())
75+
76+
KrylovKit.eigsolve(D'D, 100, 3, :SR)
77+
6778
Σ, L = IterativeSolvers.svdl(D; nsv=3)
6879

6980
TSVD.tsvd(D, 3)
7081

71-
# Example 2, 1-dimensional Laplacian
82+
# Example 2, 3 smallest eigenvalues of 1-dimensional Laplacian
7283
A = LinearMap(100; issymmetric=true, ismutating=true) do C, B
7384
C[1] = -2B[1] + B[2]
7485
for i in 2:length(B)-1
@@ -80,10 +91,15 @@ end
8091

8192
Arpack.eigs(-A; nev=3, which=:SR)
8293

94+
ArnoldiMethod.partialschur(-A; nev=3, which=ArnoldiMethod.SR())
95+
96+
KrylovKit.eigsolve(-A, size(A, 1), 3, :SR)
97+
8398
# Example 3, 2-dimensional Laplacian
8499
Δ = kronsum(A, A)
85100

86101
Arpack.eigs(Δ; nev=3, which=:LR)
102+
ArnoldiMethod.partialeigen(ArnoldiMethod.partialschur(Δ; nev=3, which=ArnoldiMethod.LR())[1])
87103
KrylovKit.eigsolve(x -> Δ*x, size(Δ, 1), 3, :LR)
88104
```
89105

0 commit comments

Comments
 (0)