1
1
export PartialInverseOperator
2
2
3
+ """
4
+ PartialInverseOperator(O::Operator[, bandwidths = bandwidths(O)])
3
5
4
- struct PartialInverseOperator{T<: Number ,CO<: CachedOperator ,BI} <: Operator{T}
6
+ Return an approximate estimate for `inv(O)`, such that `PartialInverseOperator(O) * O` is banded, and
7
+ is approximately `I` up to a bandwidth that is one less than the sum of the bandwidths
8
+ of `O` and `PartialInverseOperator(O)`.
9
+
10
+ !!! note
11
+ Only upper triangular operators are supported as of now.
12
+
13
+ # Examples
14
+
15
+ ```jldoctest
16
+ julia> C = Conversion(Chebyshev(), Ultraspherical(1));
17
+
18
+ julia> bandwidths(C)
19
+ (0, 2)
20
+
21
+ julia> P = PartialInverseOperator(C);
22
+
23
+ julia> bandwidths(P)
24
+ (0, 2)
25
+
26
+ julia> P * C
27
+ TimesOperator : Chebyshev() → Chebyshev()
28
+ 1.0 0.0 0.0 0.0 -0.5 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
29
+ ⋅ 1.0 0.0 0.0 0.0 -1.0 ⋅ ⋅ ⋅ ⋅ ⋅
30
+ ⋅ ⋅ 1.0 0.0 0.0 0.0 -1.0 ⋅ ⋅ ⋅ ⋅
31
+ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 -1.0 ⋅ ⋅ ⋅
32
+ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 -1.0 ⋅ ⋅
33
+ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 -1.0 ⋅
34
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 ⋱
35
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 ⋱
36
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 ⋱
37
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋱
38
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋱
39
+
40
+ julia> P = PartialInverseOperator(C, (0, 4));
41
+
42
+ julia> bandwidths(P)
43
+ (0, 4)
44
+
45
+ julia> P * C
46
+ TimesOperator : Chebyshev() → Chebyshev()
47
+ 1.0 0.0 0.0 0.0 0.0 0.0 -0.5 ⋅ ⋅ ⋅ ⋅
48
+ ⋅ 1.0 0.0 0.0 0.0 0.0 0.0 -1.0 ⋅ ⋅ ⋅
49
+ ⋅ ⋅ 1.0 0.0 0.0 0.0 0.0 0.0 -1.0 ⋅ ⋅
50
+ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 0.0 0.0 -1.0 ⋅
51
+ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 0.0 0.0 ⋱
52
+ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 0.0 ⋱
53
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 0.0 ⋱
54
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 0.0 ⋱
55
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 0.0 ⋱
56
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋱
57
+ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋱
58
+ ```
59
+ """
60
+ struct PartialInverseOperator{T<: Number ,CO<: CachedOperator ,BI<: Tuple{Any,Any} } <: Operator{T}
5
61
cache:: CO
6
62
bandwidths:: BI
7
63
end
@@ -11,10 +67,12 @@ function PartialInverseOperator(CO::CachedOperator{T},bandwidths) where T<:Numbe
11
67
return PartialInverseOperator {T,typeof(CO),typeof(bandwidths)} (CO,bandwidths)
12
68
end
13
69
14
- PartialInverseOperator (B:: Operator , bandwidths) = PartialInverseOperator (cache (B), bandwidths)
15
- PartialInverseOperator (B:: Operator ) = PartialInverseOperator (B, bandwidths (B))
70
+ function PartialInverseOperator (B:: Operator , bandwidths = bandwidths (B))
71
+ PartialInverseOperator (cache (B), bandwidths)
72
+ end
16
73
17
- convert (:: Type{Operator{T}} ,A:: PartialInverseOperator ) where {T}= PartialInverseOperator (strictconvert (Operator{T},A. cache), A. bandwidths)
74
+ convert (:: Type{Operator{T}} ,A:: PartialInverseOperator ) where {T} =
75
+ PartialInverseOperator (strictconvert (Operator{T},A. cache), A. bandwidths)
18
76
19
77
domainspace (P:: PartialInverseOperator )= rangespace (P. cache)
20
78
rangespace (P:: PartialInverseOperator )= domainspace (P. cache)
60
118
61
119
# # These are both hacks that apparently work
62
120
63
- function BandedMatrix (S:: SubOperator{T,PP ,Tuple{UnitRange{Int},UnitRange{Int}}} ) where {T,PP <: PartialInverseOperator }
121
+ function BandedMatrix (S:: SubOperator{T,<:PartialInverseOperator ,Tuple{UnitRange{Int},UnitRange{Int}}} ) where {T}
64
122
kr,jr = parentindices (S)
65
123
P = parent (S)
66
124
# ret = BandedMatrix{eltype(S)}(undef, size(S), bandwidths(S))
0 commit comments