ITAM-DS / analisis-numerico-computo-cientifico

Análisis numérico y cómputo científico
Apache License 2.0
44 stars 186 forks source link

Change definition of arreglo_2d for handling of 2-d arrays #464

Open palmoreck opened 6 years ago

palmoreck commented 6 years ago

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 commented 6 years ago

thanks to @cristianchallu @dsharpc @lizsolisd !

palmoreck commented 6 years ago

checking of BLAS, LAPACK examples was successful. TODO: check BLAS-OPENMPI examples