// utils.h
//  declares the functions defined in utils.cc 
//  Free software by David J C MacKay  Thu 1/11/07

using namespace std;
#include <iostream>
#include <fstream> 

// memory management
int  *ivector ( int low, int high ) ;
void freeivector ( int* a , int low ) ;
int   **imatrix ( int low1, int high1, int low2, int high2 ) ;
int  freeimatrix ( int **m, int low1, int high1, int low2, int high2 ) ;
double *dvector ( int low, int high ) ;
void   freedvector ( double* a , int low ) ;
double **dmatrix ( int low1, int high1, int low2, int high2 ) ;
int    freedmatrix ( double **m, int low1, int high1, int low2, int high2 ) ;

// print-out
void printVector( double *b , int lo , int hi , int style=1 ) ; 
void printMatrixT( double **M , int low1, int high1, int low2, int high2 ) ;
void printMatrix( double **M , int low1, int high1, int low2, int high2 ) ;
void fprintVector( double *b , int lo , int hi , ostream &fout , int style=1 ) ;
 
// maths
double innerProduct( double *a , double *b , int low , int high ) ;
void incrementdvector( double *a , double epsilon, double *b , int low , int high ) ;
void constantdvector( double *a , int low , int high , double  val ) ;

