Skip to content

Commit fb560bd

Browse files
authored
Merge pull request #11 from vtopt/develop
Version 2 release
2 parents f3ffef0 + c548b7b commit fb560bd

34 files changed

+26492
-17098
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

33
Copyright (c) 2020 Tyler H. Chang, Layne T. Watson, Thomas C. H. Lux,
4-
Ali R. Butt, Kirk W. Cameron, and Yili Hong.
4+
and other DELAUNAYSPARSE contributors.
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ Further detailed user information is documented in the `USAGE` document.
3636

3737
The physical organization is as follows.
3838

39-
* `src` contains the original unmodified Fortran source code, as published
40-
in ACM TOMS Algorithm 1012. This includes 2 command line drivers
41-
`samples.f90` (serial driver) and `samplep.f90` (parallel driver), which
42-
can be used on formatted data files from the command line.
39+
* `src` contains version 2 of the ACM TOMS Fortran source code, as published
40+
in ACM TOMS Algorithm 1012 and modified in the subsequent remark.
41+
This includes 2 command line drivers `samples.f90` (serial driver) and
42+
`samplep.f90` (parallel driver), which can be used on formatted data files
43+
from the command line.
4344
Comments at the top of each subroutine document their usage.
4445
See this directory's internal README for further information on
4546
building, testing, and usage.
@@ -59,28 +60,56 @@ The physical organization is as follows.
5960
* DelaunaySparse is shared under the MIT Software License, in the `LICENSE`
6061
file.
6162

63+
## Version 2
64+
65+
This is version 2 of DELAUNAYSPARSE.
66+
67+
In the latest version, we have switched away from using the SLATEC subroutine
68+
DWNNLS for computing projections onto the convex hull. Instead, we favor the
69+
quadratic program solver BQPD of R. Fletcher, which is much more robust for
70+
large projection problems.
71+
72+
Since this problem was somewhat nontrivial, we have added an additional
73+
external subroutine ``PROJECT`` to the ``delsparse.f90`` file, for
74+
external usage.
75+
6276
## Citation
6377

6478
To cite this work, please use
6579

6680
```
67-
@article{TOMSalg1012,
68-
author = {Chang, Tyler H. and Watson, Layne T. and Lux, Thomas C. H. and Butt, Ali R. and Cameron, Kirk W. and Hong, Yili},
69-
title = {Algorithm 1012: {DELAUNAYSPARSE}: {I}nterpolation via a Sparse Subset of the {D}elaunay Triangulation in Medium to High Dimensions},
70-
year = {2020},
71-
publisher = {Association for Computing Machinery},
72-
address = {New York, NY, USA},
73-
volume = {46},
74-
number = {4},
75-
doi = {10.1145/3422818},
76-
journal = {ACM Trans. Math. Softw.},
77-
month = {nov},
78-
articleno = {38},
79-
numpages = {20}
81+
@article{TOMSalgorithm1012,
82+
author = {Chang, Tyler H. and Watson, Layne T. and Lux, Thomas C. H. and Butt, Ali R. and Cameron, Kirk W. and Hong, Yili},
83+
title = {Algorithm 1012: {DELAUNAYSPARSE}: {I}nterpolation via a Sparse Subset of the {D}elaunay Triangulation in Medium to High Dimensions},
84+
year = {2020},
85+
month = {nov},
86+
publisher = {Association for Computing Machinery},
87+
address = {New York, NY, USA},
88+
journal = {ACM Trans. Math. Softw.},
89+
volume = {46},
90+
number = {4},
91+
articleno = {38},
92+
numpages = {20},
93+
doi = {10.1145/3422818},
8094
}
8195
```
8296

97+
The new ``PROJECT`` subroutine released in Version 2 is described in
98+
99+
```
100+
@article{TOMSremark1012,
101+
author = {Chang, Tyler H. and Watson, Layne T. and Leyffer, Sven and Lux, Thomas C. H. and Almohri, Hussain M. J.},
102+
title = {Remark on {Algorithm 1012}: Computing projections with large data sets},
103+
year = {2024},
104+
publisher = {Association for Computing Machinery},
105+
address = {New York, NY, USA},
106+
journal = {ACM Trans. Math. Softw.},
107+
numpages = {7},
108+
doi = {10.1145/3656581},
109+
note = {In press}
110+
```
111+
83112
## Inquiries
84113

85114
For further inquiries, contact
86-
Tyler Chang, [email protected].
115+
Tyler Chang, [email protected].

USAGE.md

Lines changed: 104 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,37 @@ On output:
172172
- 61 : A value that was judged appropriate later caused LAPACK to
173173
encounter a singularity. Try increasing the value of `EPS`.
174174

175-
The errors 70--72 were caused by the DWNNLS library from SLATEC, which
176-
is only used during extrapolation. Note that there is a known issue
177-
with this library, when it is linked against included public-domain
178-
copy of BLAS/LAPACK, instead of an installed version
179-
(i.e., `-lblas` `-llapack`).
180-
181-
- 70 : Allocation error for the extrapolation work arrays.
182-
- 71 : The SLATEC subroutine `DWNNLS` failed to converge during the
183-
projection of an extrapolation point onto the convex hull.
184-
- 72 : The SLATEC subroutine `DWNNLS` has reported a usage error.
185-
186-
The errors 72, 80--83 should never occur, and likely indicate a
175+
The errors 70+ can occur during extrapolation outside the convex hull.
176+
Errors 71+ are received from the solver BQPD and should never occur.
177+
Since extrapolation has a much higher memory overhead than interpolation,
178+
if one of these errors occurs, it is likely that your system does not have
179+
sufficient memory to support extrapolation for the given problem size.
180+
181+
- 70 : Allocation error for the extrapolation work arrays. Note that
182+
extrapolation has a higher memory overhead than interpolation for
183+
the current version.
184+
- 71 : Unbounded problem detected. This error should never occur
185+
unless there is a user error.
186+
- 72 : bl(i) > bu(i) for some i This error should never occur
187+
unless there is a user error.
188+
- 73 : Infeasible problem detected in Phase 1 (should never occur).
189+
- 74 : Incorrect setting of m, n, kmax, mlp, mode or tol. This is
190+
extremely unlikely, but could indicate that the problem is
191+
too large for usage of BQPD.
192+
- 75 : Not enough space in lp. This error should not occur.
193+
Double-check your usage, then contact authors if the issue
194+
persists.
195+
- 76 : Not enough space for reduced Hessian matrix (increase kmax).
196+
This error should not occur. Double-check your usage, then
197+
contact authors if the issue persists.
198+
- 77 : Not enough space for sparse factors. This error should not
199+
occur, but may indicate an un-anticipated problem size.
200+
Double-check your usage then contact the authors if the issue
201+
persists.
202+
- 78 : Maximum number of unsuccessful restarts taken. This issue
203+
should never occur since the projection problem is convex.
204+
205+
The errors 80--83 should never occur, and likely indicate a
187206
compiler bug or hardware failure.
188207

189208
- 80 : The LAPACK subroutine `DGEQP3` has reported an illegal value.
@@ -253,18 +272,21 @@ Optional arguments:
253272

254273
* `EXACT` is a logical input argument that determines whether the exact
255274
diameter should be computed and whether a check for duplicate data
256-
points should be performed in advance. When `EXACT=.FALSE.`, the
257-
diameter of `PTS` is approximated by twice the distance from the
258-
barycenter of `PTS` to the farthest point in `PTS`, and no check is
259-
done to find the closest pair of points, which could result in hard
260-
to find bugs later on. When `EXACT=.TRUE.`, the exact diameter is
261-
computed and an error is returned whenever PTS contains duplicate
262-
values up to the precision `EPS`. By default `EXACT=.TRUE.`, but setting
263-
`EXACT=.FALSE.` could result in significant speedup when `N` is large.
264-
It is strongly recommended that most users leave `EXACT=.TRUE.`, as
275+
points should be performed in advance. These checks are $O(N^2 D)$ time
276+
complexity, while `DELAUNAYSPARSE` tends toward $O(N D^4)$ on average.
277+
By default, `EXACT=.TRUE.` and the exact diameter is computed and an error
278+
is returned whenever `PTS` contains duplicate values up to the precision
279+
`EPS`. When `EXACT=.FALSE.`, the diameter of `PTS` is approximated by twice
280+
the distance from the barycenter of `PTS` to the farthest point in `PTS`,
281+
and no check is done to find the closest pair of points.
282+
When `EXACT=.TRUE.`, `DELAUNAYSPARSE` could spend over 90% of runtime
283+
calculating these constants, which are not critical to the `DELAUNAYSPARSE`
284+
algorithm. In particular, this happens for large values of `N`. However,
265285
setting `EXACT=.FALSE.` could result in input errors that are difficult
266-
to identify. Also, the diameter approximation could be wrong by up to
267-
a factor of two.
286+
to identify. It is recommended that users verify the input set `PTS`
287+
and possibly rescale `PTS` manually while `EXACT=.TRUE.` Then, when
288+
100% sure that `PTS` is valid, users may choose to set `EXACT=.FALSE.`
289+
in production runs for large values of N to achieve massive speedups.
268290

269291

270292
Subroutines and functions directly referenced from BLAS are
@@ -278,16 +300,15 @@ and from LAPACK are
278300
* `DGETRS`,
279301
* `DORMQR`.
280302

281-
The SLATEC subroutine
282-
* `DWNNLS` is also directly referenced.
303+
The BQPD driver
304+
* `BQPD` is also directly referenced.
283305

284-
`DWNNLS` and all its SLATEC dependencies have been slightly edited to
285-
comply with the Fortran 2008 standard, with all print statements and
286-
references to stderr being commented out. For a reference to `DWNNLS`,
287-
see ACM TOMS Algorithm 587 (Hanson and Haskell).
306+
`BQPD` and all its dependencies have been flattened into a single file `bqpd.f`.
307+
For a reference to `BQPD`, see
308+
Annals of Operations Research, 46 : 307--334 (1993).
288309
The module `REAL_PRECISION` from HOMPACK90 (ACM TOMS Algorithm 777) is
289-
used for the real data type. The `REAL_PRECISION` module, `DELAUNAYSPARSES`,
290-
and `DWNNLS` and its dependencies comply with the Fortran 2008 standard.
310+
used for the real data type. The `REAL_PRECISION` module, `DELAUNAYSPARSEP`,
311+
and `BQPD` and its dependencies comply with the Fortran 2008 standard.
291312

292313
## DELAUNAYSPARSEP
293314

@@ -415,18 +436,38 @@ On output:
415436
- 61 : A value that was judged appropriate later caused LAPACK to
416437
encounter a singularity. Try increasing the value of `EPS`.
417438

418-
The errors 70--72 were caused by the DWNNLS library from SLATEC, which
419-
is only used during extrapolation. Note that there is a known issue
420-
with this library, when it is linked against included public-domain
421-
copy of BLAS/LAPACK, instead of an installed version
422-
(i.e., `-lblas` `-llapack`).
423-
424-
- 70 : Allocation error for the extrapolation work arrays.
425-
- 71 : The SLATEC subroutine `DWNNLS` failed to converge during the
426-
projection of an extrapolation point onto the convex hull.
427-
- 72 : The SLATEC subroutine `DWNNLS` has reported a usage error.
428-
429-
The errors 72, 80--83 should never occur, and likely indicate a
439+
The errors 70+ can occur during extrapolation outside the convex hull.
440+
Errors 71+ are received from the solver BQPD and should never occur.
441+
Since extrapolation has a much higher memory overhead than interpolation,
442+
if one of these errors occurs, it is likely that your system does not have
443+
sufficient memory to support extrapolation for the given problem size.
444+
445+
- 70 : Allocation error for the extrapolation work arrays. Note that
446+
extrapolation has a higher memory overhead than interpolation for
447+
the current version.
448+
- 71 : Unbounded problem detected. This error should never occur
449+
unless there is a user error.
450+
- 72 : bl(i) > bu(i) for some i This error should never occur
451+
unless there is a user error.
452+
- 73 : Infeasible problem detected in Phase 1 (should never occur).
453+
- 74 : Incorrect setting of m, n, kmax, mlp, mode or tol. This is
454+
extremely unlikely, but could indicate that the problem is
455+
too large for usage of BQPD.
456+
- 75 : Not enough space in lp. This error should not occur.
457+
Double-check your usage, then contact authors if the issue
458+
persists.
459+
- 76 : Not enough space for reduced Hessian matrix (increase kmax).
460+
This error should not occur. Double-check your usage, then
461+
contact authors if the issue persists.
462+
- 77 : Not enough space for sparse factors. This error should not
463+
occur, but may indicate an un-anticipated problem size.
464+
Double-check your usage then contact the authors if the issue
465+
persists.
466+
- 78 : Maximum number of unsuccessful restarts taken. This issue
467+
should never occur since the projection problem is convex.
468+
469+
470+
The errors 80--83 should never occur, and likely indicate a
430471
compiler bug or hardware failure.
431472

432473
- 80 : The LAPACK subroutine `DGEQP3` has reported an illegal value.
@@ -500,18 +541,21 @@ Optional arguments:
500541

501542
* `EXACT` is a logical input argument that determines whether the exact
502543
diameter should be computed and whether a check for duplicate data
503-
points should be performed in advance. When `EXACT=.FALSE.`, the
504-
diameter of `PTS` is approximated by twice the distance from the
505-
barycenter of `PTS` to the farthest point in `PTS`, and no check is
506-
done to find the closest pair of points, which could result in hard
507-
to find bugs later on. When `EXACT=.TRUE.`, the exact diameter is
508-
computed and an error is returned whenever PTS contains duplicate
509-
values up to the precision `EPS`. By default `EXACT=.TRUE.`, but setting
510-
`EXACT=.FALSE.` could result in significant speedup when `N` is large.
511-
It is strongly recommended that most users leave `EXACT=.TRUE.`, as
544+
points should be performed in advance. These checks are $O(N^2 D)$ time
545+
complexity, while `DELAUNAYSPARSE` tends toward $O(N D^4)$ on average.
546+
By default, `EXACT=.TRUE.` and the exact diameter is computed and an error
547+
is returned whenever `PTS` contains duplicate values up to the precision
548+
`EPS`. When `EXACT=.FALSE.`, the diameter of `PTS` is approximated by twice
549+
the distance from the barycenter of `PTS` to the farthest point in `PTS`,
550+
and no check is done to find the closest pair of points.
551+
When `EXACT=.TRUE.`, `DELAUNAYSPARSE` could spend over 90% of runtime
552+
calculating these constants, which are not critical to the `DELAUNAYSPARSE`
553+
algorithm. In particular, this happens for large values of `N`. However,
512554
setting `EXACT=.FALSE.` could result in input errors that are difficult
513-
to identify. Also, the diameter approximation could be wrong by up to
514-
a factor of two.
555+
to identify. It is recommended that users verify the input set `PTS`
556+
and possibly rescale `PTS` manually while `EXACT=.TRUE.` Then, when
557+
100% sure that `PTS` is valid, users may choose to set `EXACT=.FALSE.`
558+
in production runs for large values of N to achieve massive speedups.
515559

516560
* `PMODE` is an integer specifying the level of parallelism to be exploited.
517561
- If `PMODE = 1`, then parallelism is exploited at the level of the loop
@@ -537,13 +581,12 @@ and from LAPACK are
537581
* `DGETRS`,
538582
* `DORMQR`.
539583

540-
The SLATEC subroutine
541-
* `DWNNLS` is also directly referenced.
584+
The BQPD driver
585+
* `BQPD` is also directly referenced.
542586

543-
`DWNNLS` and all its SLATEC dependencies have been slightly edited to
544-
comply with the Fortran 2008 standard, with all print statements and
545-
references to stderr being commented out. For a reference to `DWNNLS`,
546-
see ACM TOMS Algorithm 587 (Hanson and Haskell).
587+
`BQPD` and all its dependencies have been flattened into a single file `bqpd.f`.
588+
For a reference to `BQPD`, see
589+
Annals of Operations Research, 46 : 307--334 (1993).
547590
The module `REAL_PRECISION` from HOMPACK90 (ACM TOMS Algorithm 777) is
548591
used for the real data type. The `REAL_PRECISION` module, `DELAUNAYSPARSEP`,
549-
and `DWNNLS` and its dependencies comply with the Fortran 2008 standard.
592+
and `BQPD` and its dependencies comply with the Fortran 2008 standard.

c_binding/LICENSE

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

33
Copyright (c) 2020 Tyler H. Chang, Layne T. Watson, Thomas C. H. Lux,
4-
Ali R. Butt, Kirk W. Cameron, and Yili Hong.
4+
and other DELAUNAYSPARSE contributors.
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -20,3 +20,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2020
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
23+
24+
25+
** Please note that bqpd.f is a dependency of DELAUNAYSPARSE but carries its
26+
own LICENSE file found in bqpd_min/LICENSE. **

c_binding/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ CC = gcc
33
CFLAGS = -c
44
OPTS = -fopenmp
55
LIBS = blas.f lapack.f
6-
LEGACY = -std=legacy
76

8-
all: test_install.o delsparse_bind_c.o delsparse.o slatec.o delsparse.h
9-
$(FORT) $(OPTS) test_install.o delsparse_bind_c.o delsparse.o slatec.o $(LIBS) -o test_install
7+
all: test_install.o delsparse_bind_c.o delsparse.o bqpd.o delsparse.h
8+
$(FORT) $(OPTS) test_install.o delsparse_bind_c.o delsparse.o bqpd.o $(LIBS) -o test_install
109
./test_install
1110

1211
test_install.o: test_install.c
@@ -18,8 +17,8 @@ delsparse_bind_c.o: delsparse_bind_c.f90 delsparse.o
1817
delsparse.o: delsparse.f90
1918
$(FORT) $(CFLAGS) $(OPTS) delsparse.f90 -o delsparse.o
2019

21-
slatec.o : slatec.f
22-
$(FORT) $(CFLAGS) $(OPTS) $(LEGACY) slatec.f -o slatec.o
20+
bqpd.o : bqpd_min/bqpd.f
21+
$(FORT) $(CFLAGS) $(OPTS) $(LEGACY) bqpd_min/bqpd.f -o bqpd.o
2322

2423
clean:
2524
rm -f *.o *.mod test_install

c_binding/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ USAGE:
3838

3939
CONTRIBUTORS:
4040

41-
Tyler Chang, [email protected]
41+
Tyler Chang, [email protected]
4242

c_binding/bqpd_min/LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
BQPD carries the following copyright notice:
2+
3+
BQPD is copyrighted by the University of Dundee, UK. The library
4+
was developed by Roger Fletcher and Sven Leyffer. It is made available
5+
"as is" without express or implied warranty. Permission for distributing
6+
this library must be obtained from Roger Fletcher at the University of
7+
8+
9+
10+
Via this LICENSE file:
11+
12+
Permission is hereby granted to distribute BQPD for research purposes only.
13+
For more information, please contact Sven Leyffer.

0 commit comments

Comments
 (0)