diff --git a/docs/src/tutorials/linear.md b/docs/src/tutorials/linear.md index 8bcc73d04..4b492efe4 100644 --- a/docs/src/tutorials/linear.md +++ b/docs/src/tutorials/linear.md @@ -139,7 +139,7 @@ Let's check these are the same: ```@example linsys1 v = rand(5) -mfopA*v - A*v +mfopA * v - A * v ``` Notice `mfopA` does this without having to have `A` because it just uses the equivalent `Afunc!` instead. Now, even though diff --git a/ext/LinearSolveEnzymeExt.jl b/ext/LinearSolveEnzymeExt.jl index 467a6b711..4a01a7071 100644 --- a/ext/LinearSolveEnzymeExt.jl +++ b/ext/LinearSolveEnzymeExt.jl @@ -227,7 +227,7 @@ function EnzymeRules.reverse(config, func::Const{typeof(LinearSolve.solve!)}, end else dlinsolves = linsolve.dval - if any(x->(iszero(x.A) || iszero(x.b)) && !iszero(x.u), linsolve.dval) + if any(x -> (iszero(x.A) || iszero(x.b)) && !iszero(x.u), linsolve.dval) error("Adjoint case currently not handled. Instead of using `solve!(cache); s1 = copy(cache.u) ...`, use `sol = solve!(cache); s1 = copy(sol.u)`.") end end diff --git a/src/KLU/klu.jl b/src/KLU/klu.jl index c31fdd782..29fe26e69 100644 --- a/src/KLU/klu.jl +++ b/src/KLU/klu.jl @@ -14,7 +14,8 @@ import Base: (\), size, getproperty, setproperty!, propertynames, show, copy, eachindex, view, sortperm, unsafe_load, zeros, convert, eltype, length, parent, stride, finalizer, Complex, complex, imag, real, map!, summary, println, oneunit, sizeof, isdefined, setfield!, getfield, - OutOfMemoryError, ArgumentError, OverflowError, ErrorException, DimensionMismatch + OutOfMemoryError, ArgumentError, OverflowError, ErrorException, + DimensionMismatch # Convert from 1-based to 0-based indices function decrement!(A::AbstractArray{T}) where {T <: Integer} diff --git a/src/generic_lufact.jl b/src/generic_lufact.jl index 40148ceff..b11c88375 100644 --- a/src/generic_lufact.jl +++ b/src/generic_lufact.jl @@ -55,7 +55,7 @@ # Update the rest for j in (k + 1):n for i in (k + 1):m - A[i, j] -= A[i, k]*A[k, j] + A[i, j] -= A[i, k] * A[k, j] end end end @@ -119,7 +119,7 @@ elseif VERSION < v"1.13" # Update the rest for j in (k + 1):n for i in (k + 1):m - A[i, j] -= A[i, k]*A[k, j] + A[i, j] -= A[i, k] * A[k, j] end end end diff --git a/src/simplegmres.jl b/src/simplegmres.jl index a21826c9f..1cceb7d76 100644 --- a/src/simplegmres.jl +++ b/src/simplegmres.jl @@ -308,7 +308,7 @@ function SciMLBase.solve!(cache::SimpleGMRESCache{false}, lincache::LinearCache) # [cₖ sₖ] [ r̄ₖ.ₖ ] = [rₖ.ₖ] # [s̄ₖ -cₖ] [hₖ₊₁.ₖ] [ 0 ] (c[inner_iter], s[inner_iter], - R[nr + inner_iter]) = _sym_givens( + R[nr + inner_iter]) = _sym_givens( R[nr + inner_iter], Hbis) diff --git a/test/adjoint.jl b/test/adjoint.jl index d599162df..9323a605e 100644 --- a/test/adjoint.jl +++ b/test/adjoint.jl @@ -31,7 +31,7 @@ A = rand(n, n); b1 = rand(n); _ff = (x, - y) -> f(x, +y) -> f(x, y; alg = LinearSolve.DefaultLinearSolver(LinearSolve.DefaultAlgorithmChoice.LUFactorization)) _ff(copy(A), copy(b1)) diff --git a/test/default_algs.jl b/test/default_algs.jl index 7d912ae13..6333dc1f1 100644 --- a/test/default_algs.jl +++ b/test/default_algs.jl @@ -170,4 +170,4 @@ sol = solve(prob, @test sol.u == zeros(4) sol = solve(prob) -@test sol.u ≈ svd(A)\b +@test sol.u ≈ svd(A) \ b diff --git a/test/hypretests.jl b/test/hypretests.jl index 0d04ebd94..da7e7e3a5 100644 --- a/test/hypretests.jl +++ b/test/hypretests.jl @@ -87,7 +87,7 @@ function test_interface(alg; kw...) # Solve prob directly (without cache) y = solve(prob, alg; cache_kwargs..., Pl = HYPRE.BoomerAMG) - @test A*to_array(y.u)≈b atol=atol rtol=rtol + @test A * to_array(y.u)≈b atol=atol rtol=rtol @test y.iters > 0 @test y.resid < rtol @@ -99,7 +99,7 @@ function test_interface(alg; kw...) cache = y.cache @test cache.isfresh == cache.cacheval.isfresh_A == cache.cacheval.isfresh_b == cache.cacheval.isfresh_u == false - @test A*to_array(y.u)≈b atol=atol rtol=rtol + @test A * to_array(y.u)≈b atol=atol rtol=rtol # Update A cache.A = A @@ -109,7 +109,7 @@ function test_interface(alg; kw...) cache = y.cache @test cache.isfresh == cache.cacheval.isfresh_A == cache.cacheval.isfresh_b == cache.cacheval.isfresh_u == false - @test A*to_array(y.u)≈b atol=atol rtol=rtol + @test A * to_array(y.u)≈b atol=atol rtol=rtol # Update b b2 = 2 * to_array(b) @@ -123,7 +123,7 @@ function test_interface(alg; kw...) cache = y.cache @test cache.isfresh == cache.cacheval.isfresh_A == cache.cacheval.isfresh_b == cache.cacheval.isfresh_u == false - @test A*to_array(y.u)≈to_array(b2) atol=atol rtol=rtol + @test A * to_array(y.u)≈to_array(b2) atol=atol rtol=rtol end return end diff --git a/test/nopre/enzyme.jl b/test/nopre/enzyme.jl index 06703a117..6004ccbcf 100644 --- a/test/nopre/enzyme.jl +++ b/test/nopre/enzyme.jl @@ -33,14 +33,14 @@ b1 = rand(n); db1 = zeros(n); _ff = (x, - y) -> f(x, +y) -> f(x, y; alg = LinearSolve.DefaultLinearSolver(LinearSolve.DefaultAlgorithmChoice.LUFactorization)) _ff(copy(A), copy(b1)) Enzyme.autodiff(Reverse, (x, - y) -> f(x, + y) -> f(x, y; alg = LinearSolve.DefaultLinearSolver(LinearSolve.DefaultAlgorithmChoice.LUFactorization)), Duplicated(copy(A), dA), @@ -174,7 +174,7 @@ db2 = zeros(n); Enzyme.autodiff(set_runtime_activity(Reverse), f3, Duplicated(copy(A), dA), Duplicated(copy(b1), db1), Duplicated(copy(b2), db2)) -@test dA ≈ dA2 atol=5e-5 +@test dA≈dA2 atol=5e-5 @test db1 ≈ db12 @test db2 ≈ db22 diff --git a/test/retcodes.jl b/test/retcodes.jl index 21bfcd923..6ff140e34 100644 --- a/test/retcodes.jl +++ b/test/retcodes.jl @@ -80,7 +80,7 @@ staticarrayalgs = ( ) @testset "StaticArray Success" begin A = Float64[1 2 3; 4 3.5 1.7; 5.2 1.8 9.7] - A = A*A' + A = A * A' b = Float64[2, 5, 8] prob1 = LinearProblem(SMatrix{3, 3}(A), SVector{3}(b)) sol = solve(prob1)