Actual source code: blocktranspose.h
petsc-3.7.1 2016-05-15
Report Typos and Errors

      1: #if !defined(_BLOCKTRANSPOSE_H)
      2: #define _BLOCKTRANSPOSE_H

      4: #include <petscsys.h>
      5: #include <petscblaslapack.h>

      7: #define PetscKernel_A_gets_transpose_A_BODY(a,N)                      \
      8:   int i,j;                                                            \
      9:   for (i=0; i<N; i++) {                                               \
     10:     for (j=i+1; j<N; j++) {                                           \
     11:       MatScalar t = a[i*N+j];                                         \
     12:       a[i*N+j] = a[j*N+i];                                            \
     13:       a[j*N+i] = t;                                                   \
     14:     }                                                                 \
     15:   }                                                                   \
     16:   return 0

     18: PETSC_STATIC_INLINE PetscErrorCode PetscKernel_A_gets_transpose_A_N(MatScalar *a,PetscInt N)
     19: {
     20:   PetscKernel_A_gets_transpose_A_BODY(a,N);
     21: }
     22: #define PetscKernel_A_gets_transpose_A_DECLARE(N)                            \
     23:   PETSC_STATIC_INLINE PetscErrorCode PetscKernel_A_gets_transpose_A_ ## N (MatScalar *a) \
     24:   {                                                                          \
     25:     PetscKernel_A_gets_transpose_A_BODY(a,N);                                \
     26:   }

     28: PetscKernel_A_gets_transpose_A_DECLARE(2)
     29: PetscKernel_A_gets_transpose_A_DECLARE(3)
     30: PetscKernel_A_gets_transpose_A_DECLARE(4)
     31: PetscKernel_A_gets_transpose_A_DECLARE(5)
     32: PetscKernel_A_gets_transpose_A_DECLARE(6)
     33: PetscKernel_A_gets_transpose_A_DECLARE(7)
     34: PetscKernel_A_gets_transpose_A_DECLARE(8)
     35: PetscKernel_A_gets_transpose_A_DECLARE(9)

     37: #endif