10 #ifndef ICL_PLASMA_DESCRIPTOR_H
11 #define ICL_PLASMA_DESCRIPTOR_H
13 #include "plasma_types.h"
14 #include "plasma_error.h"
79 static inline size_t plasma_element_size(
int type)
82 case PlasmaByte:
return 1;
83 case PlasmaInteger:
return sizeof(int);
84 case PlasmaRealFloat:
return sizeof(float);
85 case PlasmaRealDouble:
return sizeof(double);
86 case PlasmaComplexFloat:
return 2*
sizeof(float);
87 case PlasmaComplexDouble:
return 2*
sizeof(double);
93 static inline void *plasma_tile_addr_general(
plasma_desc_t A,
int m,
int n)
95 int mm = m + A.
i/A.
mb;
96 int nn = n + A.
j/A.
nb;
97 size_t eltsize = plasma_element_size(A.
precision);
105 offset = A.
mb*A.
nb*(mm + (size_t)lm1 * nn);
107 offset = A.
A12 + ((size_t)A.
mb * (A.
gn%A.
nb) * mm);
110 offset = A.
A21 + ((size_t)A.
nb * (A.
gm%A.
mb) * nn);
114 return (
void*)((
char*)A.
matrix + (offset*eltsize));
118 static inline void *plasma_tile_addr_triangle(
plasma_desc_t A,
int m,
int n)
120 int mm = m + A.
i/A.
mb;
121 int nn = n + A.
j/A.
nb;
122 size_t eltsize = plasma_element_size(A.
precision);
130 if (A.
type == PlasmaUpper) {
131 offset = A.
mb*A.
nb*(mm + (nn * (nn + 1))/2);
134 offset = A.
mb*A.
nb*((mm - nn) + (nn * (2*lm1 - (nn-1)))/2);
138 offset = A.
A12 + ((size_t)A.
mb * (A.
gn%A.
nb) * mm);
143 offset = A.
A21 + ((size_t)A.
nb * (A.
gm%A.
mb) * nn);
150 return (
void*)((
char*)A.
matrix + (offset*eltsize));
154 static inline void *plasma_tile_addr_general_band(
plasma_desc_t A,
int m,
int n)
156 return plasma_tile_addr_general(A, (A.
kut-1)+m-n, n);
160 static inline void *plasma_tile_addr(
plasma_desc_t A,
int m,
int n)
162 if (A.
type == PlasmaGeneral) {
163 return plasma_tile_addr_general(A, m, n);
165 else if (A.
type == PlasmaGeneralBand) {
166 return plasma_tile_addr_general_band(A, m, n);
168 else if (A.
type == PlasmaUpper || A.
type == PlasmaLower) {
169 return plasma_tile_addr_triangle(A, m, n);
172 plasma_fatal_error(
"invalid matrix type");
214 if ((A.
i+A.
m)%A.
mb == 0)
217 return (A.
i+A.
m)%A.
mb;
231 if ((A.
j+A.
n)%A.
nb == 0)
234 return (A.
j+A.
n)%A.
nb;
238 static inline int plasma_tile_mmain_band(
plasma_desc_t A,
int m,
int n)
240 return plasma_tile_mmain(A, (A.
kut-1)+m-n);
244 int plasma_desc_general_create(plasma_enum_t dtyp,
int mb,
int nb,
245 int lm,
int ln,
int i,
int j,
int m,
int n,
248 int plasma_desc_general_band_create(plasma_enum_t dtyp, plasma_enum_t uplo,
249 int mb,
int nb,
int lm,
int ln,
250 int i,
int j,
int m,
int n,
int kl,
int ku,
253 int plasma_desc_triangular_create(plasma_enum_t dtyp, plasma_enum_t uplo,
int mb,
int nb,
254 int lm,
int ln,
int i,
int j,
int m,
int n,
259 int plasma_desc_general_init(plasma_enum_t precision,
void *matrix,
260 int mb,
int nb,
int lm,
int ln,
int i,
int j,
263 int plasma_desc_general_band_init(plasma_enum_t precision, plasma_enum_t uplo,
264 void *matrix,
int mb,
int nb,
int lm,
int ln,
265 int i,
int j,
int m,
int n,
int kl,
int ku,
268 int plasma_desc_triangular_init(plasma_enum_t precision, plasma_enum_t uplo,
void *matrix,
269 int mb,
int nb,
int lm,
int ln,
int i,
int j,
278 int plasma_descT_create(
plasma_desc_t A,
int ib, plasma_enum_t householder_mode,
285 #endif // ICL_PLASMA_DESCRIPTOR_H
int n
number of columns of the submatrix
Definition: plasma_descriptor.h:66
int mb
number of rows in a tile
Definition: plasma_descriptor.h:53
int j
column index to the beginning of the submatrix
Definition: plasma_descriptor.h:64
void * matrix
pointer to the beginning of the matrix
Definition: plasma_descriptor.h:47
int gn
number of columns of the entire matrix
Definition: plasma_descriptor.h:58
plasma_enum_t precision
precision of the matrix
Definition: plasma_descriptor.h:44
int nb
number of columns in a tile
Definition: plasma_descriptor.h:54
int i
row index to the beginning of the submatrix
Definition: plasma_descriptor.h:63
size_t A22
pointer to the beginning of A22
Definition: plasma_descriptor.h:50
size_t A12
pointer to the beginning of A12
Definition: plasma_descriptor.h:49
int gnt
number of tile columns of the entire matrix
Definition: plasma_descriptor.h:60
int m
number of rows of the submatrix
Definition: plasma_descriptor.h:65
int kl
number of rows below the diagonal
Definition: plasma_descriptor.h:71
int kut
Definition: plasma_descriptor.h:74
int gmt
number of tile rows of the entire matrix
Definition: plasma_descriptor.h:59
plasma_enum_t uplo
upper, lower, etc.
Definition: plasma_descriptor.h:43
int ku
number of rows above the diagonal
Definition: plasma_descriptor.h:72
int gm
number of rows of the entire matrix
Definition: plasma_descriptor.h:57
int mt
number of tile rows of the submatrix
Definition: plasma_descriptor.h:67
int klt
number of tile rows below the diagonal tile
Definition: plasma_descriptor.h:73
Definition: plasma_descriptor.h:40
size_t A21
pointer to the beginning of A21
Definition: plasma_descriptor.h:48
int nt
number of tile columns of the submatrix
Definition: plasma_descriptor.h:68
plasma_enum_t type
general, general band, etc.
Definition: plasma_descriptor.h:42