77 int * indices = &itemp[allocated_space];
78 double * merit= dtemp;
79 double * vals = &dtemp[allocated_space];
81 while (blockIndices[next] == -1) {
84 int neighbors_in_line=0;
87 else Graph_->ExtractMyRowCopy(next,allocated_space,n,cols);
90 double x0 = (xvals) ? xvals[next/NumEqns] : 0.0;
91 double y0 = (yvals) ? yvals[next/NumEqns] : 0.0;
92 double z0 = (zvals) ? zvals[next/NumEqns] : 0.0;
96 for(
int i=0; i<n; i+=NumEqns) {
97 if(cols[i] >=
N)
continue;
98 int nn = cols[i] / NumEqns;
99 if(blockIndices[nn]==LineID) neighbors_in_line++;
104 if(cols[i]==next) merit[neighbor_len] = -DBL_MAX;
107 indices[neighbor_len]=cols[i];
112 if(neighbors_in_line > 1)
break;
115 for(
int k=0; k<NumEqns; k++)
116 blockIndices[next + k] = LineID;
121 if(neighbor_len > 2 && indices[1] != last && blockIndices[indices[1]] == -1 && merit[1] <
tol*merit[neighbor_len-1]) {
125 else if(neighbor_len > 3 && indices[2] != last && blockIndices[indices[2]] == -1 && merit[2] <
tol*merit[neighbor_len-1]) {
144 int * cols =
new int[2*allocated_space];
145 int * indices = &cols[allocated_space];
146 double * merit =
new double[2*allocated_space];
147 double * vals = &merit[allocated_space];
149 int * itemp =
new int[2*allocated_space];
150 double *dtemp =
new double[2*allocated_space];
155 for(
int i=0; i<
N; i+=NumEqns) {
158 if(blockIndices[i] !=-1)
continue;
162 else Graph_->ExtractMyRowCopy(i,allocated_space,nz,cols);
164 double x0 = (xvals) ? xvals[i/NumEqns] : 0.0;
165 double y0 = (yvals) ? yvals[i/NumEqns] : 0.0;
166 double z0 = (zvals) ? zvals[i/NumEqns] : 0.0;
169 for(
int j=0; j<nz; j+=NumEqns) {
170 int nn = cols[j] / NumEqns;
171 if(cols[j] >=
N)
continue;
176 if(cols[j]==i) merit[neighbor_len] = -DBL_MAX;
178 indices[neighbor_len] = cols[j];
185 for(
int k=0; k<NumEqns; k++)
186 blockIndices[i + k] = num_lines;
189 if(neighbor_len > 2 && merit[1] <
tol*merit[neighbor_len-1]) {
193 if(neighbor_len > 3 && merit[2] <
tol*merit[neighbor_len-1]) {
double compute_distance_coordinates(double x0, double y0, double z0, int nn, const double *xvals, const double *yvals, const double *zvals)
void Sort(bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
void local_automatic_line_search(int NumEqns, int *blockIndices, int last, int next, int LineID, double tol, int *itemp, double *dtemp) const