Skip to content

Commit 8cf7890

Browse files
committed
Move more here
1 parent 2ac190d commit 8cf7890

File tree

5 files changed

+70
-8
lines changed

5 files changed

+70
-8
lines changed

src/ApproxFunBase.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Base: values, convert, getindex, setindex!, *, +, -, ==, <, <=, >, |, !,
2525
getproperty, findfirst, unsafe_getindex, fld, cld, div, real, imag,
2626
@_inline_meta, eachindex, firstindex, lastindex, keys, isreal, OneTo,
2727
Array, Vector, Matrix, view, ones, @propagate_inbounds, print_array,
28-
split
28+
split, iszero
2929

3030
import Base.Broadcast: BroadcastStyle, Broadcasted, AbstractArrayStyle, broadcastable,
3131
DefaultArrayStyle, broadcasted

src/LinearAlgebra/helper.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,6 @@ end
620620

621621
length(A::CachedIterator) = length(A.iterator)
622622

623-
624-
# The following don't need caching
625-
cache(A::AbstractVector{T}) where {T<:Number} = A
626-
627-
628623
## nocat
629624
vnocat(A...) = Base.vect(A...)
630625
hnocat(A...) = Base.typed_hcat(mapreduce(typeof,promote_type,A),A...)

src/Operators/general/PartialInverseOperator.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,33 @@ function getindex(P::PartialInverseOperator,k::Integer,j::Integer)
3737
return zero(eltype(P))
3838
end
3939
end
40+
41+
42+
## These are both hacks that apparently work
43+
44+
function BandedMatrix(S::SubOperator{T,PP,Tuple{UnitRange{Int},UnitRange{Int}}}) where {T,PP<:PartialInverseOperator}
45+
kr,jr = parentindices(S)
46+
P = parent(S)
47+
#ret = BandedMatrix{eltype(S)}(undef, size(S), bandwidths(S))
48+
ret = BandedMatrix{eltype(S)}(undef, (last(kr),last(jr)), bandwidths(P))
49+
b = bandwidth(P, 2)
50+
#@assert first(kr) == first(jr) == 1
51+
52+
@inbounds for j in 1:last(jr)
53+
kk = colrange(ret, j)
54+
if j in kk
55+
ret[j,j] = inv(P.cache[j,j])
56+
end
57+
for k in first(kk):min(last(kk),j-1)
58+
t = zero(T)
59+
for i = max(k,j-b-1):j-1
60+
t += ret[k,i]*P.cache[i,j]
61+
end
62+
ret[k,j] = -t/P.cache[j,j]
63+
end
64+
end
65+
66+
ret[kr,jr]
67+
end
68+
69+

src/Spaces/QuotientSpace.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,40 @@ for (gesdd, elty, relty) in ((:dgesdd_,:Float64,:Float64),
260260
end
261261
end
262262
end
263+
264+
265+
function BandedMatrix(S::SubOperator{T,ConcreteConversion{QuotientSpace{SP,O,D,R},SP,T},Tuple{UnitRange{Int},UnitRange{Int}}}) where {SP,O,D,R,T}
266+
kr,jr = parentindices(S)
267+
C = parent(S)
268+
#ret = BandedMatrix{eltype(S)}(undef, size(S), bandwidths(S))
269+
ret = BandedMatrix{eltype(S)}(undef, (last(kr),last(jr)), bandwidths(C))
270+
#@assert first(kr) == first(jr) == 1
271+
272+
sp = domainspace(C)
273+
F = sp.F
274+
A = F.factors
275+
n = size(A, 1)
276+
B = sp.bcs[1:n,1:last(jr)+n]
277+
x = sp.x
278+
@inbounds for j in 1:last(jr)
279+
kk = colrange(ret, j)
280+
if j in kk
281+
ret[j,j] = one(R)
282+
end
283+
for jj = 1:n, ii = 1:n
284+
A[ii,jj] = B[ii,j+jj]
285+
end
286+
for ii = 1:n
287+
x[ii] = -B[ii,j]
288+
end
289+
if norm(x) > 8*norm(A)*eps(R)
290+
mutable_lu!(F)
291+
ldiv!(F, x)
292+
end
293+
for k = first(kk)+1:last(kk)
294+
ret[k,j] = x[k-j]
295+
end
296+
end
297+
298+
ret[kr,jr]
299+
end

src/Spaces/Spaces.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ abstract type WeightSpace{S,DD,RR} <: Space{DD,RR} end
140140

141141

142142
domain(S::WeightSpace) = domain(S.space)
143-
144-
145143
points(sp::WeightSpace,n) = points(sp.space,n)
146144

145+
weight(S::WeightSpace, x...) = error("Override `weight(::$S, $x)`")
146+
147147

148148
struct WeightSpacePlan{S,P,T,V}
149149
space::S

0 commit comments

Comments
 (0)