From 7ee1038b8e3c91a13a38041a0308f9e4c11b9841 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Fri, 2 Jun 2017 17:49:08 +0200 Subject: [PATCH] actually test solving ModInt example with lufact --- test/linalg/generic.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/linalg/generic.jl b/test/linalg/generic.jl index 8683aba20e98b..b4a8017f9d945 100644 --- a/test/linalg/generic.jl +++ b/test/linalg/generic.jl @@ -316,6 +316,7 @@ end struct ModInt{n} k ModInt{n}(k) where {n} = new(mod(k,n)) + ModInt{n}(k::ModInt{n}) where {n} = k end Base.:+(a::ModInt{n}, b::ModInt{n}) where {n} = ModInt{n}(a.k + b.k) @@ -329,14 +330,15 @@ Base.zero(::Type{ModInt{n}}) where {n} = ModInt{n}(0) Base.zero(::ModInt{n}) where {n} = ModInt{n}(0) Base.one(::Type{ModInt{n}}) where {n} = ModInt{n}(1) Base.one(::ModInt{n}) where {n} = ModInt{n}(1) +Base.transpose(a::ModInt{n}) where {n} = a # see Issue 20978 + +A = [ModInt{2}(1) ModInt{2}(0); ModInt{2}(1) ModInt{2}(1)] +b = [ModInt{2}(1), ModInt{2}(0)] + +@test A*(lufact(A, Val{false})\b) == b # Needed for pivoting: Base.abs(a::ModInt{n}) where {n} = a Base.:<(a::ModInt{n}, b::ModInt{n}) where {n} = a.k < b.k -Base.transpose(a::ModInt{n}) where {n} = a # see Issue 20978 - -A = [ ModInt{2}(1) ModInt{2}(0) ; ModInt{2}(1) ModInt{2}(1) ] -b = [ ModInt{2}(1), ModInt{2}(0) ] -@test A*(A\b) == b -@test_nowarn lufact( A, Val{true} ) +@test A*(lufact(A, Val{true})\b) == b