#include #include #ifdef PARALLEL #include "mpi.h" #endif int *allocate_int_vector (int n) { int *x; if ((x = (int*) calloc (n, sizeof(int))) == NULL) { fprintf (stderr, "Problem allocating memory for vector\n"); #ifdef PARALLEL MPI_Abort (MPI_COMM_WORLD, 1); #else exit (1); #endif } return x; } double *allocate_double_vector (int n) { double *x; if ((x = (double*) calloc (n, sizeof(double))) == NULL) { fprintf (stderr, "Problem allocating memory for vector\n"); #ifdef PARALLEL MPI_Abort (MPI_COMM_WORLD, 1); #else exit (1); #endif } return x; } void free_vector (double *x) { free (x); }