Skip to content

Commit 54bbe03

Browse files
authored
Support qr for quasimatrices (#247)
* Support qr for quasimatrices * Update Project.toml
1 parent d844ef4 commit 54bbe03

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.15.4"
4+
version = "0.15.5"
55

66

77
[deps]
@@ -49,7 +49,7 @@ HypergeometricFunctions = "0.3.4"
4949
InfiniteArrays = " 0.15"
5050
InfiniteLinearAlgebra = "0.10.1"
5151
IntervalSets = "0.7"
52-
LazyArrays = "2.7"
52+
LazyArrays = "2.8"
5353
LazyBandedMatrices = "0.11"
5454
MutableArithmetics = "1"
5555
QuasiArrays = "0.12"

src/normalized.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,9 @@ diff_layout(::MappedOPLayouts, A, order::Int; dims...) = diff_layout(MappedBasis
303303
diff_layout(::MappedOPLayouts, A, order...; dims...) = diff_layout(MappedBasisLayout(), A, order...; dims...)
304304

305305
diff_layout(::AbstractNormalizedOPLayout, A, order...; dims...) = diff_layout(ApplyLayout{typeof(*)}(), A, order...; dims...)
306+
307+
function qr(A::AbstractQuasiMatrix)
308+
P = normalized(basis(A))
309+
Q,R = qr(P \ A)
310+
P * Q[:, axes(A,2)], R # TODO: ContinuumFactorization
311+
end

test/test_roots.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ClassicalOrthogonalPolynomials, Random, Test
1+
using ClassicalOrthogonalPolynomials, QuasiArrays, Random, Test
22
using ClassicalOrthogonalPolynomials: sample
33

44
Random.seed!(5)
@@ -24,6 +24,13 @@ end
2424
@test (Legendre() \ A)[1:5,1] [1; zeros(4)] # test transform bug
2525
@test (P \ A)[1:5,1] [sqrt(2); zeros(4)]
2626
Q,R = qr(P \ A)
27+
@test (P * (Q*R))[0.1,:] A[0.1,:]
28+
@test (A*inv(R))[0.1,:] QuasiArrays.ApplyQuasiArray(*, P, Q)[0.1,1:6]
29+
30+
Q,R = qr(A)
31+
@test Q[0.1,:]'R A[0.1,:]'
32+
33+
# sum(expand(Q[:,k] .^2) for k=axes(Q,2))
2734
end
2835

2936
@testset "minimum/maximum/extrema (#242)" begin

0 commit comments

Comments
 (0)