//
// Copyright (c) 2006-2019 of Toni Giorgino
//
// This file is part of the DTW package.
//
// DTW is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DTW is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with DTW. If not, see .
//
/*
* Triangle fixing algorithm - implementation of algorithm 3.1
* (Metric_Nearness_L2) in Brickell, J., Dhillon, I., Sra, S., and
* Tropp, J. (2008). The Metric Nearness Problem. SIAM. J. Matrix
* Anal. & Appl. 30, 375-396.
*
*/
#include
#include
static int n;
/* Index in 2d matrices: 0 <= i < j < n */
//#define ED(ii,jj) ((jj)*n+(ii))
static inline size_t ED(size_t ii, size_t jj) {
if(ii *kappa_p ) {
size_t t=0;
*delta_p=0.0;
/* Foreach triangle inequality */
for(size_t i=0; i