Skip to content

Commit 121ed05

Browse files
committed
Add unit tests, fix license typo
1 parent 4634160 commit 121ed05

4 files changed

Lines changed: 62 additions & 2 deletions

File tree

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ McCormick.jl is licensed under the MIT License:
22

33
> Copyright (c) 2020: Matthew Wilhelm & Matthew Stuber.
44
>
5-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this >software and associated documentation files (the "Software"), to deal in the Software >without restriction, including without limitation the rights to use, copy, modify, merge, >publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66
>
77
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
88
>

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "McCormick"
22
uuid = "53c679d3-6890-5091-8386-c291e8c8aaa1"
33
authors = ["Matthew Wilhelm <matthew.wilhelm@uconn.edu>"]
4-
version = "0.10.1"
4+
version = "0.10.2"
55

66
[deps]
77
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"

src/forward_operators/apriori_mult.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
#=
13
@inline function mult_kernel_plus(x1::MC{N,NS}, x2::MC{N,NS}, z::Interval{Float64},
24
u1cv::Float64, u2cv::Float64, a1cv::Float64, a2cv::Float64,
35
u1cvgrad::SVector{N,Float64}, u2cvgrad::SVector{N,Float64}) where N
@@ -55,3 +57,4 @@
5557
5658
cv, cc, cv_grad, cc_grad = cut(z.lo, z.hi, cv, cc, cv_grad, cc_grad)
5759
end
60+
=#

test/forward_mccormick.jl

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,63 @@ if ~(VERSION < v"1.1-")
118118
@test isapprox(yerfz2.cv, 0.2724627147267543, atol=1E-8)
119119
@test isapprox(yerfz2.cc, 0.28967521876851665, atol=1E-8)
120120

121+
122+
yerfp = erfc(x_erf_p + 1.0)
123+
yerfn = erfc(x_erf_n + 1.0)
124+
yerfz1 = erfc(x_erf_z1 + 1.0)
125+
yerfz2 = erfc(x_erf_z2 + 1.0)
126+
127+
@test isapprox(yerfp.cv, 0.06599205505934755, atol=1E-8)
128+
@test isapprox(yerfp.cc, 0.07108896568847282, atol=1E-8)
129+
@test isapprox(yerfn.cv, 0.32219880616258156, atol=1E-8)
130+
@test isapprox(yerfn.cc, 0.3317660642572109, atol=1E-8)
131+
@test isapprox(yerfz1.cv, 0.32219880616258156, atol=1E-8)
132+
@test isapprox(yerfz1.cc, 0.39037906845450066, atol=1E-8)
133+
@test isapprox(yerfz2.cv, 0.06599205505934755, atol=1E-8)
134+
@test isapprox(yerfz2.cc, 0.1230159072571421, atol=1E-8)
135+
136+
yerfcp = erfcinv(x_erf_p + 1.0)
137+
yerfcn = erfcinv(x_erf_n + 1.0)
138+
yerfcz1 = erfcinv(x_erf_z1 + 1.0)
139+
yerfcz2 = erfcinv(x_erf_z2 + 1.0)
140+
141+
@test isapprox(yerfcp.cv, -0.2784077284823511, atol=1E-8)
142+
@test isapprox(yerfcp.cc, -0.2724627147267544, atol=1E-8)
143+
@test isapprox(yerfcn.cv, 0.2724627147267544, atol=1E-8)
144+
@test isapprox(yerfcn.cc, 0.2784077284823511, atol=1E-8)
145+
@test isapprox(yerfcz1.cv, 0.2724627147267544, atol=1E-8)
146+
@test isapprox(yerfcz1.cc, 0.28967521876851665, atol=1E-8)
147+
@test isapprox(yerfcz2.cv, -0.2896752187685167, atol=1E-8)
148+
@test isapprox(yerfcz2.cc, -0.2724627147267544, atol=1E-8)
149+
150+
yerfcp = erfcinv(x_erf_p + 1.0)
151+
yerfcn = erfcinv(x_erf_n + 1.0)
152+
yerfcz1 = erfcinv(x_erf_z1 + 1.0)
153+
yerfcz2 = erfcinv(x_erf_z2 + 1.0)
154+
155+
@test isapprox(yerfcp.cv, -0.2784077284823511, atol=1E-8)
156+
@test isapprox(yerfcp.cc, -0.2724627147267544, atol=1E-8)
157+
@test isapprox(yerfcn.cv, 0.2724627147267544, atol=1E-8)
158+
@test isapprox(yerfcn.cc, 0.2784077284823511, atol=1E-8)
159+
@test isapprox(yerfcz1.cv, 0.2724627147267544, atol=1E-8)
160+
@test isapprox(yerfcz1.cc, 0.28967521876851665, atol=1E-8)
161+
@test isapprox(yerfcz2.cv, -0.2896752187685167, atol=1E-8)
162+
@test isapprox(yerfcz2.cc, -0.2724627147267544, atol=1E-8)
163+
164+
yerfcp = erfcinv(x_erf_p + 1.0)
165+
yerfcn = erfcinv(x_erf_n + 1.0)
166+
yerfcz1 = erfcinv(x_erf_z1 + 1.0)
167+
yerfcz2 = erfcinv(x_erf_z2 + 1.0)
168+
169+
@test isapprox(yerfcp.cv, -0.2784077284823511, atol=1E-8)
170+
@test isapprox(yerfcp.cc, -0.2724627147267544, atol=1E-8)
171+
@test isapprox(yerfcn.cv, 0.2724627147267544, atol=1E-8)
172+
@test isapprox(yerfcn.cc, 0.2784077284823511, atol=1E-8)
173+
@test isapprox(yerfcz1.cv, 0.2724627147267544, atol=1E-8)
174+
@test isapprox(yerfcz1.cc, 0.28967521876851665, atol=1E-8)
175+
@test isapprox(yerfcz2.cv, -0.2896752187685167, atol=1E-8)
176+
@test isapprox(yerfcz2.cc, -0.2724627147267544, atol=1E-8)
177+
121178
x1 = MC{1,NS}(0.1, Interval(-1.5, 1.5), 1)
122179
x2 = MC{1,NS}(-0.5, Interval(-1.5, 1.5), 1)
123180
x3 = MC{1,NS}(0.7, Interval(0.5, 1.5), 1)

0 commit comments

Comments
 (0)