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_cswpab.c
Go to the documentation of this file.
1 
21 #include <stdlib.h>
22 #include "common.h"
23 #include "quark.h"
24 
59 #if defined(PLASMA_HAVE_WEAK)
60 #pragma weak CORE_cswpab = PCORE_cswpab
61 #define CORE_cswpab PCORE_cswpab
62 #endif
63 void CORE_cswpab(int i, int n1, int n2, PLASMA_Complex32_t *A, PLASMA_Complex32_t *work) {
64  PLASMA_Complex32_t *A0 = &(A[i]);
65  PLASMA_Complex32_t *A1 = &(A[i+n1]);
66  PLASMA_Complex32_t *A2 = &(A[i+n2]);
67  int j;
68 
69  if( n1 < n2 ) {
70  memcpy(work, A0, n1*sizeof(PLASMA_Complex32_t));
71  for (j=0; j<n2; j++)
72  A0[j] = A1[j];
73  memcpy(A2, work, n1*sizeof(PLASMA_Complex32_t));
74  } else {
75  memcpy(work, A1, n2*sizeof(PLASMA_Complex32_t));
76  for (j=n1-1; j>-1; j--)
77  A2[j] = A0[j];
78  memcpy(A0, work, n2*sizeof(PLASMA_Complex32_t));
79  }
80 }
81 
82 /***************************************************************************/
85 void QUARK_CORE_cswpab(Quark *quark, Quark_Task_Flags *task_flags,
86  int i, int n1, int n2,
87  PLASMA_Complex32_t *A, int szeA)
88 {
91  quark, CORE_cswpab_quark, task_flags,
92  sizeof(int), &i, VALUE,
93  sizeof(int), &n1, VALUE,
94  sizeof(int), &n2, VALUE,
95  sizeof(PLASMA_Complex32_t)*szeA, A, INOUT,
96  sizeof(PLASMA_Complex32_t)*min(n1,n2), NULL, SCRATCH,
97  0);
98 }
99 
100 /***************************************************************************/
103 #if defined(PLASMA_HAVE_WEAK)
104 #pragma weak CORE_cswpab_quark = PCORE_cswpab_quark
105 #define CORE_cswpab_quark PCORE_cswpab_quark
106 #endif
108 {
109  int i;
110  int n1;
111  int n2;
113  PLASMA_Complex32_t *work;
114 
115  quark_unpack_args_5(quark, i, n1, n2, A, work);
116  CORE_cswpab( i, n1, n2, A, work);
117 }