Skip to content

Commit 96808b5

Browse files
authored
Avoid duplicate function evaluation (#42)
Sometimes the bivariate function is expensive, so we should avoid duplicate evaluation.
1 parent 3ee7d49 commit 96808b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function BivariatePWLFunction(x, y, fz::Function; pattern=:BestFit, seed=hash((l
4848
@assert xU == X[SEt][1] == X[NEt][1]
4949
@assert yL == X[SWt][2] == X[SEt][2]
5050
@assert yU == X[NWt][2] == X[NEt][2]
51-
SW, NW, NE, SE = fz(xL,yL), fz(xL,yU), fz(xU,yU), fz(xU,yL)
51+
SW, NW, NE, SE = Z[SWt], Z[NWt], Z[NEt], Z[SEt]
5252
mid1 = 0.5*(SW+NE)
5353
mid2 = 0.5*(NW+SE)
5454

0 commit comments

Comments
 (0)