diff --git a/Project.toml b/Project.toml index a1238e8b..77377844 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "BandedMatrices" uuid = "aae01518-5342-5314-be14-df237901396f" -version = "1.7.3" +version = "1.7.4" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/banded/BandedMatrix.jl b/src/banded/BandedMatrix.jl index 2137bfbe..1ccccb45 100644 --- a/src/banded/BandedMatrix.jl +++ b/src/banded/BandedMatrix.jl @@ -572,9 +572,9 @@ data_colrange(A::BandedMatrix{T}, i::Integer) where {T} = ((i-1)*size(A.data,1)) function data_rowrange(A::BandedMatrix, rowind::Integer) - range(rowind ≤ 1+A.l ? A.u+rowind : (rowind-A.l)*size(A.data,1), - step = size(A.data,1)-1, - length = length(rowrange(A,rowind)), + StepRangeLen(rowind ≤ 1+A.l ? A.u+rowind : (rowind-A.l)*size(A.data,1), + size(A.data,1)-1, + length(rowrange(A,rowind)) ) end diff --git a/test/test_indexing.jl b/test/test_indexing.jl index e0a94a88..14ae0588 100644 --- a/test/test_indexing.jl +++ b/test/test_indexing.jl @@ -346,6 +346,12 @@ import BandedMatrices: rowstart, rowstop, colstart, colstop, @test_throws BoundsError a[0, BandRange] = [1, 2, 3] @test_throws BoundsError a[9, BandRange] = [1, 2, 3] @test_throws DimensionMismatch a[1, BandRange] = [1, 2] + + a = BandedMatrix(ones(2, 5), (-2, 2)) + # 0.0 0.0 1.0 0.0 0.0 + # 0.0 0.0 0.0 1.0 0.0 + @test a[1,:] == [0, 0, 1, 0, 0] + @test a[2,:] == [0, 0, 0, 1, 0] end