diff --git a/Project.toml b/Project.toml index d7459e023..9fe64421f 100644 --- a/Project.toml +++ b/Project.toml @@ -117,4 +117,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "IterativeSolvers", "InteractiveUtils", "JET", "KrylovKit", "Pkg", "Random", "SafeTestsets", "MultiFloats", "ForwardDiff", "HYPRE", "MPI", "BlockDiagonals", "Enzyme", "FiniteDiff", "BandedMatrices"] +test = ["Test", "IterativeSolvers", "InteractiveUtils", "JET", "KrylovKit", "Pkg", "Random", "SafeTestsets", "MultiFloats", "ForwardDiff", "HYPRE", "MPI", "BlockDiagonals", "Enzyme", "FiniteDiff", "BandedMatrices", "FastAlmostBandedMatrices"] diff --git a/test/banded.jl b/test/banded.jl index 0bbf5e65b..89c104966 100644 --- a/test/banded.jl +++ b/test/banded.jl @@ -1,4 +1,4 @@ -using BandedMatrices, LinearAlgebra, LinearSolve, Test +using FastAlmostBandedMatrices, BandedMatrices, LinearAlgebra, LinearSolve, Test # Square Case n = 8 @@ -16,6 +16,12 @@ sol1 = solve(LinearProblem(A1, b1; u0 = x1)) sol2 = solve(LinearProblem(A2, b2; u0 = x2)) @test sol2.u ≈ A2 \ b2 +A = AlmostBandedMatrix(BandedMatrix(fill(2.0, n, n), (1, 1)), fill(3.0, 2, n)) +A[band(0)] .+= 1:n + +sol1ab = solve(LinearProblem(A, b; u0 = x1)) +@test sol1ab.u ≈ Matrix(A) \ b + # Square Symmetric A1s = Symmetric(A1) A2s = Symmetric(A2) @@ -31,8 +37,18 @@ b = rand(8) @test_throws ErrorException solve(LinearProblem(A, b)).u +A = AlmostBandedMatrix(BandedMatrix(fill(2.0, n - 2, n), (1, 1)), fill(3.0, 2, n)) +A[band(0)] .+= 1:(n - 2) + +@test_throws ErrorException solve(LinearProblem(A, b)).u + # Overdetermined A = BandedMatrix(ones(10, 8), (2, 0)) b = rand(10) @test_nowarn solve(LinearProblem(A, b)) + +A = AlmostBandedMatrix(BandedMatrix(fill(2.0, n + 2, n), (1, 1)), fill(3.0, 2, n)) +A[band(0)] .+= 1:n + +@test_nowarn solve(LinearProblem(A, b))