1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
#ifndef ULMBLAS_IMPL_LEVEL1EXTENSIONS_GECOTR_TCC
#define ULMBLAS_IMPL_LEVEL1EXTENSIONS_GECOTR_TCC 1

#include <ulmblas/impl/level1extensions/gecotr.h>
#include <ulmblas/impl/level1/swap.h>
#include <ulmblas/impl/auxiliary/conjugate.h>

namespace ulmBLAS {

template <typename IndexType, typename MX>
void
gecotr(IndexType      n,
       bool           transX,
       bool           conjX,
       MX             *X,
       IndexType      incRowX,
       IndexType      incColX)
{
    if (!transX && !conjX) {
        return;
    }

    if (transX) {
        if (!conjX) {
            for (IndexType i=0; i<n; ++i) {
                swap(n-1-i,
                     &X[(i+1)*incRowX+i*incColX], incRowX,
                     &X[i*incRowX+(i+1)*incColX], incColX);
            }
        } else {
            for (IndexType i=0; i<n; ++i) {
                swapc(n-1-i,
                      &X[(i+1)*incRowX+i*incColX], incRowX,
                      &X[i*incRowX+(i+1)*incColX], incColX);
                X[i*(incRowX+incColX)] = conjugate(X[i*(incRowX+incColX)]);
            }
        }
    } else {
        for (IndexType j=0; j<n; ++j) {
            for (IndexType i=0; i<n; ++i) {
                X[i*incRowX+j*incColX] = conjugate(X[i*incRowX+j*incColX]);
            }
        }
    }
}


// namespace ulmBLAS

#endif // ULMBLAS_IMPL_LEVEL1EXTENSIONS_GECOTR_TCC 1