Go to the source code of this file.
|
ABC_NAMESPACE_IMPL_START
sm_matrix * | sm_alloc () |
|
sm_matrix * | sm_alloc_size (int row, int col) |
|
void | sm_free (sm_matrix *A) |
|
sm_matrix * | sm_dup (sm_matrix *A) |
|
void | sm_resize (sm_matrix *A, int row, int col) |
|
sm_element * | sm_insert (sm_matrix *A, int row, int col) |
|
sm_element * | sm_find (sm_matrix *A, int rownum, int colnum) |
|
void | sm_remove (sm_matrix *A, int rownum, int colnum) |
|
void | sm_remove_element (sm_matrix *A, sm_element *p) |
|
void | sm_delrow (sm_matrix *A, int i) |
|
void | sm_delcol (sm_matrix *A, int i) |
|
void | sm_copy_row (sm_matrix *dest, int dest_row, sm_row *prow) |
|
void | sm_copy_col (sm_matrix *dest, int dest_col, sm_col *pcol) |
|
sm_row * | sm_longest_row (sm_matrix *A) |
|
sm_col * | sm_longest_col (sm_matrix *A) |
|
int | sm_num_elements (sm_matrix *A) |
|
int | sm_read (FILE *fp, sm_matrix **A) |
|
int | sm_read_compressed (FILE *fp, sm_matrix **A) |
|
void | sm_write (FILE *fp, sm_matrix *A) |
|
void | sm_print (FILE *fp, sm_matrix *A) |
|
void | sm_dump (sm_matrix *A, char *s, int max) |
|
void | sm_cleanup () |
|
sm_matrix* sm_alloc_size |
( |
int |
row, |
|
|
int |
col |
|
) |
| |
Definition at line 48 of file matrix.c.
ABC_NAMESPACE_IMPL_START sm_matrix * sm_alloc()
void sm_resize(sm_matrix *A, int row, int col)
Definition at line 552 of file matrix.c.
554 #ifdef FAST_AND_LOOSE
556 register sm_row *prow, *pnextrow;
557 register sm_col *pcol, *pnextcol;
559 for(p = sm_element_freelist; p != 0; p = pnext) {
563 sm_element_freelist = 0;
565 for(prow = sm_row_freelist; prow != 0; prow = pnextrow) {
571 for(pcol = sm_col_freelist; pcol != 0; pcol = pnextcol) {
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition at line 355 of file matrix.c.
362 for(p = pcol->
first_row; p != 0; p = p->next_row) {
363 (void)
sm_insert(dest, dest_col, p->row_num);
sm_element * sm_insert(sm_matrix *A, int row, int col)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition at line 341 of file matrix.c.
348 for(p = prow->
first_col; p != 0; p = p->next_col) {
349 (void)
sm_insert(dest, dest_row, p->col_num);
sm_element * sm_insert(sm_matrix *A, int row, int col)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition at line 307 of file matrix.c.
318 for(p = pcol->
first_row; p != 0; p = pnext) {
334 next_col, prev_col, A->
ncols);
void sm_row_remove_element(sm_row *prow, sm_element *p)
void sm_delrow(sm_matrix *A, int i)
#define dll_unlink(p, first, last, next, prev, count)
#define sm_get_row(A, rownum)
#define sm_get_col(A, colnum)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
void sm_col_free(sm_col *pcol)
Definition at line 273 of file matrix.c.
284 for(p = prow->
first_col; p != 0; p = pnext) {
300 next_row, prev_row, A->
nrows);
#define dll_unlink(p, first, last, next, prev, count)
#define sm_get_row(A, rownum)
#define sm_get_col(A, colnum)
void sm_col_remove_element(sm_col *pcol, sm_element *p)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
void sm_row_free(sm_row *prow)
void sm_delcol(sm_matrix *A, int i)
void sm_dump |
( |
sm_matrix * |
A, |
|
|
char * |
s, |
|
|
int |
max |
|
) |
| |
Definition at line 538 of file matrix.c.
545 (void) fprintf(fp,
"%s %d rows by %d cols\n", s, A->
nrows, A->
ncols);
void sm_print(FILE *fp, sm_matrix *A)
Definition at line 104 of file matrix.c.
115 for(p = prow->
first_col; p != 0; p = p->next_col) {
116 (void)
sm_insert(B, p->row_num, p->col_num);
sm_element * sm_insert(sm_matrix *A, int row, int col)
ABC_NAMESPACE_IMPL_START sm_matrix * sm_alloc()
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
void sm_resize(sm_matrix *A, int row, int col)
Definition at line 205 of file matrix.c.
#define sm_get_row(A, rownum)
sm_element * sm_col_find(sm_col *pcol, int row)
sm_element * sm_row_find(sm_row *prow, int col)
#define sm_get_col(A, colnum)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition at line 60 of file matrix.c.
69 prow->
last_col->next_col = sm_element_freelist;
82 register sm_row *prow, *pnext_row;
83 register sm_col *pcol, *pnext_col;
85 for(prow = A->
first_row; prow != 0; prow = pnext_row) {
89 for(pcol = A->
first_col; pcol != 0; pcol = pnext_col) {
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
void sm_row_free(sm_row *prow)
void sm_col_free(sm_col *pcol)
Definition at line 155 of file matrix.c.
173 next_row, prev_row, row_num, row, prow);
181 next_col, prev_col, col_num, col, pcol);
186 save_element = element;
190 prow->
length, next_col, prev_col, col_num, col, element);
193 if (element == save_element) {
195 pcol->
length, next_row, prev_row, row_num, row, element);
#define sm_element_free(e)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
#define sm_element_alloc(newobj)
ABC_NAMESPACE_IMPL_START sm_row * sm_row_alloc()
void sm_resize(sm_matrix *A, int row, int col)
ABC_NAMESPACE_IMPL_START sm_col * sm_col_alloc()
Definition at line 388 of file matrix.c.
391 register sm_col *large_col, *pcol;
392 register int max_length;
397 if (pcol->
length > max_length) {
398 max_length = pcol->
length;
Definition at line 369 of file matrix.c.
372 register sm_row *large_row, *prow;
373 register int max_length;
378 if (prow->
length > max_length) {
379 max_length = prow->
length;
Definition at line 406 of file matrix.c.
#define sm_foreach_row(A, prow)
Definition at line 489 of file matrix.c.
498 (void) fprintf(fp,
" ");
500 (void) fprintf(fp,
"%d", (pcol->
col_num / 100)%10);
506 (void) fprintf(fp,
" ");
508 (void) fprintf(fp,
"%d", (pcol->
col_num / 10)%10);
513 (void) fprintf(fp,
" ");
515 (void) fprintf(fp,
"%d", pcol->
col_num % 10);
519 (void) fprintf(fp,
" ");
521 (void) fprintf(fp,
"-");
526 (void) fprintf(fp,
"%3d:", prow->
row_num);
sm_element * sm_row_find(sm_row *prow, int col)
Definition at line 420 of file matrix.c.
428 err = fscanf(fp,
"%d %d", &i, &j);
431 }
else if (err != 2) {
sm_element * sm_insert(sm_matrix *A, int row, int col)
ABC_NAMESPACE_IMPL_START sm_matrix * sm_alloc()
int sm_read_compressed |
( |
FILE * |
fp, |
|
|
sm_matrix ** |
A |
|
) |
| |
Definition at line 441 of file matrix.c.
445 int i, j, k, nrows, ncols;
449 if (fscanf(fp,
"%d %d", &nrows, &ncols) != 2) {
454 for(i = 0; i < nrows; i++) {
455 if (fscanf(fp,
"%lx", &x) != 1) {
458 for(j = 0; j < ncols; j += 32) {
459 if (fscanf(fp,
"%lx", &x) != 1) {
462 for(k = j; x != 0; x >>= 1, k++) {
sm_element * sm_insert(sm_matrix *A, int row, int col)
ABC_NAMESPACE_IMPL_START sm_matrix * sm_alloc()
void sm_resize(sm_matrix *A, int row, int col)
void sm_remove |
( |
sm_matrix * |
A, |
|
|
int |
rownum, |
|
|
int |
colnum |
|
) |
| |
Definition at line 230 of file matrix.c.
sm_element * sm_find(sm_matrix *A, int rownum, int colnum)
void sm_remove_element(sm_matrix *A, sm_element *p)
Definition at line 240 of file matrix.c.
252 next_col, prev_col, prow->
length);
262 next_row, prev_row, pcol->
length);
#define sm_element_free(e)
void sm_delrow(sm_matrix *A, int i)
#define dll_unlink(p, first, last, next, prev, count)
#define sm_get_row(A, rownum)
#define sm_get_col(A, colnum)
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
void sm_delcol(sm_matrix *A, int i)
void sm_resize |
( |
sm_matrix * |
A, |
|
|
int |
row, |
|
|
int |
col |
|
) |
| |
Definition at line 125 of file matrix.c.
129 register int i, new_size;
134 for(i = A->
rows_size; i < new_size; i++) {
143 for(i = A->
cols_size; i < new_size; i++) {
#define REALLOC(type, obj, num)
Definition at line 474 of file matrix.c.
482 for(p = prow->
first_col; p != 0; p = p->next_col) {
483 (void) fprintf(fp,
"%d %d\n", p->row_num, p->col_num);
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element