From af07cd65fbbbab0a7211a29203c887ec1e21ebfa Mon Sep 17 00:00:00 2001 From: Tim Gymnich Date: Tue, 5 Sep 2023 16:03:46 +0200 Subject: [PATCH] add test --- test/mps.jl | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/mps.jl b/test/mps.jl index 1e28807f5..fd3482eeb 100644 --- a/test/mps.jl +++ b/test/mps.jl @@ -175,4 +175,39 @@ end @test_throws SingularException lu(A) end +@testset "solves" begin + b = MtlVector(rand(Float32, 1024)) + B = MtlMatrix(rand(Float32, 1024, 1024)) + + A = MtlMatrix(rand(Float32, 1024, 512)) + x = lu(A) \ b + @test A * x ≈ b + X = lu(A) \ B + @test A * X ≈ B + + A = UpperTriangular(MtlMatrix(rand(Float32, 1024, 1024))) + x = A \ b + @test A * x ≈ b + X = A \ B + @test A * X ≈ B + + A = UnitUpperTriangular(MtlMatrix(rand(Float32, 1024, 1024))) + x = A \ b + @test A * x ≈ b + X = A \ B + @test A * X ≈ B + + A = LowerTriangular(MtlMatrix(rand(Float32, 1024, 1024))) + x = A \ b + @test A * x ≈ b + X = A \ B + @test A * X ≈ B + + A = UnitLowerTriangular(MtlMatrix(rand(Float32, 1024, 1024))) + x = A \ b + @test A * x ≈ b + X = A \ B + @test A * X ≈ B +end + end \ No newline at end of file