Commit 6e14edb3 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cleanup

parent 78f1f7c6
......@@ -11,7 +11,6 @@ libmrutil_la_SOURCES = \
libsharp2/sharp_geomhelpers.cc \
libsharp2/sharp_ylmgen.cc \
libsharp2/sharp_internal.h \
libsharp2/sharp_vecsupport.h \
libsharp2/sharp_ylmgen.h \
mr_util/cmplx.h \
mr_util/error_handling.cc \
......
......@@ -37,14 +37,26 @@
#include <complex>
#include <math.h>
#include <string.h>
#include "libsharp2/sharp_vecsupport.h"
#include <experimental/simd>
#include "libsharp2/sharp.h"
#include "libsharp2/sharp_internal.h"
#include "libsharp2/sharp_utils.h"
#include "mr_util/error_handling.h"
#include "mr_util/useful_macros.h"
#pragma GCC visibility push(hidden)
using Tv=std::experimental::native_simd<double>;
static constexpr size_t VLEN=Tv::size();
static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
complex<double> * MRUTIL_RESTRICT cc)
{
using std::experimental::reduce;
cc[0] += complex<double>(reduce(a,std::plus<>()),reduce(b,std::plus<>()));
cc[1] += complex<double>(reduce(c,std::plus<>()),reduce(d,std::plus<>()));
}
// In the following, we explicitly allow the compiler to contract floating
// point operations, like multiply-and-add.
// Unfortunately, most compilers don't act on this pragma yet.
......
......@@ -53,13 +53,6 @@ void sharp_free_ (void *ptr);
\a RALLOC. */
#define DEALLOC(ptr) \
do { sharp_free_(ptr); (ptr)=NULL; } while(0)
/*! \def SET_ARRAY(ptr,i1,i2,val)
Set the entries \a ptr[i1] ... \a ptr[i2-1] to \a val. */
#define SET_ARRAY(ptr,i1,i2,val) \
do { \
ptrdiff_t cnt_; \
for (cnt_=(i1);cnt_<(i2);++cnt_) (ptr)[cnt_]=(val); \
} while(0)
#define ALLOC2D(ptr,type,num1,num2) \
do { \
......
/*
* This file is part of libsharp2.
*
* libsharp2 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* libsharp2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with libsharp2; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* libsharp2 is being developed at the Max-Planck-Institut fuer Astrophysik */
/* \file sharp_vecsupport.h
* Convenience functions for vector arithmetics
*
* Copyright (C) 2012-2019 Max-Planck-Society
* Author: Martin Reinecke
*/
#ifndef SHARP2_VECSUPPORT_H
#define SHARP2_VECSUPPORT_H
#include <cmath>
#include <complex>
using std::complex;
#include <experimental/simd>
using std::experimental::native_simd;
using std::experimental::reduce;
#include "mr_util/useful_macros.h"
using Tv=native_simd<double>;
using Tm=Tv::mask_type;
using Ts=Tv::value_type;
static constexpr size_t VLEN=Tv::size();
#define vload(a) (a)
static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
complex<double> * MRUTIL_RESTRICT cc)
{
cc[0] += complex<double>(reduce(a,std::plus<>()),reduce(b,std::plus<>()));
cc[1] += complex<double>(reduce(c,std::plus<>()),reduce(d,std::plus<>()));
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment