49 lines
899 B
C
49 lines
899 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
/* #define ENABLE_LOG */
|
|
|
|
#ifdef ENABLE_LOG
|
|
# define LOG(x) x
|
|
#else
|
|
# define LOG(x) (void) 0
|
|
#endif
|
|
|
|
/*
|
|
* Macro used with single array matrices to
|
|
* get the array index given the number of columns,
|
|
* the row index and the column index.
|
|
*/
|
|
#define IDX(cols, r, c) ((r) * (cols) + (c))
|
|
|
|
typedef struct borders {
|
|
float north;
|
|
float east;
|
|
float south;
|
|
float west;
|
|
} borders;
|
|
|
|
|
|
/*
|
|
* Create a matrix stored in a single array.
|
|
*/
|
|
float *create_sa_matrix(int rows, int cols);
|
|
|
|
/*
|
|
* Destroy a single array matrix.
|
|
*/
|
|
void destroy_sa_matrix(float *x);
|
|
|
|
int sa_index(int cols, int r, int c);
|
|
|
|
/*
|
|
* Print a single array matrix.
|
|
*/
|
|
void print_sa_matrix(float *x, int rows, int cols);
|
|
|
|
float **create_matrix(int rows, int cols);
|
|
void destroy_matrix(float **x, int rows);
|
|
void print_matrix(float **x, int rows, int cols);
|
|
|
|
float fmaxf(float a, float b);
|