From e256f3a8187fff808f51fe9a6f25558b5d5dc96f Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 07:19:38 -0400 Subject: [PATCH 1/9] compat: declare SciMLTesting 2.4 Co-Authored-By: Chris Rackauckas --- Project.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Project.toml b/Project.toml index 7452aec..28da4f0 100644 --- a/Project.toml +++ b/Project.toml @@ -24,4 +24,8 @@ LinearAlgebra = "1" MatrixFactorizations = "3.1.3" PrecompileTools = "1.0.1" Reexport = "1" +SciMLTesting = "2.4" julia = "1.10" + +[extras] +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" From b379047ab43331eee600ed64939153bd72200eea Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 07:37:30 -0400 Subject: [PATCH 2/9] compat: use SciMLTesting 2.10 Co-Authored-By: Chris Rackauckas --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 28da4f0..92c8002 100644 --- a/Project.toml +++ b/Project.toml @@ -24,7 +24,7 @@ LinearAlgebra = "1" MatrixFactorizations = "3.1.3" PrecompileTools = "1.0.1" Reexport = "1" -SciMLTesting = "2.4" +SciMLTesting = "2.10" julia = "1.10" [extras] From 7ee55b96b5c2758003fb6817f8802a7ce63790fe Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 12:18:16 -0400 Subject: [PATCH 3/9] qa: remove blanket BandedMatrices reexports Co-Authored-By: Chris Rackauckas --- Project.toml | 2 -- README.md | 4 ++-- docs/Project.toml | 2 ++ docs/make.jl | 1 - docs/src/index.md | 2 +- src/FastAlmostBandedMatrices.jl | 28 +++++++++++++++++++++++++--- test/Project.toml | 2 ++ test/core_tests.jl | 12 ++++++------ test/qa/alloc_tests.jl | 1 + test/qa/qa.jl | 12 ++---------- 10 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Project.toml b/Project.toml index 92c8002..c6f3a25 100644 --- a/Project.toml +++ b/Project.toml @@ -12,7 +12,6 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MatrixFactorizations = "a3b82374-2e81-5b9e-98ce-41277c0e4c87" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] ArrayInterface = "7.5" @@ -23,7 +22,6 @@ LazyArrays = "2" LinearAlgebra = "1" MatrixFactorizations = "3.1.3" PrecompileTools = "1.0.1" -Reexport = "1" SciMLTesting = "2.10" julia = "1.10" diff --git a/README.md b/README.md index ef78070..4b760ed 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ repository. ### Basic Construction and Usage ```julia -using FastAlmostBandedMatrices, LinearAlgebra +using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension @@ -58,7 +58,7 @@ Q, R = fact.Q, fact.R

```julia -using BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra +using BandedMatrices, BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra import SemiseparableMatrices m = 5 diff --git a/docs/Project.toml b/docs/Project.toml index 27e6da7..4d67b79 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,8 @@ [deps] +BandedMatrices = "aae01518-5342-5314-be14-df237901396f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" FastAlmostBandedMatrices = "9d29842c-ecb8-4973-b1e9-a27b1157504e" [compat] +BandedMatrices = "1.11" Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index ff16a22..c507af4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -5,7 +5,6 @@ makedocs(; authors = "Avik Pal et al.", modules = [FastAlmostBandedMatrices], clean = true, - doctest = false, linkcheck = false, checkdocs = :exports, format = Documenter.HTML(; diff --git a/docs/src/index.md b/docs/src/index.md index 4cd086d..0ea1cd2 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -22,7 +22,7 @@ Pkg.add("FastAlmostBandedMatrices") ## Basic Construction and Usage ```julia -using FastAlmostBandedMatrices, LinearAlgebra +using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension diff --git a/src/FastAlmostBandedMatrices.jl b/src/FastAlmostBandedMatrices.jl index c0e4b4f..a3b67ef 100644 --- a/src/FastAlmostBandedMatrices.jl +++ b/src/FastAlmostBandedMatrices.jl @@ -3,7 +3,7 @@ module FastAlmostBandedMatrices import PrecompileTools: @setup_workload, @compile_workload using ArrayInterface, ArrayLayouts, BandedMatrices, ConcreteStructs, LazyArrays, - LinearAlgebra, MatrixFactorizations, Reexport + LinearAlgebra, MatrixFactorizations import ArrayLayouts: MemoryLayout, sublayout, MatLdivVec, materialize!, triangularlayout, triangulardata, colsupport, @@ -12,8 +12,6 @@ import BandedMatrices: _banded_qr!, banded_qr_lmul! import LinearAlgebra: ldiv! import MatrixFactorizations: QR, QRPackedQ, getQ, getR -@reexport using BandedMatrices - # ------------------ # DisjointRange - for zero-allocation colsupport # ------------------ @@ -117,6 +115,11 @@ overlapping bit. - `rank::Integer`: Number of rows in the fill component for an `undef` construction. It must be positive and no greater than `lu[2] + 1`. +# Fields + +- `bands`: Banded storage, including the part that overlaps with `fill`. +- `fill`: Dense or lazy low-rank storage for the leading rows. + # Notes Construction synchronizes the overlapping entries by copying the fill component into the @@ -144,10 +147,17 @@ part. # Example ```julia +using BandedMatrices + bands = brand(Float64, 8, 8, 3, 2) fill = rand(2, 8) A = AlmostBandedMatrix(bands, fill) ``` + +# Errors + +Throws `AssertionError` if `fill` has no rows, if `bands` and `fill` have different numbers +of columns, or if the lower bandwidth of `bands` is too small for the fill rank. """ @concrete struct AlmostBandedMatrix{T} <: LayoutMatrix{T} bands @@ -218,6 +228,8 @@ not mutated. # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 8, 8, 3, 2), rand(2, 8)) fillpart(A)[1, 1] = 1 finish_part_setindex!(A) @@ -252,6 +264,8 @@ Returns the mutable `BandedMatrix` stored by `A`; it is not a copy. # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) B = bandpart(A) # Returns the BandedMatrix component ``` @@ -276,6 +290,8 @@ Returns the mutable fill matrix stored by `A`; it is not a copy. Call # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) F = fillpart(A) # Returns the fill matrix (2×10) ``` @@ -299,6 +315,8 @@ Returns a view into `bandpart(A)`, not a copy. # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) E = exclusive_bandpart(A) # Returns a view of rows 3:10 of the banded part ``` @@ -325,6 +343,8 @@ Returns `(l, u)`, where `l` is the lower bandwidth and `u` is the upper bandwidt # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandwidths(A) # Returns (3, 2) ``` @@ -351,6 +371,8 @@ Returns the number of rows in `fillpart(A)`. # Example ```julia +using BandedMatrices + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandedrank(A) # Returns 2 ``` diff --git a/test/Project.toml b/test/Project.toml index 5c80ac1..a4e675c 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" +BandedMatrices = "aae01518-5342-5314-be14-df237901396f" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MatrixFactorizations = "a3b82374-2e81-5b9e-98ce-41277c0e4c87" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" @@ -9,6 +10,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] ArrayLayouts = "1.12.2" +BandedMatrices = "1.11" MatrixFactorizations = "3.1.3" SafeTestsets = "0.1.0" SciMLTesting = "2.4" diff --git a/test/core_tests.jl b/test/core_tests.jl index 67b86ca..29d0317 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -1,7 +1,7 @@ using SafeTestsets @safetestset "Constructors" begin - using FastAlmostBandedMatrices + using BandedMatrices, FastAlmostBandedMatrices A = AlmostBandedMatrix{Float64}(undef, (10, 11), (2, 1), 2) A[1, 1] = 2 @@ -17,7 +17,7 @@ using SafeTestsets end @safetestset "similar" begin - using FastAlmostBandedMatrices + using BandedMatrices, FastAlmostBandedMatrices A = AlmostBandedMatrix(brand(Float64, 10, 10, 2, 1), rand(Float64, 2, 10)) @@ -30,7 +30,7 @@ end end @safetestset "Copy" begin - using FastAlmostBandedMatrices + using BandedMatrices, FastAlmostBandedMatrices n = 5 m = 2 @@ -48,7 +48,7 @@ end end @safetestset "QR" begin - using LinearAlgebra, FastAlmostBandedMatrices + using BandedMatrices, LinearAlgebra, FastAlmostBandedMatrices import MatrixFactorizations: QRPackedQ n = 80 @@ -76,7 +76,7 @@ end end @safetestset "Triangular" begin - using LinearAlgebra, ArrayLayouts, FastAlmostBandedMatrices + using BandedMatrices, LinearAlgebra, ArrayLayouts, FastAlmostBandedMatrices import FastAlmostBandedMatrices: AlmostBandedLayout n = 80 @@ -92,7 +92,7 @@ end # https://github.com/SciML/FastAlmostBandedMatrices.jl/issues/19 @safetestset "fill! on sparse array with BigFloat" begin - using FastAlmostBandedMatrices, SparseArrays + using BandedMatrices, FastAlmostBandedMatrices, SparseArrays A = sparse([1, 2], [1, 5], big.([1.0, 1.0])) A1 = AlmostBandedMatrix(brand(BigFloat, 5, 5, 1, 1), A) diff --git a/test/qa/alloc_tests.jl b/test/qa/alloc_tests.jl index c24ba51..98c9eb9 100644 --- a/test/qa/alloc_tests.jl +++ b/test/qa/alloc_tests.jl @@ -1,4 +1,5 @@ using AllocCheck +using BandedMatrices using FastAlmostBandedMatrices using FastAlmostBandedMatrices: DisjointRange using ArrayLayouts: colsupport, rowsupport diff --git a/test/qa/qa.jl b/test/qa/qa.jl index a10a599..45fb9ad 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,15 +1,7 @@ using SciMLTesting, FastAlmostBandedMatrices -const REEXPORTED_API = ( - :Band, :BandError, :BandRange, :BandedMatrices, :BandedMatrix, - :Eye, :Fill, :Ones, :Zeros, - :band, :bandrange, :bandwidth, :bandwidths, :brand, :brandn, - :colrange, :rowrange, :symrcm, -) - run_qa( FastAlmostBandedMatrices; - reexports_allow = REEXPORTED_API, # 19 method ambiguities, all in FastAlmostBandedMatrices' own ldiv!/__arguments # against ArrayLayouts/LinearAlgebra Triangular/Factorization methods. # https://github.com/SciML/FastAlmostBandedMatrices.jl/issues/71 @@ -38,8 +30,8 @@ run_qa( ), ), # 31 names implicitly imported via the package's `using ArrayInterface, ArrayLayouts, - # BandedMatrices, ConcreteStructs, LazyArrays, LinearAlgebra, ...` plus - # `@reexport using BandedMatrices`; explicit-import conversion tracked separately. + # BandedMatrices, ConcreteStructs, LazyArrays, LinearAlgebra, ...`; explicit-import + # conversion tracked separately. # https://github.com/SciML/FastAlmostBandedMatrices.jl/issues/71 ei_broken = (:no_implicit_imports,), ) From 9f8730fc77c2075fcc54c98e6c2b144f6ad391de Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 12:24:37 -0400 Subject: [PATCH 4/9] compat: keep BandedMatrices test range broad Co-Authored-By: Chris Rackauckas --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index a4e675c..53e252d 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -10,7 +10,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] ArrayLayouts = "1.12.2" -BandedMatrices = "1.11" +BandedMatrices = "1" MatrixFactorizations = "3.1.3" SafeTestsets = "0.1.0" SciMLTesting = "2.4" From 13bea03d22ca87b83d6be2f2a27f9e0c4ffe3749 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 21:11:43 -0400 Subject: [PATCH 5/9] qa: narrow banded construction reexports Keep the blanket BandedMatrices reexport removed while preserving the documented construction path through FastAlmostBandedMatrices itself. Reexport only BandedMatrix and brand, document that small construction-helper surface, and cover it with a focused Core test. Co-Authored-By: Chris Rackauckas --- README.md | 4 ++-- docs/Project.toml | 2 -- docs/src/api.md | 6 ++++++ docs/src/index.md | 2 +- src/FastAlmostBandedMatrices.jl | 23 +++++------------------ test/core_tests.jl | 11 +++++++++++ test/qa/qa.jl | 3 +++ 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 4b760ed..ef78070 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ repository. ### Basic Construction and Usage ```julia -using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra +using FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension @@ -58,7 +58,7 @@ Q, R = fact.Q, fact.R

```julia -using BandedMatrices, BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra +using BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra import SemiseparableMatrices m = 5 diff --git a/docs/Project.toml b/docs/Project.toml index 4d67b79..27e6da7 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,8 +1,6 @@ [deps] -BandedMatrices = "aae01518-5342-5314-be14-df237901396f" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" FastAlmostBandedMatrices = "9d29842c-ecb8-4973-b1e9-a27b1157504e" [compat] -BandedMatrices = "1.11" Documenter = "1" diff --git a/docs/src/api.md b/docs/src/api.md index 6b70217..2c921bc 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -8,6 +8,12 @@ The following names make up the public API of FastAlmostBandedMatrices.jl. AlmostBandedMatrix ``` +## Banded Construction Helpers + +`FastAlmostBandedMatrices` reexports the `BandedMatrices` constructor helpers needed by the +documented construction examples: `BandedMatrix` for explicit banded storage and `brand` +for random banded test matrices. + ## Accessing the Parts ```@docs diff --git a/docs/src/index.md b/docs/src/index.md index 0ea1cd2..4cd086d 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -22,7 +22,7 @@ Pkg.add("FastAlmostBandedMatrices") ## Basic Construction and Usage ```julia -using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra +using FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension diff --git a/src/FastAlmostBandedMatrices.jl b/src/FastAlmostBandedMatrices.jl index a3b67ef..5a133ec 100644 --- a/src/FastAlmostBandedMatrices.jl +++ b/src/FastAlmostBandedMatrices.jl @@ -2,8 +2,9 @@ module FastAlmostBandedMatrices import PrecompileTools: @setup_workload, @compile_workload -using ArrayInterface, ArrayLayouts, BandedMatrices, ConcreteStructs, LazyArrays, - LinearAlgebra, MatrixFactorizations +using ArrayInterface, ArrayLayouts, ConcreteStructs, LazyArrays, LinearAlgebra, + MatrixFactorizations +using BandedMatrices: BandedMatrix, bandwidth, bandwidths, brand import ArrayLayouts: MemoryLayout, sublayout, MatLdivVec, materialize!, triangularlayout, triangulardata, colsupport, @@ -147,8 +148,6 @@ part. # Example ```julia -using BandedMatrices - bands = brand(Float64, 8, 8, 3, 2) fill = rand(2, 8) A = AlmostBandedMatrix(bands, fill) @@ -228,8 +227,6 @@ not mutated. # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 8, 8, 3, 2), rand(2, 8)) fillpart(A)[1, 1] = 1 finish_part_setindex!(A) @@ -264,8 +261,6 @@ Returns the mutable `BandedMatrix` stored by `A`; it is not a copy. # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) B = bandpart(A) # Returns the BandedMatrix component ``` @@ -290,8 +285,6 @@ Returns the mutable fill matrix stored by `A`; it is not a copy. Call # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) F = fillpart(A) # Returns the fill matrix (2×10) ``` @@ -315,8 +308,6 @@ Returns a view into `bandpart(A)`, not a copy. # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) E = exclusive_bandpart(A) # Returns a view of rows 3:10 of the banded part ``` @@ -343,8 +334,6 @@ Returns `(l, u)`, where `l` is the lower bandwidth and `u` is the upper bandwidt # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandwidths(A) # Returns (3, 2) ``` @@ -371,8 +360,6 @@ Returns the number of rows in `fillpart(A)`. # Example ```julia -using BandedMatrices - A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandedrank(A) # Returns 2 ``` @@ -791,7 +778,7 @@ end end end -export AlmostBandedMatrix, bandpart, fillpart, exclusive_bandpart, finish_part_setindex!, - almostbandwidths, almostbandedrank +export AlmostBandedMatrix, BandedMatrix, brand, bandpart, fillpart, exclusive_bandpart, + finish_part_setindex!, almostbandwidths, almostbandedrank end diff --git a/test/core_tests.jl b/test/core_tests.jl index 29d0317..cdff205 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -1,5 +1,16 @@ using SafeTestsets +@safetestset "Documented construction API" begin + using FastAlmostBandedMatrices + + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) + + @test A isa AlmostBandedMatrix + @test bandpart(A) isa BandedMatrix + @test almostbandwidths(A) == (3, 2) + @test almostbandedrank(A) == 2 +end + @safetestset "Constructors" begin using BandedMatrices, FastAlmostBandedMatrices diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 45fb9ad..3e7f0aa 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,7 +1,10 @@ using SciMLTesting, FastAlmostBandedMatrices +const REEXPORTED_API = (:BandedMatrix, :brand) + run_qa( FastAlmostBandedMatrices; + reexports_allow = REEXPORTED_API, # 19 method ambiguities, all in FastAlmostBandedMatrices' own ldiv!/__arguments # against ArrayLayouts/LinearAlgebra Triangular/Factorization methods. # https://github.com/SciML/FastAlmostBandedMatrices.jl/issues/71 From 9802a6f8e9e3d4045182551bdc06fb11675146f2 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 15 Aug 2026 23:12:23 -0400 Subject: [PATCH 6/9] docs: document retained banded constructors Co-Authored-By: Chris Rackauckas --- docs/src/api.md | 11 +++++-- src/FastAlmostBandedMatrices.jl | 56 ++++++++++++++++++++++++++++++++- test/core_tests.jl | 3 ++ 3 files changed, 66 insertions(+), 4 deletions(-) diff --git a/docs/src/api.md b/docs/src/api.md index 2c921bc..0ff4c62 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -10,9 +10,14 @@ AlmostBandedMatrix ## Banded Construction Helpers -`FastAlmostBandedMatrices` reexports the `BandedMatrices` constructor helpers needed by the -documented construction examples: `BandedMatrix` for explicit banded storage and `brand` -for random banded test matrices. +`BandedMatrix` and `brand` are reexported because they are the public constructors used by +the documented `AlmostBandedMatrix` construction workflow. Other banded-matrix utilities +should be imported from `BandedMatrices` directly. + +```@docs +BandedMatrix +brand +``` ## Accessing the Parts diff --git a/src/FastAlmostBandedMatrices.jl b/src/FastAlmostBandedMatrices.jl index 5a133ec..42bb816 100644 --- a/src/FastAlmostBandedMatrices.jl +++ b/src/FastAlmostBandedMatrices.jl @@ -4,7 +4,61 @@ import PrecompileTools: @setup_workload, @compile_workload using ArrayInterface, ArrayLayouts, ConcreteStructs, LazyArrays, LinearAlgebra, MatrixFactorizations -using BandedMatrices: BandedMatrix, bandwidth, bandwidths, brand +import BandedMatrices +using BandedMatrices: bandwidth, bandwidths + +""" + BandedMatrix(A::AbstractMatrix, bandwidths::NTuple{2, Integer}) + +Construct a banded matrix from an array and its lower and upper bandwidths. This is the +banded storage type accepted by [`AlmostBandedMatrix`](@ref) and is reexported here because +it is part of the documented construction workflow. + +# Arguments + +- `A::AbstractMatrix`: Values used to initialize the banded matrix. +- `bandwidths::NTuple{2, Integer}`: Lower and upper bandwidths `(l, u)`. + +# Returns + +Returns a `BandedMatrix` with the requested bandwidths. + +# Example + +```julia +bands = BandedMatrix(fill(0.0, 8, 8), (3, 2)) +A = AlmostBandedMatrix(bands, rand(2, 8)) +``` +""" +const BandedMatrix = BandedMatrices.BandedMatrix + +""" + brand(T, n, m, l, u) + +Construct a random `n`-by-`m` banded matrix with element type `T` and lower and upper +bandwidths `l` and `u`. This constructor is reexported because it is used by the documented +`AlmostBandedMatrix` examples. + +# Arguments + +- `T`: Element type of the generated matrix. +- `n::Integer`: Number of rows. +- `m::Integer`: Number of columns. +- `l::Integer`: Number of subdiagonals. +- `u::Integer`: Number of superdiagonals. + +# Returns + +Returns a `BandedMatrix{T}` whose entries inside the bandwidths are random. + +# Example + +```julia +bands = brand(Float64, 8, 8, 3, 2) +A = AlmostBandedMatrix(bands, rand(2, 8)) +``` +""" +const brand = BandedMatrices.brand import ArrayLayouts: MemoryLayout, sublayout, MatLdivVec, materialize!, triangularlayout, triangulardata, colsupport, diff --git a/test/core_tests.jl b/test/core_tests.jl index cdff205..037b3cb 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -4,11 +4,14 @@ using SafeTestsets using FastAlmostBandedMatrices A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) + bands = BandedMatrix(fill(1.0, 10, 10), (3, 2)) + B = AlmostBandedMatrix(bands, rand(Float64, 2, 10)) @test A isa AlmostBandedMatrix @test bandpart(A) isa BandedMatrix @test almostbandwidths(A) == (3, 2) @test almostbandedrank(A) == 2 + @test B isa AlmostBandedMatrix end @safetestset "Constructors" begin From bc529fa769b87c4d9f1159ddfd86ae4cf4af927d Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 16 Aug 2026 05:10:58 -0400 Subject: [PATCH 7/9] test: pin intended banded exports Assert that the documented BandedMatrix and brand helpers remain exported while representative blanket BandedMatrices names do not.\n\nCo-Authored-By: Chris Rackauckas --- test/core_tests.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/core_tests.jl b/test/core_tests.jl index 037b3cb..424240a 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -3,6 +3,10 @@ using SafeTestsets @safetestset "Documented construction API" begin using FastAlmostBandedMatrices + exported = Set(names(FastAlmostBandedMatrices; all = false)) + @test (:BandedMatrix in exported) && (:brand in exported) + @test all(name ∉ exported for name in (:Band, :Fill, :band, :bandwidth, :brandn)) + A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) bands = BandedMatrix(fill(1.0, 10, 10), (3, 2)) B = AlmostBandedMatrix(bands, rand(Float64, 2, 10)) From 6a5f54a4156976c090d5bb4686a2147997566e71 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 16 Aug 2026 11:41:30 -0400 Subject: [PATCH 8/9] qa: retain only documented banded helper Co-Authored-By: Chris Rackauckas --- README.md | 1 + docs/src/api.md | 9 +++---- src/FastAlmostBandedMatrices.jl | 43 ++++++++------------------------- test/core_tests.jl | 10 ++++---- test/qa/qa.jl | 2 +- 5 files changed, 21 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index ef78070..43b87ee 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ and each name is documented in the REPL help mode as well. ``` AlmostBandedMatrix +brand bandpart fillpart exclusive_bandpart diff --git a/docs/src/api.md b/docs/src/api.md index 0ff4c62..abeb582 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -8,14 +8,13 @@ The following names make up the public API of FastAlmostBandedMatrices.jl. AlmostBandedMatrix ``` -## Banded Construction Helpers +## Banded Construction Helper -`BandedMatrix` and `brand` are reexported because they are the public constructors used by -the documented `AlmostBandedMatrix` construction workflow. Other banded-matrix utilities -should be imported from `BandedMatrices` directly. +`brand` is reexported because it is used by the documented `AlmostBandedMatrix` construction +workflow. Other banded-matrix types and utilities should be imported from `BandedMatrices` +directly. ```@docs -BandedMatrix brand ``` diff --git a/src/FastAlmostBandedMatrices.jl b/src/FastAlmostBandedMatrices.jl index 42bb816..5b0867f 100644 --- a/src/FastAlmostBandedMatrices.jl +++ b/src/FastAlmostBandedMatrices.jl @@ -7,31 +7,6 @@ using ArrayInterface, ArrayLayouts, ConcreteStructs, LazyArrays, LinearAlgebra, import BandedMatrices using BandedMatrices: bandwidth, bandwidths -""" - BandedMatrix(A::AbstractMatrix, bandwidths::NTuple{2, Integer}) - -Construct a banded matrix from an array and its lower and upper bandwidths. This is the -banded storage type accepted by [`AlmostBandedMatrix`](@ref) and is reexported here because -it is part of the documented construction workflow. - -# Arguments - -- `A::AbstractMatrix`: Values used to initialize the banded matrix. -- `bandwidths::NTuple{2, Integer}`: Lower and upper bandwidths `(l, u)`. - -# Returns - -Returns a `BandedMatrix` with the requested bandwidths. - -# Example - -```julia -bands = BandedMatrix(fill(0.0, 8, 8), (3, 2)) -A = AlmostBandedMatrix(bands, rand(2, 8)) -``` -""" -const BandedMatrix = BandedMatrices.BandedMatrix - """ brand(T, n, m, l, u) @@ -49,7 +24,7 @@ bandwidths `l` and `u`. This constructor is reexported because it is used by the # Returns -Returns a `BandedMatrix{T}` whose entries inside the bandwidths are random. +Returns a `BandedMatrices.BandedMatrix{T}` whose entries inside the bandwidths are random. # Example @@ -148,7 +123,7 @@ abstract type AbstractAlmostBandedLayout <: MemoryLayout end struct AlmostBandedLayout <: AbstractAlmostBandedLayout end """ - AlmostBandedMatrix(bands::BandedMatrix, fill) + AlmostBandedMatrix(bands::BandedMatrices.BandedMatrix, fill) AlmostBandedMatrix{T}(bands, fill) AlmostBandedMatrix(::UndefInitializer, [::Type{T} = Float64], mn::NTuple{2, Integer}, lu::NTuple{2, Integer}, rank::Integer) @@ -223,7 +198,7 @@ function AlmostBandedMatrix( ) where {T} @assert lu[2] ≥ rank - 1 @assert rank ≥ 1 "Rank 0 fill array makes it a BandedMatrix." - bands = BandedMatrix{T}(undef, mn, lu) + bands = BandedMatrices.BandedMatrix{T}(undef, mn, lu) fill = Matrix{T}(undef, rank, mn[2]) return AlmostBandedMatrix{T}(bands, fill) end @@ -243,7 +218,7 @@ function AlmostBandedMatrix( return AlmostBandedMatrix(undef, Float64, mn, lu, rank) end -function AlmostBandedMatrix(bands::BandedMatrix, fill::AbstractMatrix) +function AlmostBandedMatrix(bands::BandedMatrices.BandedMatrix, fill::AbstractMatrix) @assert size(fill, 2) == size(bands, 2) @assert size(fill, 1) ≥ 1 "Rank 0 fill array makes it a BandedMatrix." T = promote_type(eltype(fill), eltype(bands)) @@ -592,7 +567,9 @@ function _almostbanded_qr(_, A) # Expand the bandsize for the QR factorization ## Bypass the safety checks in `AlmostBandedMatrix` return almostbanded_qr!( - AlmostBandedMatrix{eltype(A)}(BandedMatrix(copy(B), (l, l + u)), copy(L)), Val(true) + AlmostBandedMatrix{eltype(A)}( + BandedMatrices.BandedMatrix(copy(B), (l, l + u)), copy(L) + ), Val(true) ) end @@ -600,7 +577,7 @@ end function almostbanded_qr!(R::AbstractMatrix{T}, ::Val{false}) where {T} l, u = almostbandwidths(R) B, L = bandpart(R), fillpart(R) - R′ = AlmostBandedMatrix{eltype(R)}(BandedMatrix(B, (l, l + u)), L) + R′ = AlmostBandedMatrix{eltype(R)}(BandedMatrices.BandedMatrix(B, (l, l + u)), L) return almostbanded_qr!(R′, Val(true)) end @@ -832,7 +809,7 @@ end end end -export AlmostBandedMatrix, BandedMatrix, brand, bandpart, fillpart, exclusive_bandpart, - finish_part_setindex!, almostbandwidths, almostbandedrank +export AlmostBandedMatrix, brand, bandpart, fillpart, exclusive_bandpart, finish_part_setindex!, + almostbandwidths, almostbandedrank end diff --git a/test/core_tests.jl b/test/core_tests.jl index 424240a..9eab24a 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -1,18 +1,18 @@ using SafeTestsets @safetestset "Documented construction API" begin - using FastAlmostBandedMatrices + using BandedMatrices, FastAlmostBandedMatrices exported = Set(names(FastAlmostBandedMatrices; all = false)) - @test (:BandedMatrix in exported) && (:brand in exported) - @test all(name ∉ exported for name in (:Band, :Fill, :band, :bandwidth, :brandn)) + @test :brand in exported + @test all(name ∉ exported for name in (:Band, :BandedMatrix, :Fill, :band, :bandwidth, :brandn)) A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) - bands = BandedMatrix(fill(1.0, 10, 10), (3, 2)) + bands = BandedMatrices.BandedMatrix(fill(1.0, 10, 10), (3, 2)) B = AlmostBandedMatrix(bands, rand(Float64, 2, 10)) @test A isa AlmostBandedMatrix - @test bandpart(A) isa BandedMatrix + @test bandpart(A) isa BandedMatrices.BandedMatrix @test almostbandwidths(A) == (3, 2) @test almostbandedrank(A) == 2 @test B isa AlmostBandedMatrix diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 3e7f0aa..74bd60c 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,6 +1,6 @@ using SciMLTesting, FastAlmostBandedMatrices -const REEXPORTED_API = (:BandedMatrix, :brand) +const REEXPORTED_API = (:brand,) run_qa( FastAlmostBandedMatrices; From 9868805889817ff1226b70eae5d1651a6ed7fd3b Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Mon, 17 Aug 2026 01:12:41 -0400 Subject: [PATCH 9/9] qa: remove undocumented banded alias Use BandedMatrices.brand explicitly in documented construction examples and keep the FastAlmostBandedMatrices API limited to its own documented names. Co-Authored-By: Chris Rackauckas --- README.md | 5 ++-- docs/src/api.md | 10 ------- docs/src/index.md | 2 +- src/FastAlmostBandedMatrices.jl | 46 +++++++-------------------------- test/core_tests.jl | 2 +- test/qa/qa.jl | 3 --- 6 files changed, 13 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 43b87ee..4b760ed 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ repository. ### Basic Construction and Usage ```julia -using FastAlmostBandedMatrices, LinearAlgebra +using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension @@ -58,7 +58,7 @@ Q, R = fact.Q, fact.R

```julia -using BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra +using BandedMatrices, BenchmarkTools, FastAlmostBandedMatrices, SparseArrays, FillArrays, LinearAlgebra import SemiseparableMatrices m = 5 @@ -183,7 +183,6 @@ and each name is documented in the REPL help mode as well. ``` AlmostBandedMatrix -brand bandpart fillpart exclusive_bandpart diff --git a/docs/src/api.md b/docs/src/api.md index abeb582..6b70217 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -8,16 +8,6 @@ The following names make up the public API of FastAlmostBandedMatrices.jl. AlmostBandedMatrix ``` -## Banded Construction Helper - -`brand` is reexported because it is used by the documented `AlmostBandedMatrix` construction -workflow. Other banded-matrix types and utilities should be imported from `BandedMatrices` -directly. - -```@docs -brand -``` - ## Accessing the Parts ```@docs diff --git a/docs/src/index.md b/docs/src/index.md index 4cd086d..0ea1cd2 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -22,7 +22,7 @@ Pkg.add("FastAlmostBandedMatrices") ## Basic Construction and Usage ```julia -using FastAlmostBandedMatrices, LinearAlgebra +using BandedMatrices, FastAlmostBandedMatrices, LinearAlgebra m = 2 # Fill rank n = 10 # Matrix dimension diff --git a/src/FastAlmostBandedMatrices.jl b/src/FastAlmostBandedMatrices.jl index 5b0867f..d93cb49 100644 --- a/src/FastAlmostBandedMatrices.jl +++ b/src/FastAlmostBandedMatrices.jl @@ -7,34 +7,6 @@ using ArrayInterface, ArrayLayouts, ConcreteStructs, LazyArrays, LinearAlgebra, import BandedMatrices using BandedMatrices: bandwidth, bandwidths -""" - brand(T, n, m, l, u) - -Construct a random `n`-by-`m` banded matrix with element type `T` and lower and upper -bandwidths `l` and `u`. This constructor is reexported because it is used by the documented -`AlmostBandedMatrix` examples. - -# Arguments - -- `T`: Element type of the generated matrix. -- `n::Integer`: Number of rows. -- `m::Integer`: Number of columns. -- `l::Integer`: Number of subdiagonals. -- `u::Integer`: Number of superdiagonals. - -# Returns - -Returns a `BandedMatrices.BandedMatrix{T}` whose entries inside the bandwidths are random. - -# Example - -```julia -bands = brand(Float64, 8, 8, 3, 2) -A = AlmostBandedMatrix(bands, rand(2, 8)) -``` -""" -const brand = BandedMatrices.brand - import ArrayLayouts: MemoryLayout, sublayout, MatLdivVec, materialize!, triangularlayout, triangulardata, colsupport, rowsupport, _qr, _qr!, _factorize, muladd!, QRPackedQLayout, AdjQRPackedQLayout @@ -177,7 +149,7 @@ part. # Example ```julia -bands = brand(Float64, 8, 8, 3, 2) +bands = BandedMatrices.brand(Float64, 8, 8, 3, 2) fill = rand(2, 8) A = AlmostBandedMatrix(bands, fill) ``` @@ -256,7 +228,7 @@ not mutated. # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 8, 8, 3, 2), rand(2, 8)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 8, 8, 3, 2), rand(2, 8)) fillpart(A)[1, 1] = 1 finish_part_setindex!(A) ``` @@ -290,7 +262,7 @@ Returns the mutable `BandedMatrix` stored by `A`; it is not a copy. # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) B = bandpart(A) # Returns the BandedMatrix component ``` """ @@ -314,7 +286,7 @@ Returns the mutable fill matrix stored by `A`; it is not a copy. Call # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) F = fillpart(A) # Returns the fill matrix (2×10) ``` """ @@ -337,7 +309,7 @@ Returns a view into `bandpart(A)`, not a copy. # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) E = exclusive_bandpart(A) # Returns a view of rows 3:10 of the banded part ``` """ @@ -363,7 +335,7 @@ Returns `(l, u)`, where `l` is the lower bandwidth and `u` is the upper bandwidt # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandwidths(A) # Returns (3, 2) ``` """ @@ -389,7 +361,7 @@ Returns the number of rows in `fillpart(A)`. # Example ```julia -A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) +A = AlmostBandedMatrix(BandedMatrices.brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) almostbandedrank(A) # Returns 2 ``` """ @@ -794,7 +766,7 @@ end m = 2 n = 10 for T in (Float32, Float64) - B = brand(T, n, n, m + 1, m) + B = BandedMatrices.brand(T, n, n, m + 1, m) F = rand(T, m, n) @compile_workload begin @@ -809,7 +781,7 @@ end end end -export AlmostBandedMatrix, brand, bandpart, fillpart, exclusive_bandpart, finish_part_setindex!, +export AlmostBandedMatrix, bandpart, fillpart, exclusive_bandpart, finish_part_setindex!, almostbandwidths, almostbandedrank end diff --git a/test/core_tests.jl b/test/core_tests.jl index 9eab24a..2b091ff 100644 --- a/test/core_tests.jl +++ b/test/core_tests.jl @@ -4,7 +4,7 @@ using SafeTestsets using BandedMatrices, FastAlmostBandedMatrices exported = Set(names(FastAlmostBandedMatrices; all = false)) - @test :brand in exported + @test :brand ∉ exported @test all(name ∉ exported for name in (:Band, :BandedMatrix, :Fill, :band, :bandwidth, :brandn)) A = AlmostBandedMatrix(brand(Float64, 10, 10, 3, 2), rand(Float64, 2, 10)) diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 74bd60c..45fb9ad 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,10 +1,7 @@ using SciMLTesting, FastAlmostBandedMatrices -const REEXPORTED_API = (:brand,) - run_qa( FastAlmostBandedMatrices; - reexports_allow = REEXPORTED_API, # 19 method ambiguities, all in FastAlmostBandedMatrices' own ldiv!/__arguments # against ArrayLayouts/LinearAlgebra Triangular/Factorization methods. # https://github.com/SciML/FastAlmostBandedMatrices.jl/issues/71