Skip to content

Commit

Permalink
Support copymutable dispatching on size, used in InfiniteLinearAlgebr… (
Browse files Browse the repository at this point in the history
#53)

* Support copymutable dispatching on size, used in InfiniteLinearAlgebra.jl

* Update MatrixFactorizations.jl

* Update runtests.jl
  • Loading branch information
dlfivefifty authored Aug 22, 2023
1 parent eb675a9 commit 02f2d79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MatrixFactorizations"
uuid = "a3b82374-2e81-5b9e-98ce-41277c0e4c87"
version = "2.0.1"
version = "2.1"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
3 changes: 3 additions & 0 deletions src/MatrixFactorizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ abstract type LayoutQ{T} <: AbstractQ{T} end
@_layoutrmul LayoutQ
@_layoutrmul AdjointQtype{<:Any,<:LayoutQ}

LinearAlgebra.copymutable(Q::LayoutQ) = copymutable_size(size(Q), Q)
copymutable_size(sz, Q) = lmul!(Q, Matrix{eltype(Q)}(I, sz))

(*)(Q::LayoutQ, b::AbstractVector) = _mul(Q, b)
(*)(Q::LayoutQ, b::LayoutVector) = ArrayLayouts.mul(Q, b) # disambiguation w/ ArrayLayouts.jl
function _mul(Q::LayoutQ, b::AbstractVector)
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,14 @@ end
@test Q' * LowerTriangular(L) Q' * L
@test LowerTriangular(L)' * Q' A'
end

@testset "row/col slices via copymutable" begin
n = 5
A = randn(n,n)
Q, L = ql(A)
@test Q[2,3:4] == [Q[2,k] for k=3:4]
@test Q[3:4,2] == [Q[k,2] for k=3:4]
end
end

include("test_rq.jl")
Expand Down

2 comments on commit 02f2d79

@dlfivefifty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/90081

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.1.0 -m "<description of version>" 02f2d79887238d51bbd2dbe236a5f3eae4f6d759
git push origin v2.1.0

Please sign in to comment.