1 #include <clover_field_order.h>
5 using namespace clover;
14 template<typename real, int Nc, QudaCloverFieldOrder order>
15 double norm(const CloverField &u, bool inverse, norm_type_ type) {
17 typedef typename mapper<real>::type reg_type;
20 case NORM1: norm_ = FieldOrder<reg_type,Nc,Ns,order>(const_cast<CloverField &>(u), inverse).norm1(); break;
21 case NORM2: norm_ = FieldOrder<reg_type,Nc,Ns,order>(const_cast<CloverField &>(u), inverse).norm2(); break;
22 case ABS_MAX: norm_ = FieldOrder<reg_type,Nc,Ns,order>(const_cast<CloverField &>(u), inverse).abs_max(); break;
23 case ABS_MIN: norm_ = FieldOrder<reg_type,Nc,Ns,order>(const_cast<CloverField &>(u), inverse).abs_min(); break;
28 template<typename real, int Nc>
29 double norm(const CloverField &u, bool inverse, norm_type_ type) {
32 case QUDA_FLOAT2_CLOVER_ORDER: norm_ = norm<real,Nc,QUDA_FLOAT2_CLOVER_ORDER>(u, inverse, type); break;
33 case QUDA_FLOAT4_CLOVER_ORDER: norm_ = norm<real,Nc,QUDA_FLOAT4_CLOVER_ORDER>(u, inverse, type); break;
34 default: errorQuda("Clover field %d order not supported", u.Order());
39 template<typename real>
40 double _norm(const CloverField &u, bool inverse, norm_type_ type) {
43 case 3: norm_ = norm<real, 3>(u, inverse, type); break;
44 default: errorQuda("Unsupported color %d", u.Ncolor());
49 double _norm(const CloverField &u, bool inverse, norm_type_ type)
52 #ifdef GPU_CLOVER_DIRAC
53 switch(u.Precision()) {
54 case QUDA_DOUBLE_PRECISION: nrm = _norm<double>(u, inverse, type); break;
55 case QUDA_SINGLE_PRECISION: nrm = _norm< float>(u, inverse, type); break;
56 default: errorQuda("Unsupported precision %d", u.Precision());
59 errorQuda("Clover dslash has not been built");
64 double CloverField::norm1(bool inverse) const {
65 return _norm(*this, inverse, NORM1);
68 double CloverField::norm2(bool inverse) const {
69 return _norm(*this, inverse, NORM2);
72 double CloverField::abs_max(bool inverse) const {
73 return _norm(*this, inverse, ABS_MAX);
76 double CloverField::abs_min(bool inverse) const {
77 return _norm(*this, inverse, ABS_MIN);