Int_matrix - Int_matrix type


#include "l/l_int_matrix.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

typedef struct Int_matrix
	int num_rows;
	int num_cols;
	int **elements;
	int max_num_elements;
	int max_num_rows;
	int max_num_cols;


int num_rows
Current number of rows from the callers point of view.
int num_cols
Current number of cols from the callers point of view.
int **elements
Where the data is.
int max_num_elements
Private: The number of elements that can be stored.
int max_num_rows
Private: The number of rows that we have pointers for.
int max_num_cols
Private: The current wrapping count.


This type is the int_matrix type for the KJB library and is used by many routines. It stores a int_matrix with num_rows rows and num_cols cols. If "mp" is a pointer to the type Int_matrix, then mp->elements[ row ][ col ] accesses the element (row, col), and mp->elements[ row ] accesses the row'th row. Note that counting starts at 0. The integer array rows may or may not be stored consecutively in memory. Because of this, and because some routines may (most don't) take advantage of knowlege of the internal structure for performance, it is important NOT to swap rows by swapping pointers -- the elements should be copied. Even if no routines make use of the internal structutre, swapping rows by swapping pointers will make it so that the memory does not get free'd properly. The sizes (num_rows and num_cols) must both be nonnegative. Conventionally, num_rows and num_cols are both positive; however, it is also acceptable to have num_rows and num_cols both zero. Anything else (such as a mix of positive and zero sizes) is regarded as a bug in the calling program -- set_bug(3) is called and (if it returns) ERROR is returned.


As described above, the user of this library must take care with assumptions about the structure of the array embedded in the int_matrix type.


get_target_int_matrix, free_int_matrix


This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.


Kobus Barnard


Kobus Barnard


Int_matrix_vector , Int_vector_matrix , same_int_matrix_dimensions , Int_matrix_vector_vector , verify_non_negative_int_matrix