Skip to content

Commit 62e8561

Browse files
authored
Specialize unaliascopy for a BandedMatrix (#478)
1 parent 121bcbf commit 62e8561

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/banded/BandedMatrix.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,3 +1043,7 @@ function one(A::BandedMatrix)
10431043
m==n || throw(DimensionMismatch("multiplicative identity defined only for square matrices"))
10441044
typeof(A)(I, (m,n))
10451045
end
1046+
1047+
function Base.unaliascopy(B::BandedMatrix)
1048+
_BandedMatrix(Base.unaliascopy(B.data), Base.unaliascopy(B.raxis), B.l, B.u)
1049+
end

test/test_banded.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,13 @@ include("mymatrix.jl")
593593
@test Q == I(5)
594594
@test eltype(Q) == Float64
595595
end
596+
597+
@testset "unaliascopy" begin
598+
B = BandedMatrices._BandedMatrix(view(randn(1, 5),:,:), 5, 0, 0)
599+
B2 = Base.unaliascopy(B)
600+
@test B2 == B
601+
@test typeof(B2) == typeof(B)
602+
end
596603
end
597604

598605
end # module

0 commit comments

Comments
 (0)