|
16 | 16 |
|
17 | 17 | A = LinearMap(rand(10, 10)) |
18 | 18 | B = LinearMap(cumsum, reverse∘cumsum∘reverse, 10) |
19 | | - |
| 19 | + |
20 | 20 | be a matrix- and function-based linear map, respectively. Then the following code just works, |
21 | 21 | indistinguishably from the case when `A` and `B` are both `AbstractMatrix`-typed objects. |
22 | 22 |
|
23 | | -``` |
24 | | -3.0A + 2B |
25 | | -A*B' |
26 | | -[A B; B A] |
27 | | -kron(A, B) |
28 | | -``` |
| 23 | + 3.0A + 2B |
| 24 | + A + I |
| 25 | + A*B' |
| 26 | + [A B; B A] |
| 27 | + kron(A, B) |
29 | 28 |
|
30 | 29 | The `LinearMap` type and corresponding methods combine well with the following packages: |
| 30 | + |
31 | 31 | * [Arpack.jl](https://github.com/JuliaLinearAlgebra/Arpack.jl): iterative eigensolver |
32 | 32 | `eigs` and SVD `svds`; |
33 | 33 | * [IterativeSolvers.jl](https://github.com/JuliaMath/IterativeSolvers.jl): iterative |
34 | 34 | solvers, eigensolvers, and SVD; |
35 | | -* [KrylovKit.jl](https://github.com/Jutho/KrylovKit.jl): Krylov-based algorithms for linear problems, singular value and eigenvalue problems |
| 35 | +* [KrylovKit.jl](https://github.com/Jutho/KrylovKit.jl): Krylov-based algorithms for linear |
| 36 | + problems, singular value and eigenvalue problems |
36 | 37 | * [TSVD.jl](https://github.com/andreasnoack/TSVD.jl): truncated SVD `tsvd`. |
37 | 38 |
|
38 | 39 | ```julia |
@@ -95,34 +96,34 @@ operator in the special case of a square matrix). |
95 | 96 |
|
96 | 97 | The LinearMaps package provides the following functionality: |
97 | 98 |
|
98 | | -1. A `LinearMap` type that shares with the `AbstractMatrix` type that it |
99 | | - responds to the functions `size`, `eltype`, `isreal`, `issymmetric`, |
100 | | - `ishermitian` and `isposdef`, `transpose` and `adjoint` and multiplication |
101 | | - with a vector using both `*` or the in-place version `mul!`. Linear algebra |
102 | | - functions that use duck-typing for their arguments can handle `LinearMap` |
103 | | - objects similar to `AbstractMatrix` objects, provided that they can be |
104 | | - written using the above methods. Unlike `AbstractMatrix` types, `LinearMap` |
105 | | - objects cannot be indexed, neither using `getindex` or `setindex!`. |
106 | | - |
107 | | -2. A single function `LinearMap` that acts as a general purpose |
108 | | - constructor (though it is only an abstract type) and allows to construct |
109 | | - linear map objects from functions, or to wrap objects of type |
110 | | - `AbstractMatrix` or `LinearMap`. The latter functionality is useful to |
111 | | - (re)define the properties (`isreal`, `issymmetric`, `ishermitian`, |
112 | | - `isposdef`) of the existing matrix or linear map. |
113 | | - |
114 | | -3. A framework for combining objects of type `LinearMap` and of type |
115 | | - `AbstractMatrix` using linear combinations, transposition, composition, |
116 | | - concatenation and Kronecker product/sums, |
117 | | - where the linear map resulting from these operations is never explicitly |
118 | | - evaluated but only its matrix-vector product is defined (i.e. lazy |
119 | | - evaluation). The matrix-vector product is written to minimize memory |
120 | | - allocation by using a minimal number of temporary vectors. There is full |
121 | | - support for the in-place version `mul!`, which should be preferred for |
122 | | - higher efficiency in critical algorithms. In addition, it tries to recognize |
123 | | - the properties of combinations of linear maps. In particular, compositions |
124 | | - such as `A'*A` for arbitrary `A` or even `A'*B*C*B'*A` with arbitrary `A` |
125 | | - and `B` and positive definite `C` are recognized as being positive definite |
126 | | - and hermitian. In case a certain property of the resulting `LinearMap` |
127 | | - object is not correctly inferred, the `LinearMap` method can be called to |
128 | | - redefine the properties. |
| 99 | +1. A `LinearMap` type that shares with the `AbstractMatrix` type that it |
| 100 | + responds to the functions `size`, `eltype`, `isreal`, `issymmetric`, |
| 101 | + `ishermitian` and `isposdef`, `transpose` and `adjoint` and multiplication |
| 102 | + with a vector using both `*` or the in-place version `mul!`. Linear algebra |
| 103 | + functions that use duck-typing for their arguments can handle `LinearMap` |
| 104 | + objects similar to `AbstractMatrix` objects, provided that they can be |
| 105 | + written using the above methods. Unlike `AbstractMatrix` types, `LinearMap` |
| 106 | + objects cannot be indexed, neither using `getindex` or `setindex!`. |
| 107 | + |
| 108 | +2. A single function `LinearMap` that acts as a general purpose |
| 109 | + constructor (though it is only an abstract type) and allows to construct |
| 110 | + linear map objects from functions, or to wrap objects of type |
| 111 | + `AbstractMatrix` or `LinearMap`. The latter functionality is useful to |
| 112 | + (re)define the properties (`isreal`, `issymmetric`, `ishermitian`, |
| 113 | + `isposdef`) of the existing matrix or linear map. |
| 114 | + |
| 115 | +3. A framework for combining objects of type `LinearMap` and of type |
| 116 | + `AbstractMatrix` using linear combinations, transposition, composition, |
| 117 | + concatenation and Kronecker product/sums, |
| 118 | + where the linear map resulting from these operations is never explicitly |
| 119 | + evaluated but only its matrix-vector product is defined (i.e. lazy |
| 120 | + evaluation). The matrix-vector product is written to minimize memory |
| 121 | + allocation by using a minimal number of temporary vectors. There is full |
| 122 | + support for the in-place version `mul!`, which should be preferred for |
| 123 | + higher efficiency in critical algorithms. In addition, it tries to recognize |
| 124 | + the properties of combinations of linear maps. In particular, compositions |
| 125 | + such as `A'*A` for arbitrary `A` or even `A'*B*C*B'*A` with arbitrary `A` |
| 126 | + and `B` and positive definite `C` are recognized as being positive definite |
| 127 | + and hermitian. In case a certain property of the resulting `LinearMap` |
| 128 | + object is not correctly inferred, the `LinearMap` method can be called to |
| 129 | + redefine the properties. |
0 commit comments