1 #include <../../nrnconf.h>
34 static char rcsid[] =
"spswap.c,v 1.1 1997/12/04 17:55:54 hines Exp";
41 #define btos(x) ((x) ? "TRUE" : "FALSE")
50 int col, idx, j_idx, row_num;
65 for ( j_idx = 0; j_idx <
scan_row->dim; j_idx++ )
71 if ( col < 0 || col >=
A->n )
78 r = &(
A->row[row_num]);
86 printf(
"scan_to: row_num = %d, idx = %d, col = %d\n",
92 while (
e->nxt_row >= 0 &&
e->nxt_row <= max_row )
96 e = &(
A->row[row_num].elt[idx]);
109 int col, old_row, old_idx, row_num, idx;
116 r = &(
A->row[old_row]);
118 e = &(r->
elt[old_idx]);
119 e->nxt_row = row_num;
124 A->start_row[col] = row_num;
125 A->start_idx[col] = idx;
136 int col, *row_num, *idx, max_row;
138 int old_idx, old_row, tmp_idx, tmp_row;
142 if ( col < 0 || col >=
A->n )
147 if (
A->start_row[col] > max_row )
155 tmp_row =
A->start_row[col];
156 tmp_idx =
A->start_idx[col];
164 while ( tmp_row >= 0 && tmp_row < max_row )
166 r = &(
A->row[tmp_row]);
168 if ( tmp_idx < 0 || tmp_idx >= r->
len ||
169 r->
elt[tmp_idx].
col != col )
172 printf(
"chase_col:error: col = %d, row # = %d, idx = %d\n",
173 col, tmp_row, tmp_idx);
174 printf(
"chase_col:error: old_row = %d, old_idx = %d\n",
176 printf(
"chase_col:error: A =\n");
181 e = &(r->
elt[tmp_idx]);
184 tmp_row =
e->nxt_row;
185 tmp_idx =
e->nxt_idx;
187 if ( old_row > max_row )
193 else if ( tmp_row <= max_row && tmp_row >= 0 )
212 int col, *row_num, *idx, min_row;
216 int tmp_idx, tmp_row;
223 if (
A->start_row[col] < 0 )
227 tmp_row =
A->start_row[col];
228 tmp_idx =
A->start_idx[col];
231 else if ( tmp_row < min_row )
233 r = &(
A->row[tmp_row]);
234 if ( tmp_idx < 0 || tmp_idx >= r->
len ||
235 r->
elt[tmp_idx].
col != col )
247 if ( tmp_idx < 0 || tmp_idx >=
A->row[tmp_row].len ||
248 A->row[tmp_row].elt[tmp_idx].col != col )
250 e = &(
A->row[tmp_row].elt[tmp_idx]);
260 int col, *row_num, *idx;
264 int tmp_row, tmp_idx;
272 tmp_row =
A->start_row[col];
273 tmp_idx =
A->start_idx[col];
277 r = &(
A->row[tmp_row]);
278 if ( tmp_idx < 0 || tmp_idx >= r->
len ||
279 r->
elt[tmp_idx].
col != col )
281 e = &(r->
elt[tmp_idx]);
282 tmp_row =
e->nxt_row;
283 tmp_idx =
e->nxt_idx;
292 if ( tmp_idx < 0 || tmp_idx >=
A->row[tmp_row].len ||
293 A->row[tmp_row].elt[tmp_idx].col != col )
295 e = &(
A->row[tmp_row].elt[tmp_idx]);
#define error(err_num, fn_name)
SPMAT * sp_col_access(SPMAT *A)
void sp_dump(FILE *fp, SPMAT *A)
#define sprow_idx2(r, c, hint)
row_elt * chase_col(SPMAT *A, int col, int *row_num, int *idx, int max_row)
row_elt * bump_col(SPMAT *A, int col, int *row_num, int *idx)
row_elt * chase_past(SPMAT *A, int col, int *row_num, int *idx, int min_row)
void scan_to(SPMAT *A, IVEC *scan_row, IVEC *scan_idx, IVEC *col_list, int max_row)
void patch_col(SPMAT *A, int col, int old_row, int old_idx, int row_num, int idx)