Skip to content

Commit

Permalink
Merge branch 'release-0.13' into dl/moveoutbanded
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty authored Apr 29, 2024
2 parents a09fda2 + 1425899 commit f04db68
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
package:
- {repo: ApproxFunBase.jl, group: JuliaApproximation}
- {repo: ApproxFun.jl, group: JuliaApproximation}
# - {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
- {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}

steps:
- uses: actions/checkout@v4
Expand Down
71 changes: 31 additions & 40 deletions src/BlockBandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,37 @@ module BlockBandedMatrices
using BlockArrays, BandedMatrices, ArrayLayouts, FillArrays, MatrixFactorizations
using LinearAlgebra

import Base: getindex, setindex!, checkbounds, @propagate_inbounds, convert,
+, *, -, /, \, strides, zeros, size,
unsafe_convert, fill!, length, first, last,
eltype, getindex, to_indices, to_index,
reindex, tail, @_propagate_inbounds_meta,
==, axes, copy, copyto!, similar, OneTo, Slice

import Base.Broadcast: BroadcastStyle, AbstractArrayStyle, DefaultArrayStyle, Broadcasted, broadcasted

import LinearAlgebra: UniformScaling, isdiag, rmul!, lmul!, ldiv!, rdiv!, axpy!,
AbstractTriangular, AdjOrTrans, HermOrSym, StructuredMatrixStyle,
qr, qr!
import LinearAlgebra.BLAS: BlasInt, BlasFloat, @blasfunc, BlasComplex, BlasReal
import LinearAlgebra.LAPACK: chktrans, chkdiag, chklapackerror, checksquare, chkstride1,
chkuplo
import MatrixFactorizations: ql, ql!, _ql, QLPackedQ, AdjQRPackedQLayout, AdjQLPackedQLayout, QR, QRPackedQ

import ArrayLayouts: BlasMatLmulVec, MatLmulVec, MatLmulMat,
triangularlayout, UpperTriangularLayout, TriangularLayout, MatLdivVec,
triangulardata, sublayout, sub_materialize, materialize, materialize!,
AbstractColumnMajor, DenseColumnMajor, ColumnMajor,
DiagonalLayout, MulAdd, mul, colsupport, rowsupport,
_qr, _factorize, _copyto!, zero!, layout_replace_in_print_matrix,
transposelayout, conjlayout, symmetriclayout, hermitianlayout

import BlockArrays: blocksize, blockcheckbounds, BlockedUnitRange, blockisequal, DefaultBlockAxis,
Block, BlockSlice, unblock, block, blockindex,
_blocklengths2blocklasts, BlockIndexRange, sizes_from_blocks, BlockSlice1,
blockcolsupport, blockrowsupport, blockcolstart, blockcolstop, blockrowstart, blockrowstop,
AbstractBlockLayout, BlockLayout, blocks, hasmatchingblocks, BlockStyle, BlockSlices, _blockkron,
BlockDiagonal, BlockTridiagonal, BlockBidiagonal, checksquareblocks, AbstractBlockedUnitRange

import BandedMatrices: isbanded, bandwidths, bandwidth, banded_getindex, colrange,
inbands_setindex!, inbands_getindex, banded_setindex!,
banded_generic_axpy!,
BlasFloat, banded_dense_axpy!, MemoryLayout,
BandedLayout, BandedColumnMajor, BandedColumns, bandedcolumns,
BandedSubBandedMatrix, bandeddata,
_BandedMatrix, colstart, colstop, rowstart, rowstop,
BandedStyle, bandshift
import ArrayLayouts: AbstractColumnMajor, AdjQRPackedQLayout, ColumnMajor,
DiagonalLayout, MatLmulMat, MatLmulVec, MemoryLayout, MulAdd, TriangularLayout,
_copyto!, _factorize, _qr, colsupport, conjlayout, hermitianlayout,
layout_replace_in_print_matrix, rowsupport, sub_materialize, sublayout, symmetriclayout,
transposelayout, zero!, materialize!, materialize

import BandedMatrices: BandedColumns, BandedLayout, BandedStyle, BlasFloat,
_BandedMatrix, banded_getindex, banded_setindex!,
bandedcolumns, bandeddata, bandshift, bandwidth, bandwidths, colrange,
inbands_getindex, inbands_setindex!, isbanded

import Base: *, +, -, /, \, ==, @propagate_inbounds, OneTo, Slice, axes, checkbounds,
convert, copy, copyto!, eltype, fill!, first, getindex, last, length, setindex!, similar, size,
strides, unsafe_convert, zeros

import Base.Broadcast: AbstractArrayStyle, BroadcastStyle, Broadcasted, DefaultArrayStyle, broadcasted

import BlockArrays: AbstractBlockLayout, Block, BlockIndexRange, BlockLayout, BlockSlice, BlockSlice1, BlockSlices,
BlockStyle, BlockedUnitRange, DefaultBlockAxis, _blockkron, _blocklengths2blocklasts, block,
blockcheckbounds, blockcolstart, blockcolstop, blockcolsupport, blockindex, blockisequal,
blockrowstart, blockrowstop, blockrowsupport, blocks, blocksize, hasmatchingblocks,
sizes_from_blocks

import FillArrays: Fill, Ones, Zeros

import LinearAlgebra: AbstractTriangular, AdjOrTrans, HermOrSym, StructuredMatrixStyle, UniformScaling, axpy!,
isdiag, ldiv!, lmul!, qr, qr!, rmul!

import LinearAlgebra.BLAS: BlasComplex, BlasFloat, BlasReal

import MatrixFactorizations: AdjQLPackedQLayout, QR, QRPackedQ, _ql, ql, ql!

export BandedBlockBandedMatrix, BlockBandedMatrix, BlockSkylineMatrix, blockbandwidth, blockbandwidths,
subblockbandwidth, subblockbandwidths, Ones, Zeros, Fill, Block, BlockTridiagonal, BlockBidiagonal, isblockbanded
Expand Down
4 changes: 2 additions & 2 deletions src/BlockSkylineMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,10 @@ function copy_accommodating_diagonals(A::BlockSkylineMatrix, diagonals::UnitRang
for (j,i) in enumerate(rows)
# First we find which block the j:th element of the main
# diagonal would occupy.
md_block = findfirst((j), ax.lasts)
md_block = searchsortedfirst(blocklasts(ax), j)

# Next we find which block covers row i
d_block = findfirst((i), ax.lasts)
d_block = searchsortedfirst(blocklasts(ax), i)

# Finally, we increase the block-bandwidth as necessary
v[md_block] = max(v[md_block], abs(d_block-md_block))
Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using BlockBandedMatrices
using LinearAlgebra
using Test

using Aqua
import Aqua
@testset "Project quality" begin
Aqua.test_all(BlockBandedMatrices, ambiguities=false, piracies=false)
end
Expand Down
8 changes: 6 additions & 2 deletions test/test_adjtransblockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module TestAdjTransBlockBanded

using ArrayLayouts, BlockBandedMatrices, Test
import BlockBandedMatrices: BandedBlockBandedRowMajor, BandedBlockBandedRows,
BandedBlockBandedColumns, BlockBandedRows,
import BlockBandedMatrices: BandedBlockBandedRowMajor, BandedBlockBandedRows,
BandedBlockBandedColumns, BlockBandedRows,
BlockBandedColumns, blockcolsupport, blockrowsupport

@testset "Adj/Trans" begin
Expand Down Expand Up @@ -62,3 +64,5 @@ import BlockBandedMatrices: BandedBlockBandedRowMajor, BandedBlockBandedRows,
@test colsupport(E2', 1) == 1:0
end
end

end # module
4 changes: 4 additions & 0 deletions test/test_bandedblockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestBandedBlockBanded

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand Down Expand Up @@ -564,3 +566,5 @@ if false # turned off since tests have check-bounds=yes
BandedMatrices.inbands_setindex!(V, -2, 5, 1)
@test A[2,1] == -2
end

end # module
4 changes: 4 additions & 0 deletions test/test_blockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestBlockBanded

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand Down Expand Up @@ -246,3 +248,5 @@ import BlockBandedMatrices: MemoryLayout, ColumnMajor, BroadcastStyle,
@inferred(f(s))
end
end

end # module
4 changes: 4 additions & 0 deletions test/test_blockskyline.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestBlockSkyline

using ArrayLayouts
using BlockArrays
using BlockBandedMatrices
Expand Down Expand Up @@ -163,3 +165,5 @@ Random.seed!(0)
@test s == " 1 │ 0 0 │ ⋅ ⋅ ⋅ │ ⋅ ⋅ ⋅ ⋅"
end
end

end # module
4 changes: 4 additions & 0 deletions test/test_blockskylineqr.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestBlockSkylineQR

using BlockBandedMatrices
using BlockArrays
using LinearAlgebra
Expand Down Expand Up @@ -201,3 +203,5 @@ end
# @time F = qr(A); # 11s
# b = randn(size(A,1));
# @time F\b; # 0.6s

end # module
4 changes: 4 additions & 0 deletions test/test_broadcasting.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestBroadcasting

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand Down Expand Up @@ -287,3 +289,5 @@ import Base: oneto
end
end
end

end # module
7 changes: 5 additions & 2 deletions test/test_linalg.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestLinalg

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand All @@ -6,8 +8,7 @@ using LinearAlgebra
using Test

import BandedMatrices: BandError, bandeddata
import BlockBandedMatrices: _BandedBlockBandedMatrix, MemoryLayout, mul!,
blockcolstop, blockrowstop, BlockSkylineSizes
import BlockBandedMatrices: _BandedBlockBandedMatrix

@testset "lmul!/rmul!" begin
C = BandedBlockBandedMatrix{Float64}(undef, 1:2,1:2, (1,1), (1,1))
Expand Down Expand Up @@ -201,3 +202,5 @@ end
@test cholesky(Symmetric(Δ)).U cholesky(Matrix(Δ)).U
@test cholesky(Symmetric(Δ,:L)).U cholesky(Matrix(Δ)).U
end

end # module
3 changes: 3 additions & 0 deletions test/test_misc.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestMisc

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand Down Expand Up @@ -246,3 +248,4 @@ Base.size(F::FiniteDifference) = (F.n,F.n)
end
end

end # module
5 changes: 4 additions & 1 deletion test/test_triblockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module TestTriBlockBanded

using ArrayLayouts
using BandedMatrices
using BlockArrays
Expand All @@ -7,7 +9,6 @@ using Test

import BlockBandedMatrices: MemoryLayout, TriangularLayout,
BandedBlockBandedColumnMajor,
BandedColumnMajor, BlockSkylineSizes,
blockrowstop, blockcolstop, ColumnMajor

import BlockArrays: blockisequal
Expand Down Expand Up @@ -209,3 +210,5 @@ import BlockArrays: blockisequal
@test UpperTriangular(V2) \ b UpperTriangular(V) \ b
end
end

end # module

0 comments on commit f04db68

Please sign in to comment.