Overview
Version 2.
The package
DELAUNAYSPARSE
(ACM TOMS Algorithm 1012) contains serial and parallel codes, written in
FORTRAN 2003 with OpenMP 4.5, for performing
interpolation in medium to high dimensions via a sparse subset of the
Delaunay triangulation.
In addition to the original FORTRAN source code, this site can
be used to download a Python 3.6+ wrapper and C/C++
bindings for DELAUNAYSPARSE.
Note that each of the three downloads is self-contained, with the
Python wrapper and C bindings each containing
a subset of the FORTRAN as is needed to build and run
their respective functionalities.
Command line drivers, which accept formatted data files, are also available
by downloading the original FORTRAN source code.
The serial driver subroutine is DELAUNAYSPARSES
and the parallel driver subroutine is DELAUNAYSPARSEP.
The subroutines DELAUNAYSPARSE{S|P} use the module
REAL_PRECISION from HOMPACK90
(ACM TOMS Algorithm 777) for specifying the real data type,
and a minimal copy of R. Fletcher's quadratic program solver
BQPD with its critical dependencies.
The master module DELSPARSE_MOD includes the
REAL_PRECISION module and interface blocks for both
DELAUNAYSPARSES and DELAUNAYSPARSEP, as well as
an interface block for the new PROJECT subroutine, which
wraps BQPD for convex hull projections and may be of
separate interest.
Comments at the beginning of the driver subroutines
DELAUNAYSPARSE{S|P} document the arguments and usage,
and examples demonstrating their usage are provided in the
sample programs samples.f90 and samplep.f90.
Note that in version 1, the SLATEC subroutine
DWNNLS (ACM TOMS Algorithm 587)
for solving inequality constrained least squares problems was an additional
requirement, but it has been replaced by BQPD starting in
version 2.
Please note the BQPD carries a stricter LICENSE than DELAUNAYSPARSE
If needed, DELAUNAYSPARSE can be used without
BQPD by setting the optional
argument:
EXTRAP=0.0_R8
However, this will not allow for extrapolation outside the convex hull.
To enable extrapolation or to use the new PROJECT subroutine,
please note the secondary LICENSE file in bqpd_min/LICENSE.
The physical organization of the main
TOMS source download into files is as follows.
Further details on using the Python wrapper
and C bindings downloads are given in their
respective README files, which are included in the downloads.
- The file
delsparse.f90contains the moduleREAL_PRECISION,DELSPARSE_MOD, and the driver subroutinesDELAUNAYSPARSES, andDELAUNAYSPARSEP. - The file
bqpd_min/bqpd.fcontains a minimal copy of the quadratic program solverBQPD, by R. Fletcher. Note that multiple auxiliary files have been combined into one for portability, and several additional dependencies that provide features unused byDELAUNAYSPARSEhave been omitted. - The file
bqpd_min/LICENSEcontains a separateLICENSEfile forbqpd.f, which is different than the MIT LICENSE carried byDELAUNAYSPARSE. - The file
samples.f90contains a sample command line program demonstrating the usage ofDELAUNAYSPARSES, with optional arguments. This program can also be used to useDELAUNAYSPARSESon formatted data files from the command line. - The file
samplep.f90contains a sample command line program demonstrating the usage ofDELAUNAYSPARSEP, with optional arguments. This program can also be used to useDELAUNAYSPARSEPon formatted data files from the command line. - The file
test_install.f90contains a simple test program that checks whether the installation of DELAUNAYSPARSE appears correct, based on the output to a small interpolation/extrapolation problem. - The file
sample_input2d.datcontains a sample 2-dimensional input data set forsamples.f90andsamplep.f90, coming from the VarSys project at Virginia Tech. - The file
sample_input4d.datcontains a sample 4-dimensional input data set forsamples.f90andsamplep.f90, coming from the VarSys project at Virginia Tech. - The file
sample_extrap10.datcontains a sample 10-dimensional input data set forsamples.f90andsamplep.f90. This file resulted in a failure forDELAUNAYSPARSEversion 1, caused by the usage ofDWNNLS. This failure case is correctly solved by version 2 withBQPD. - The files
lapack.fandblas.fcontain allLAPACKandBLASsubroutines that are referenced (both directly and indirectly) in DELAUNAYSPARSE. - A sample GNU
Makefileis provided.
To check that the installation of DELAUNAYSPARSES and
DELAUNAYSPARSEP is correct, assuming that your Fortran compiler
allows mixing fixed format .f and free format .f90
files in the same compile command, use the command
$FORT $OPTS delsparse.f90 slatec.f lapack.f blas.f test_install.f90 \ -o test_install $LIBS
where $FORT is a FORTRAN 2003 compliant compiler
supporting OpenMP 4.5, $OPTS is a list of compiler
options, and $LIBS is a list of flags to link the
BLAS and LAPACK libraries, if those exist on your
system (in which case the files blas.f and lapack.f
can be omitted from the compile command). To run the parallel code,
$OPTS must include the compiler option for OpenMP.
Then run the tests using
./test_install
To compile and link the sample main programs sample{s|p}.f90, use
$FORT $OPTS delsparse.f90 slatec.f lapack.f blas.f sample{s|p}.f90 \
-o sample{s|p} $LIBS
similar to above. To run a sample main program, use
./sample{s|p} sample_input{2|4}d.dat
where sample_input{2|4}d.dat could be replaced by any other
similarly formatted data file.
Usage Information for DELAUNAYSPARSE
DELAUNAYSPARSE solves the multivariate interpolation problem:
Given a set of N points PTS and a set of M
interpolation points Q in R^D, for each interpolation
point Q_i in Q, identify the set
of D+1 data points in PTS that are the vertices of a
Delaunay simplex containing Q_i.
These vertices can be used to calculate the Delaunay interpolant using a piecewise linear model.
For more information on the underlying algorithm, see
@inproceedings{algorithm,
author={Chang, Tyler H. and Watson, Layne T. and Lux, Thomas C. H. and
Li, Bo and Xu, Li and Butt, Ali R. and Cameron, Kirk W. and
Hong, Yili},
title={A polynomial time algorithm for multivariate interpolation in
arbitrary dimension via the {D}elaunay triangulation},
year={2018},
month={mar},
booktitle={Proc. ACMSE 2018 Conference (ACMSE 18)},
publisher={ACM},
location={Richmond, KY},
doi={10.1145/3190645.3190680}
}
For more information on the DELAUNAYSPARSE software
(version 1), see
@article{toms1012,
author={Chang, Tyler H. and Watson, Layne T. and Lux, Thomas C. H.
and Butt, Ali R. and Cameron, Kirk W. and Hong, Yili},
title={Algorithm 1012: {DELAUNAYSPARSE}: Interpolation via a sparse
subset of the {D}elaunay triangulation in medium to high
dimensions},
year={2020},
journal={ACM Trans. Math. Softw.},
volume={46},
number={4},
articleno={38},
nopages={20},
doi={10.1145/3422818}
}
For more information on the changes in version 2, see
@article{toms1012remark,
author={Chang, Tyler H. and Watson, Layne T. and Leyffer, Sven
and Lux, Thomas C. H. and Almohri, Hussain M. J.},
title={Remark on {Algorithm 1012}: Computing projections with large
data sets},
year={2024},
journal={ACM Trans. Math. Softw.},
nopages={8},
note={to appear}
}
DELAUNAYSPARSE contains a Fortran module
delsparse;
delsparsec;
delsparsesanddelsparsep;
python.
These interfaces are described in the following sections.
Fortran interface
DELAUNAYSPARSE is written in Fortran 2003, and this is its native interface. The Fortran interface contains two drivers:
DELAUNAYSPARSES(serial driver) andDELAUNAYSPARSEP(OpenMP parallel driver).
DELAUNAYSPARSES
The interface for DELAUNAYSPARSES is
SUBROUTINE DELAUNAYSPARSES( D, N, PTS, M, Q, SIMPS, WEIGHTS, IERR, &
INTERP_IN, INTERP_OUT, EPS, EXTRAP, RNORM, &
IBUDGET, CHAIN, EXACT )
Each of the above parameters is described below.
On input:
Dis the dimension of the space forPTSandQ.Nis the number of data points inPTS.PTS(1:D,1:N)is a real valued matrix withNcolumns, each containing the coordinates of a single data point inR^D.Mis the number of interpolation points inQ.Q(1:D,1:M)is a real valued matrix withMcolumns, each containing the coordinates of a single interpolation point inR^D.
On output:
PTSandQhave been rescaled and shifted. All the data points inPTSare now contained in the unit hyperball inR^D, and the points inQhave been shifted and scaled accordingly in relation toPTS.SIMPS(1:D+1,1:M)contains theD+1integer indices (corresponding to columns inPTS) for theD+1vertices of the Delaunay simplex containing each interpolation point inQ.WEIGHTS(1:D+1,1:M)contains theD+1real-valued weights for expressing each point inQas a convex combination of theD+1corresponding vertices inSIMPS.IERR(1:M)contains integer valued error flags associated with the computation of each of theMinterpolation points inQ. The error codes are:
Codes 0, 1, 2 are expected to occur during normal execution.- 00 : Succesful interpolation.
- 01 : Succesful extrapolation (up to the allowed extrapolation distance).
- 02 : This point was outside the allowed extrapolation distance; the corresponding entries in SIMPS and WEIGHTS contain zero values.
- 10 : The dimension
Dmust be positive. - 11 : Too few data points to construct a triangulation (i.e.,
N < D+1). - 12 : No interpolation points given (i.e.,
M < 1). - 13 : The first dimension of
PTSdoes not agree with the dimensionD. - 14 : The second dimension of
PTSdoes not agree with the number of pointsN. - 15 : The first dimension of
Qdoes not agree with the dimensionD. - 16 : The second dimension of
Qdoes not agree with the number of interpolation pointsM. - 17 : The first dimension of the output array
SIMPSdoes not match the number of vertices needed for aD-simplex (D+1). - 18 : The second dimension of the output array
SIMPSdoes not match the number of interpolation pointsM. - 19 : The first dimension of the output array
WEIGHTSdoes not match the number of vertices for a aD-simplex (D+1). - 20 : The second dimension of the output array
WEIGHTSdoes not match the number of interpolation pointsM. - 21 : The size of the error array
IERRdoes not match the number of interpolation pointsM. - 22 :
INTERP_INcannot be present withoutINTERP_OUTor vice versa. - 23 : The first dimension of
INTERP_INdoes not match the first dimension ofINTERP_OUT. - 24 : The second dimension of
INTERP_INdoes not match the number of data pointsPTS. - 25 : The second dimension of
INTERP_OUTdoes not match the number of interpolation pointsM. - 26 : The budget supplied in
IBUDGETdoes not contain a positive integer. - 27 : The extrapolation distance supplied in
EXTRAPcannot be negative. - 28 : The size of the
RNORMoutput array does not match the number of interpolation pointsM.
- 30 : Two or more points in the data set
PTSare too close together with respect to the working precision (EPS), which would result in a numerically degenerate simplex. - 31 : All the data points in
PTSlie in some lower dimensional linear manifold (up to the working precision), and no valid triangulation exists.
- 40 : An error caused
DELAUNAYSPARSESto terminate before this value could be computed. Note: The corresponding entries inSIMPSandWEIGHTSmay contain garbage values.
- 50 : A memory allocation error occurred while allocating the work array
WORK.
IBUDGETorEPShas been adjusted in a way that is unwise, or there may be another issue with the problem settings, which is manifesting in an unusual way.- 60 : The budget was exceeded before the algorithm converged on this
value. If the dimension is high, try increasing
IBUDGET. This error can also be caused by a working precisionEPSthat is too small for the conditioning of the problem. - 61 : A value that was judged appropriate later caused LAPACK to
encounter a singularity. Try increasing the value of
EPS. - 70 : Allocation error for the extrapolation work arrays. Note that extrapolation has a higher memory overhead than interpolation for the current version.
- 7x : BQPD has reported an error while computing the projection.
See the comment block for the
PROJECTsubroutine for more details.
- 80 : The LAPACK subroutine
DGEQP3has reported an illegal value. - 81 : The LAPACK subroutine
DGETRFhas reported an illegal value. - 82 : The LAPACK subroutine
DGETRShas reported an illegal value. - 83 : The LAPACK subroutine
DORMQRhas reported an illegal value.
Optional arguments:
-
INTERP_IN(1:IR,1:N)contains real valued response vectors for each of the data points inPTSon input. The first dimension ofINTERP_INis inferred to be the dimension of these response vectors, and the second dimension must matchN. If present, the response values will be computed for each interpolation point inQ, and stored inINTERP_OUT, which therefore must also be present. If bothINTERP_INandINTERP_OUTare omitted, only the containing simplices and convex combination weights are returned. -
INTERP_OUT(1:IR,1:M)contains real valued response vectors for each interpolation point inQon output. The first dimension ofINTERP_OUTmust match the first dimension ofINTERP_IN, and the second dimension must matchM. If present, the response values at each interpolation point are computed as a convex combination of the response values (supplied inINTERP_IN) at the vertices of a Delaunay simplex containing that interpolation point. Therefore, ifINTERP_OUTis present, thenINTERP_INmust also be present. If both are omitted, only the simplices and convex combination weights are returned. -
EPScontains the real working precision for the problem on input. By default,EPSis assigned\sqrt{\mu}where\mudenotes the unit roundoff for the machine. In general, any values that differ by less thanEPSare judged as equal, and any weights that are greater than-EPSare judged as nonnegative.EPScannot take a value less than the default value of\sqrt{\mu}. If any value less than\sqrt{\mu}is supplied, the default value will be used instead automatically. -
EXTRAPcontains the real maximum extrapolation distance (relative to the diameter ofPTS) on input. Interpolation at a point outside the convex hull ofPTSis done by projecting that point onto the convex hull, and then doing normal Delaunay interpolation at that projection. Interpolation at any point inQthat is more thanEXTRAP * DIAMETER(PTS)units outside the convex hull ofPTSwill not be done and an error code of2will be returned. Note that computing the projection can be expensive. SettingEXTRAP=0will cause all extrapolation points to be ignored without ever computing a projection. By default,EXTRAP=0.1(extrapolate by up to 10% of the diameter ofPTS). -
RNORM(1:M)contains the real unscaled projection (2-norm) distances from any projection computations on output. If not present, these distances are still computed for each extrapolation point, but are never returned. -
IBUDGETon input contains the integer budget for performing flips while iterating toward the simplex containing each interpolation point inQ. This preventsDELAUNAYSPARSESfrom falling into an infinite loop when an inappropriate value ofEPSis given with respect to the problem conditioning. By default,IBUDGET=50000. However, for extremely high-dimensional problems and pathological inputs, the default value may be insufficient. -
CHAINis a logical input argument that determines whether a new first simplex should be constructed for each interpolation point (CHAIN=.FALSE.), or whether the simplex walks should be "daisy-chained." By default,CHAIN=.FALSE.SettingCHAIN=.TRUE.is generally not recommended, unless the size of the triangulation is relatively small or the interpolation points are known to be tightly clustered. -
EXACTis a logical input argument that determines whether the exact diameter should be computed and whether a check for duplicate data points should be performed in advance. These checks areO(N^2 D)time complexity, whileDELAUNAYSPARSEtends towardO(N D^4)on average. By default,EXACT=.TRUE.and the exact diameter is computed and an error is returned wheneverPTScontains duplicate values up to the precisionEPS. WhenEXACT=.FALSE., the diameter ofPTSis approximated by twice the distance from the barycenter ofPTSto the farthest point inPTS, and no check is done to find the closest pair of points. WhenEXACT=.TRUE.,DELAUNAYSPARSEcould spend over 90% of runtime calculating these constants, which are not critical to theDELAUNAYSPARSEalgorithm. In particular, this happens for large values ofN. However, settingEXACT=.FALSE.could result in input errors that are difficult to identify. It is recommended that users verify the input setPTSand possibly rescalePTSmanually whileEXACT=.TRUE.Then, when 100% sure thatPTSis valid, users may choose to setEXACT=.FALSE.in production runs for large values ofNto achieve massive speedups.
Subroutines and functions directly referenced from BLAS are
-
DDOT, -
DGEMV, -
DNRM2, -
DTRSM,
-
DGEQP3, -
DGETRF, -
DGETRS, -
DORMQR.
The quadratic programming solver BQPD is also used.
For more information, see
Annals of Operations Research, 46 : 307--334 (1993).
The module REAL_PRECISION from HOMPACK90 (ACM TOMS Algorithm 777)
is used for the real data type. The REAL_PRECISION module,
DELAUNAYSPARSES, and BQPD and its dependencies
comply with the Fortran 2008 standard.
DELAUNAYSPARSEP
The interface for DELAUNAYSPARSEP is
SUBROUTINE DELAUNAYSPARSEP( D, N, PTS, M, Q, SIMPS, WEIGHTS, IERR, &
INTERP_IN, INTERP_OUT, EPS, EXTRAP, RNORM, &
IBUDGET, CHAIN, EXACT, PMODE )
Each of the above parameters is described below.
On input:
Dis the dimension of the space forPTSandQ.Nis the number of data points inPTS.PTS(1:D,1:N)is a real valued matrix withNcolumns, each containing the coordinates of a single data point inR^D.Mis the number of interpolation points inQ.Q(1:D,1:M)is a real valued matrix withMcolumns, each containing the coordinates of a single interpolation point inR^D.
On output:
PTSandQhave been rescaled and shifted. All the data points inPTSare now contained in the unit hyperball inR^D, and the points inQhave been shifted and scaled accordingly in relation toPTS.SIMPS(1:D+1,1:M)contains theD+1integer indices (corresponding to columns inPTS) for theD+1vertices of the Delaunay simplex containing each interpolation point inQ.WEIGHTS(1:D+1,1:M)contains theD+1real-valued weights for expressing each point inQas a convex combination of theD+1corresponding vertices inSIMPS.IERR(1:M)contains integer valued error flags associated with the computation of each of theMinterpolation points inQ. The error codes are:
Codes 0, 1, 2 are expected to occur during normal execution.- 00 : Succesful interpolation.
- 01 : Succesful extrapolation (up to the allowed extrapolation distance).
- 02 : This point was outside the allowed extrapolation distance; the corresponding entries in SIMPS and WEIGHTS contain zero values.
- 10 : The dimension
Dmust be positive. - 11 : Too few data points to construct a triangulation (i.e.,
N < D+1). - 12 : No interpolation points given (i.e.,
M < 1). - 13 : The first dimension of
PTSdoes not agree with the dimensionD. - 14 : The second dimension of
PTSdoes not agree with the number of pointsN. - 15 : The first dimension of
Qdoes not agree with the dimensionD. - 16 : The second dimension of
Qdoes not agree with the number of interpolation pointsM. - 17 : The first dimension of the output array
SIMPSdoes not match the number of vertices needed for aD-simplex (D+1). - 18 : The second dimension of the output array
SIMPSdoes not match the number of interpolation pointsM. - 19 : The first dimension of the output array
WEIGHTSdoes not match the number of vertices for a aD-simplex (D+1). - 20 : The second dimension of the output array
WEIGHTSdoes not match the number of interpolation pointsM. - 21 : The size of the error array
IERRdoes not match the number of interpolation pointsM. - 22 :
INTERP_INcannot be present withoutINTERP_OUTor vice versa. - 23 : The first dimension of
INTERP_INdoes not match the first dimension ofINTERP_OUT. - 24 : The second dimension of
INTERP_INdoes not match the number of data pointsPTS. - 25 : The second dimension of
INTERP_OUTdoes not match the number of interpolation pointsM. - 26 : The budget supplied in
IBUDGETdoes not contain a positive integer. - 27 : The extrapolation distance supplied in
EXTRAPcannot be negative. - 28 : The size of the
RNORMoutput array does not match the number of interpolation pointsM.
- 30 : Two or more points in the data set
PTSare too close together with respect to the working precision (EPS), which would result in a numerically degenerate simplex. - 31 : All the data points in
PTSlie in some lower dimensional linear manifold (up to the working precision), and no valid triangulation exists.
- 40 : An error caused
DELAUNAYSPARSEPto terminate before this value could be computed. Note: The corresponding entries inSIMPSandWEIGHTSmay contain garbage values.
- 50 : A memory allocation error occurred while allocating the work array
WORK.
IBUDGETorEPShas been adjusted in a way that is unwise, or there may be another issue with the problem settings, which is manifesting in an unusual way.- 60 : The budget was exceeded before the algorithm converged on this
value. If the dimension is high, try increasing
IBUDGET. This error can also be caused by a working precisionEPSthat is too small for the conditioning of the problem. - 61 : A value that was judged appropriate later caused LAPACK to
encounter a singularity. Try increasing the value of
EPS. - 70 : Allocation error for the extrapolation work arrays. Note that extrapolation has a higher memory overhead than interpolation for the current version.
- 7x : BQPD has reported an error while computing the projection.
See the comment block for the
PROJECTsubroutine for more details.
- 80 : The LAPACK subroutine
DGEQP3has reported an illegal value. - 81 : The LAPACK subroutine
DGETRFhas reported an illegal value. - 82 : The LAPACK subroutine
DGETRShas reported an illegal value. - 83 : The LAPACK subroutine
DORMQRhas reported an illegal value.
- 90 : The value of
PMODEis not valid.
Optional arguments:
-
INTERP_IN(1:IR,1:N)contains real valued response vectors for each of the data points inPTSon input. The first dimension ofINTERP_INis inferred to be the dimension of these response vectors, and the second dimension must matchN. If present, the response values will be computed for each interpolation point inQ, and stored inINTERP_OUT, which therefore must also be present. If bothINTERP_INandINTERP_OUTare omitted, only the containing simplices and convex combination weights are returned. -
INTERP_OUT(1:IR,1:M)contains real valued response vectors for each interpolation point inQon output. The first dimension ofINTERP_OUTmust match the first dimension ofINTERP_IN, and the second dimension must matchM. If present, the response values at each interpolation point are computed as a convex combination of the response values (supplied inINTERP_IN) at the vertices of a Delaunay simplex containing that interpolation point. Therefore, ifINTERP_OUTis present, thenINTERP_INmust also be present. If both are omitted, only the simplices and convex combination weights are returned. -
EPScontains the real working precision for the problem on input. By default,EPSis assigned\sqrt{\mu}where\mudenotes the unit roundoff for the machine. In general, any values that differ by less thanEPSare judged as equal, and any weights that are greater than-EPSare judged as nonnegative.EPScannot take a value less than the default value of\sqrt{\mu}. If any value less than\sqrt{\mu}is supplied, the default value will be used instead automatically. -
EXTRAPcontains the real maximum extrapolation distance (relative to the diameter ofPTS) on input. Interpolation at a point outside the convex hull ofPTSis done by projecting that point onto the convex hull, and then doing normal Delaunay interpolation at that projection. Interpolation at any point inQthat is more thanEXTRAP * DIAMETER(PTS)units outside the convex hull ofPTSwill not be done and an error code of2will be returned. Note that computing the projection can be expensive. SettingEXTRAP=0will cause all extrapolation points to be ignored without ever computing a projection. By default,EXTRAP=0.1(extrapolate by up to 10% of the diameter ofPTS). -
RNORM(1:M)contains the real unscaled projection (2-norm) distances from any projection computations on output. If not present, these distances are still computed for each extrapolation point, but are never returned. -
IBUDGETon input contains the integer budget for performing flips while iterating toward the simplex containing each interpolation point inQ. This preventsDELAUNAYSPARSEPfrom falling into an infinite loop when an inappropriate value ofEPSis given with respect to the problem conditioning. By default,IBUDGET=50000. However, for extremely high-dimensional problems and pathological inputs, the default value may be insufficient. -
CHAINis a logical input argument that determines whether a new first simplex should be constructed for each interpolation point (CHAIN=.FALSE.), or whether the simplex walks should be "daisy-chained." By default,CHAIN=.FALSE.SettingCHAIN=.TRUE.is generally not recommended, unless the size of the triangulation is relatively small or the interpolation points are known to be tightly clustered. -
EXACTis a logical input argument that determines whether the exact diameter should be computed and whether a check for duplicate data points should be performed in advance. These checks areO(N^2 D)time complexity, whileDELAUNAYSPARSEtends towardO(N D^4)on average. By default,EXACT=.TRUE.and the exact diameter is computed and an error is returned wheneverPTScontains duplicate values up to the precisionEPS. WhenEXACT=.FALSE., the diameter ofPTSis approximated by twice the distance from the barycenter ofPTSto the farthest point inPTS, and no check is done to find the closest pair of points. WhenEXACT=.TRUE.,DELAUNAYSPARSEcould spend over 90% of runtime calculating these constants, which are not critical to theDELAUNAYSPARSEalgorithm. In particular, this happens for large values ofN. However, settingEXACT=.FALSE.could result in input errors that are difficult to identify. It is recommended that users verify the input setPTSand possibly rescalePTSmanually whileEXACT=.TRUE.Then, when 100% sure thatPTSis valid, users may choose to setEXACT=.FALSE.in production runs for large values ofNto achieve massive speedups. -
PMODEis an integer specifying the level of parallelism to be exploited.- If
PMODE = 1, then parallelism is exploited at the level of the loop over all interpolation points (Level 1 parallelism). - If
PMODE = 2, then parallelism is exploited at the level of the loops over data points when constructing/flipping simplices (Level 2 parallelism). - If
PMODE = 3, then parallelism is exploited at both levels. Note: this implies that the total number of threads active at any time could be up toOMP_NUM_THREADS^2. By default,PMODEis set to1if there is more than 1 interpolation point and2otherwise.
- If
Subroutines and functions directly referenced from BLAS are
-
DDOT, -
DGEMV, -
DNRM2, -
DTRSM,
-
DGEQP3, -
DGETRF, -
DGETRS, -
DORMQR.
The quadratic programming solver BQPD is also used.
For more information, see
Annals of Operations Research, 46 : 307--334 (1993).
The module REAL_PRECISION from HOMPACK90 (ACM TOMS Algorithm 777)
is used for the real data type. The REAL_PRECISION module,
DELAUNAYSPARSEP, and BQPD and its dependencies
comply with the Fortran 2008 standard.
PROJECT
The interface for PROJECT is
SUBROUTINE PROJECT(D, N, PTS, Z, RNORM, IERR, EPS, WEIGHTS)
Project a point outside the convex hull of the point set onto the convex hull by solving a non negatively constrained least squares problem with 1 equality constraint (an instance of the WNNLS problem):
min_X || MATMUL(PTS, X) - Z || s.t. X >= 0, SUM(X) == 1The solution to the WNNLS problem stated above gives the projection
Z_hat as a convex combination of the data points:
Z_hat = MATMUL(PTS, X).The above WNNLS problem is solved via R. Fletcher's QP solver
BQPD.
Compared to other existing (D)WNNLS solvers,
BQPD's flexible nature allows us to exploit the sparsity in
the solution X, which should contain at most D
positive entries (inactive constraints).
On input:
-
Dis the dimension of the space forPTSandZ. -
Nis the number of data points inPTS. -
PTS(1:D, 1:N)is a real valued matrix withNcolumns, each containing the coordinates of a single data point inR^D. -
Z(1:D)is a real vector specifying the coordinates of a single extrapolation point inR^D.
On output:
-
Zis overwritten with the result of the projection (labeledZ_hatabove). -
RNORMcontains the norm of the residual vector|| Z - Z_hat ||. -
IERRcontains an integer valued error flag (0=success) forwarded fromBQPD. Possible exit codes are listed below:- 0: solution obtained
- 1: unbounded problem detected
(
f(x) <= fminwould occur) - 2:
bl(i) > bu(i)for some i - 3: infeasible problem detected in Phase 1
- 4: incorrect setting of
m,n,kmax,mlp,mode, ortol(internalbqpdconstants) - 5: not enough space in
lp(internalbqpdconstants) - 6: not enough space for reduced Hessian matrix (increase
kmax, aBQPDconstant) - 7: not enough space for sparse factors (sparse code only,
should never occur for
DELAUNAYSPARSEusage) - 8: maximum number of unsuccessful restarts taken
- -1: a memory allocation error occurred (indicates the problem size is too large for the additional memory overhead from extrapolation)
Optional arguments:
-
EPScontains the real working precision for the problem on input. By default,EPSis assigned\sqrt{\mu}where\mudenotes the unit roundoff for the machine. In general, any values that differ by less thanEPSare judged as equal, and any weights that are greater than-EPSare judged as nonnegative.EPScannot take a value less than the default value of\sqrt{\mu}. If any value less than\sqrt{\mu}is supplied, the default value will be used instead automatically. Note that in order to ensure thatDELAUNAYSPARSEwill be within tolerances,BQPDdoes not use the value ofEPSgiven here. Instead,BQPDis given a tolerance ofEPS ** 1.5. -
WEIGHTS(N)is assigned the projection weights on output, when present.
Subroutines and functions directly referenced from BLAS are
-
DNRM2, -
DGEMV.
BQPD, its utility functions, and its sparse linear algebra
library are also referenced.
Notes: DELAUNAYSPARSE is available free of charge via a permissive
MIT LICENSE.
However, BQPD uses a slightly more restrictive license located in the
bqpd_min subdirectory.