4 /* $Id: secdp.c,v 1.2 2006/02/20 08:35:37 akinjo Exp $ */
7 static char vcid[] = "$Id: secdp.c,v 1.2 2006/02/20 08:35:37 akinjo Exp $";
10 static const double scagap = 1.0;
11 static char *sec = "HEC";
13 static double gap[3][3] =
15 /* { 1.0113036 , -5.8465444 , -1.6370586 , }, */
16 /* { -4.2604538 , 1.3119079 , -0.9302283 , }, */
17 /* { -1.6658889 , -0.9093533 , 0.6393491 , }, */
20 { -1.1949517 , -8.4615910 , -3.5438586 , },
21 { -6.8755005 , -1.7119301 , -3.2458195 , },
22 { -3.5726889 , -3.2249445 , -0.9679954 , },
27 double mymax3(double st[], int *ind) {
28 if(st[2] >= st[1] && st[2] >= st[0]) {
32 else if(st[1] >= st[2] && st[1] >= st[0]) {
41 void secdp(int len, double y[][3], char psec[])
51 for(i=0; i < len; i++) {
58 for(j=0;j<3;j++) t[0][j] = y[0][j];
60 for(i = 1; i<len; i++) {
62 st[0] = t[i-1][0] + gap[0][j]*scagap;
63 st[1] = t[i-1][1] + gap[1][j]*scagap;
64 st[2] = t[i-1][2] + gap[2][j]*scagap;
65 tmax = mymax3(st, &ind);
66 t[i][j] = tmax + y[i][j];
71 /* for(i=0; i< len; i++) { */
72 /* printf ("%5d : ", i+1); */
73 /* for(j=0; j<3; j++) { */
74 /* printf("%8.3f %5d %8.3f: ", t[i][j],bt[i][j], y[i][j]); */
79 tmax = mymax3(t[len-1], &ind);
80 psec[len-1] = sec[ind];
81 for(i=len-1; i> 0; i--) {
82 psec[i-1] = sec[bt[i][ind]];
89 void secmax(int len, double y[][3], char psec[])
94 for(i=0; i< len; i++) {
95 tmax = mymax3(y[i],&ind);