57#ifndef AMESOS2_SUPERLUDIST_TYPEMAP_HPP
58#define AMESOS2_SUPERLUDIST_TYPEMAP_HPP
65#include <Teuchos_as.hpp>
66#ifdef HAVE_TEUCHOS_COMPLEX
67#include <Teuchos_SerializationTraits.hpp>
70#include "Amesos2_TypeMap.hpp"
77#if SUPERLU_DIST_MAJOR_VERSION > 4
79#include "superlu_dist_config.h"
83#define USER_FREE(addr) SLUD::superlu_free_dist(addr)
87#undef __SUPERLU_SUPERMATRIX
88#include "superlu_defs.h"
91#if SUPERLU_DIST_MAJOR_VERSION > 4
92 typedef superlu_dist_options_t amesos2_superlu_dist_options_t;
93 typedef superlu_dist_mem_usage_t amesos2_superlu_dist_mem_usage_t;
94#define AMESOS2_ENABLES_SUPERLUDIST_VERSION5_AND_HIGHER 1
96 typedef superlu_options_t amesos2_superlu_dist_options_t;
97 typedef mem_usage_t amesos2_superlu_dist_mem_usage_t;
102#include "superlu_ddefs.h"
105#if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
107#include "superlu_zdefs.h"
116template <
typename slu_scalar_t,
typename slu_mag_t>
117struct slu_dist_mult {};
122struct slu_dist_mult<T,T> : std::multiplies<T> {};
126struct slu_dist_mult<double,double>
127 : std::binary_function<double,double,double> {
128 double operator()(
double a,
double b) {
133#if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
136 struct slu_dist_mult<Z::doublecomplex,double>
137 : std::binary_function<Z::doublecomplex,double,Z::doublecomplex> {
138 Z::doublecomplex operator()(Z::doublecomplex amesos_z,
double amesos_d) {
139 Z::doublecomplex amesos_zr;
140 zd_mult(&amesos_zr, &amesos_z, amesos_d);
146 struct slu_dist_mult<Z::doublecomplex,Z::doublecomplex>
147 : std::binary_function<Z::doublecomplex,Z::doublecomplex,Z::doublecomplex> {
148 Z::doublecomplex operator()(Z::doublecomplex amesos_z1, Z::doublecomplex amesos_z2) {
149 Z::doublecomplex amesos_zr;
150 zz_mult(&amesos_zr, &amesos_z1, &amesos_z2);
156#if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
172template <
typename TypeFrom>
173class ValueTypeConversionTraits<SLUD::Z::doublecomplex, TypeFrom>
176 static SLUD::Z::doublecomplex convert(
const TypeFrom t )
178 SLUD::Z::doublecomplex ret;
179 ret.r = Teuchos::as<double>(t.real());
180 ret.i = Teuchos::as<double>(t.imag());
184 static SLUD::Z::doublecomplex safeConvert(
const TypeFrom t )
186 SLUD::Z::doublecomplex ret;
187 ret.r = Teuchos::as<double>(t.real());
188 ret.i = Teuchos::as<double>(t.imag());
195template <
typename TypeTo>
196class ValueTypeConversionTraits<TypeTo, SLUD::Z::doublecomplex>
199 static TypeTo convert(
const SLUD::Z::doublecomplex t )
201 typedef typename TypeTo::value_type value_type;
202 value_type ret_r = Teuchos::as<value_type>( t.r );
203 value_type ret_i = Teuchos::as<value_type>( t.i );
204 return ( TypeTo( ret_r, ret_i ) );
208 static TypeTo safeConvert(
const SLUD::Z::doublecomplex t )
210 typedef typename TypeTo::value_type value_type;
211 value_type ret_r = Teuchos::as<value_type>( t.r );
212 value_type ret_i = Teuchos::as<value_type>( t.i );
213 return ( TypeTo( ret_r, ret_i ) );
217template <
typename Ordinal>
218class SerializationTraits<Ordinal,SLUD::Z::doublecomplex>
219 :
public DirectSerializationTraits<Ordinal,SLUD::Z::doublecomplex>
235 ostream& operator<<(ostream& out,
const SLUD::Z::doublecomplex z);
254 static const SLUD::Dtype_t dtype = SLUD::SLU_D;
256 typedef double magnitude_type;
257#if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
258 typedef SLUD::D::dLUstruct_t LUstruct_t;
259 typedef SLUD::D::dSOLVEstruct_t SOLVEstruct_t;
260 typedef SLUD::D::dScalePermstruct_t ScalePermstruct_t;
262 typedef SLUD::D::LUstruct_t LUstruct_t;
263 typedef SLUD::D::SOLVEstruct_t SOLVEstruct_t;
264 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
268#if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__)
272 static const SLUD::Dtype_t dtype = SLUD::SLU_Z;
273 typedef SLUD::Z::doublecomplex type;
274 typedef double magnitude_type;
275#if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
276 typedef SLUD::Z::zLUstruct_t LUstruct_t;
277 typedef SLUD::Z::zSOLVEstruct_t SOLVEstruct_t;
278 typedef SLUD::Z::zScalePermstruct_t ScalePermstruct_t;
280 typedef SLUD::Z::LUstruct_t LUstruct_t;
281 typedef SLUD::Z::SOLVEstruct_t SOLVEstruct_t;
282 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
292 static const SLUD::Dtype_t dtype = SLUD::SLU_Z;
293 typedef SLUD::Z::doublecomplex type;
294 typedef double magnitude_type;
295#if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2)
296 typedef SLUD::Z::zLUstruct_t LUstruct_t;
297 typedef SLUD::Z::zSOLVEstruct_t SOLVEstruct_t;
298 typedef SLUD::Z::zScalePermstruct_t ScalePermstruct_t;
300 typedef SLUD::Z::LUstruct_t LUstruct_t;
301 typedef SLUD::Z::SOLVEstruct_t SOLVEstruct_t;
302 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
Amesos2 interface to the distributed memory version of SuperLU.
Definition Amesos2_Superludist_decl.hpp:91
Map types to solver-specific data-types and enums.
Definition Amesos2_TypeMap.hpp:82