PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
core_dgetrip.c
Go to the documentation of this file.
1 
21 #include <stdlib.h>
22 #include "common.h"
23 #include "quark.h"
24 
50 #if defined(PLASMA_HAVE_WEAK)
51 #pragma weak CORE_dgetrip = PCORE_dgetrip
52 #define CORE_dgetrip PCORE_dgetrip
53 #endif
54 void CORE_dgetrip(int m, int n, double *A, double *W) {
55  double t;
56  int i, j;
57 
58  if( m != n ) {
59  /* rectangular transposition (use workspace) */
60  for (i=0; i<m; i++) {
61  for (j=0; j<n; j++) {
62  W[j+i*n] = A[i+j*m];
63  }
64  }
65  memcpy(A, W, m*n*sizeof(double));
66  }
67  else {
68  /* square transposition (swap pairwise) */
69  for (i=0; i<m; i++) {
70  for (j=i+1; j<n; j++) {
71  t = A[j+i*n];
72  A[j+i*n] = A[i+j*m];
73  A[i+j*m] = t;
74  }
75  }
76  }
77 }
78 
79 /***************************************************************************/
82 void QUARK_CORE_dgetrip(Quark *quark, Quark_Task_Flags *task_flags,
83  int m, int n, double *A, int szeA)
84 {
86  QUARK_Insert_Task(quark, CORE_dgetrip_quark, task_flags,
87  sizeof(int), &m, VALUE,
88  sizeof(int), &n, VALUE,
89  sizeof(double)*szeA, A, INOUT,
90  sizeof(double)*szeA, NULL, SCRATCH,
91  0);
92 }
93 
94 /***************************************************************************/
97 #if defined(PLASMA_HAVE_WEAK)
98 #pragma weak CORE_dgetrip_quark = PCORE_dgetrip_quark
99 #define CORE_dgetrip_quark PCORE_dgetrip_quark
100 #endif
102 {
103  int m;
104  int n;
105  double *A;
106  double *W;
107 
108  quark_unpack_args_4(quark, m, n, A, W);
109  CORE_dgetrip(m, n, A, W);
110 }
111 
112 /***************************************************************************/
116  int m, int n,
117  double *A, int szeA,
118  double *fake, int szeF, int paramF)
119 {
122  quark, CORE_dgetrip_f1_quark, task_flags,
123  sizeof(int), &m, VALUE,
124  sizeof(int), &n, VALUE,
125  sizeof(double)*szeA, A, INOUT,
126  sizeof(double)*szeA, NULL, SCRATCH,
127  sizeof(double)*szeF, fake, paramF,
128  0);
129 }
130 
131 /***************************************************************************/
134 #if defined(PLASMA_HAVE_WEAK)
135 #pragma weak CORE_dgetrip_f1_quark = PCORE_dgetrip_f1_quark
136 #define CORE_dgetrip_f1_quark PCORE_dgetrip_f1_quark
137 #endif
139 {
140  int m;
141  int n;
142  double *A;
143  double *W;
144  double *fake;
145 
146  quark_unpack_args_5(quark, m, n, A, W, fake);
147  CORE_dgetrip(m, n, A, W);
148 }
149 
150 /***************************************************************************/
154  int m, int n,
155  double *A, int szeA,
156  double *fake1, int szeF1, int paramF1,
157  double *fake2, int szeF2, int paramF2)
158 {
161  quark, CORE_dgetrip_f2_quark, task_flags,
162  sizeof(int), &m, VALUE,
163  sizeof(int), &n, VALUE,
164  sizeof(double)*szeA, A, INOUT,
165  sizeof(double)*szeA, NULL, SCRATCH,
166  sizeof(double)*szeF1, fake1, paramF1,
167  sizeof(double)*szeF2, fake2, paramF2,
168  0);
169 }
170 
171 /***************************************************************************/
174 #if defined(PLASMA_HAVE_WEAK)
175 #pragma weak CORE_dgetrip_f2_quark = PCORE_dgetrip_f2_quark
176 #define CORE_dgetrip_f2_quark PCORE_dgetrip_f2_quark
177 #endif
179 {
180  int m;
181  int n;
182  double *A;
183  double *W;
184  double *fake1;
185  double *fake2;
186 
187  quark_unpack_args_6(quark, m, n, A, W, fake1, fake2);
188  CORE_dgetrip(m, n, A, W);
189 }