Skip to content

Commit

Permalink
Final CI before next tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ctkelley committed Sep 26, 2023
1 parent af537ad commit f6f1c27
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Factorizations/mplu!.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,19 @@ function mplu!(MPA::Union{MPArray,MPEArray})
end
return MPF
end


"""
mplu(A::Array{Float64,2}; TL=Float32, onthefly=false)
Combines the constructor of the multiprecision array with the
factorization.
"""
function mplu(A::Array{TH,2}; TL=Float32, onthefly=nothing) where TH <: Real
(TH == Float32) && (TL = Float16)
((onthefly == nothing ) && (TL == Float16)) && (onthefly=true)
((onthefly == nothing ) && (TL == Float32)) && (onthefly=false)
MPA=MPArray(A; TL=TL, onthefly=onthefly)
MPF=mplu!(MPA)
return MPF
end
1 change: 1 addition & 0 deletions src/MultiPrecisionArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export hlu
# them to nonlinear solvers and eigen solvers.
#
export mplu!
export mplu
export mphlu!
export mpglu!
export mpqr!
Expand Down
Binary file added test/DetailsTest/.mplu_test.jl.swp
Binary file not shown.
27 changes: 27 additions & 0 deletions test/DetailsTest/mplu_test.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
mplu_test()
Make sure that mplu and mplu! do what they are supposed to do
"""
function mplu_test()
AD=rand(10,10); MPD=MPArray(AD); MPF1=mplu!(MPD); MPF2=mplu(AD);
eq64=test_eq(MPF1,MPF2)
ADx=rand(10,10); MPDx=MPArray(ADx; TL=Float16);
MPF1x=mplu!(MPDx); MPF2x=mplu(ADx; TL=Float16);
eq64x=test_eq(MPF1x,MPF2x)
AS=Float32.(AD); MPS=MPArray(AS); MSF1=mplu!(MPS); MSF2=mplu(AS)
eq32=test_eq(MSF1,MSF2)
mpluok = (eq64 && eq64x && eq32)
mpluok || println("mplu failure")
return mpluok
end


function test_eq(MF1,MF2)
eqok=true
for nf in fieldnames(MPLFact)
gx=getfield(MF1,nf); hx =getfield(MF2,nf)
eqok= ((gx==hx) && eqok)
end
return eqok
end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include("NLTest/nltest.jl")
include("DetailsTest/precision_test.jl")
include("DetailsTest/hlu_test.jl")
include("DetailsTest/slashtest.jl")
include("DetailsTest/mplu_test.jl")
include("GM-IRTest/mpgmtest.jl")
include("GM-IRTest/hvse.jl")

Expand All @@ -29,6 +30,7 @@ end
@test precision_test()
@test hlu_test()
@test slashtest()
@test mplu_test()
end

@testset "GM-IR" begin
Expand Down

0 comments on commit f6f1c27

Please sign in to comment.