# correctionDistanceMatrix: Correction of a Distance Matrix In CEGO: Combinatorial Efficient Global Optimization

## Description

Convert (possibly non-euclidean or non-metric) distance matrix with chosen approach so that it becomes a CNSD matrix. Optionally, the resulting matrix is enforced to have positive elements and zero diagonal, with the `repair` parameter. Essentially, this is a combination of functions `correctionDefinite` or `correctionCNSD` with `repairConditionsDistanceMatrix`.

## Usage

 ```1 2 3 4 5 6 7``` ```correctionDistanceMatrix( mat, type = "NSD", method = "flip", repair = TRUE, tol = 1e-08 ) ```

## Arguments

 `mat` symmetric distance matrix `type` string that specifies type of correction: `"CNSD"`,`"NSD"` to enforce CNSD or NSD matrices respectively. `method` string that specifies method for correction: spectrum clip `"clip"`, spectrum flip `"flip"`, nearest definite matrix `"near"`, spectrum square`"square"`, spectrum diffusion `"diffusion"`, feature embedding `"feature"`. `repair` boolean, whether or not to use condition repair, so that elements are positive, and diagonal is zero. `tol` torelance value. Eigenvalues between `-tol` and `tol` are assumed to be zero.

## Value

list with corrected distance matrix `mat`, `isCNSD` (boolean, whether original matrix was CNSD) and transformation matrix `A`.

## References

Martin Zaefferer and Thomas Bartz-Beielstein. (2016). Efficient Global Optimization with Indefinite Kernels. Parallel Problem Solving from Nature-PPSN XIV. Accepted, in press. Springer.

`correctionDefinite`,`correctionCNSD`,`repairConditionsDistanceMatrix`
 ```1 2 3 4 5 6``` ```x <- list(c(2,1,4,3),c(2,4,3,1),c(4,2,1,3),c(4,3,2,1),c(1,4,3,2)) D <- distanceMatrix(x,distancePermutationInsert) is.CNSD(D) #matrix should not be CNSD D <- correctionDistanceMatrix(D)\$mat is.CNSD(D) #matrix should now be CNSD D ```