analisis-numerico-computo-cientifico icon indicating copy to clipboard operation
analisis-numerico-computo-cientifico copied to clipboard

Change definition of arreglo_2d for handling of 2-d arrays

Open palmoreck opened this issue 6 years ago • 2 comments

This definition of arreglo_2d needs that m is defined somewhere in the code:

//arreglo2d:
typedef struct{
int m, n;
#define renglones(arreglo) ((arreglo)->m)
#define columnas(arreglo) ((arreglo)->n)
double *arr;
#define entradas(arreglo) ((arreglo)->arr)
#define entrada(arreglo,i,j) ((arreglo)->arr[j*m+i]) //almacenamos column major
}arreglo_2d;
typedef arreglo_2d *arreglo_2d_T;

Snippet from: https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/BLAS/ejemplos https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/LAPACK/ejemplos https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/extensiones_a_C/MPI/openMPI/ejemplos/3_openMPI_y_BLAS

To avoid this define arreglo_2d as:

//arreglo2d:
typedef struct{
int m, n;
#define renglones(arreglo) ((arreglo)->m)
#define columnas(arreglo) ((arreglo)->n)
double *arr;
#define entradas(arreglo) ((arreglo)->arr)
#define entrada(arreglo,i,j) ((arreglo)->arr[j*renglones(arreglo)+i]) //almacenamos column major
}arreglo_2d;
typedef arreglo_2d *arreglo_2d_T;

So I have to run examples of BLAS, LAPACK and BLAS-OPENMPI to check everything is ok¡

palmoreck avatar Apr 30 '18 01:04 palmoreck