/************************************************************************* * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v10.html * * Contributors: Details at https://graphviz.org *************************************************************************/ #include #include #include #include #ifdef DIGCOLA #include #include #include #include static void standardize(double* orthog, int nvtxs) { double len, avg = 0; int i; for (i=0; i=n) { neigs=n; } for (i=0; i0 ? (DistType)sqrt(diff) : 0; } } } /* Compute the balance vector: */ for (i=0; i=y[j]) { balance[i]+=Dij[i][j]*(-lap[i][j]); // w_{ij}*delta_{ij} } else { balance[i]-=Dij[i][j]*(-lap[i][j]); // w_{ij}*delta_{ij} } } } for (converged=false,iterations2=0; iterations2<200 && !converged; iterations2++) { if (conjugate_gradient_f(lap, y, balance, n, conj_tol, n, true) < 0) { rv = 1; goto cleanup; } converged = true; for (i=0; i=y[j]) { b+=Dij[i][j]*(-lap[i][j]); } else { b-=Dij[i][j]*(-lap[i][j]); } } if ((b != balance[i]) && (fabs(1-b/balance[i])>1e-5)) { converged = false; balance[i]=b; } } } for (i = 0; !(fabs(uniLength) < DBL_EPSILON) && i < n; i++) { x[i] /= uniLength; y[i] /= uniLength; } cleanup: free (Dij[0]); free (Dij); free (lap[0]); free (lap); free (balance); return rv; } #endif /* DIGCOLA */