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" 109 #endif // HAVE_TEUCHOS_COMPLEX 115 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__) 119 template <
typename slu_scalar_t,
typename slu_mag_t>
120 struct slu_mt_mult {};
124 template <
typename T>
125 struct slu_mt_mult<T,T> : std::multiplies<T> {};
129 struct slu_mt_mult<Z::doublecomplex,double>
130 : std::binary_function<Z::doublecomplex,double,Z::doublecomplex> {
131 Z::doublecomplex operator()(Z::doublecomplex amesos_z,
double amesos_d) {
132 Z::doublecomplex amesos_zr;
133 zd_mult(&amesos_zr, &amesos_z, amesos_d);
139 struct slu_mt_mult<Z::doublecomplex,Z::doublecomplex>
140 : std::binary_function<Z::doublecomplex,Z::doublecomplex,Z::doublecomplex> {
141 Z::doublecomplex operator()(Z::doublecomplex amesos_z1, Z::doublecomplex amesos_z2) {
142 Z::doublecomplex amesos_zr;
143 zz_mult(&amesos_zr, &amesos_z1, &amesos_z2);
147 #endif // HAVE_TEUCHOS_COMPLEX 149 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__) 165 template <
typename TypeFrom>
166 class ValueTypeConversionTraits<
SLUD::Z::doublecomplex, TypeFrom>
169 static SLUD::Z::doublecomplex convert(
const TypeFrom t )
171 SLUD::Z::doublecomplex ret;
172 ret.r = Teuchos::as<double>(t.real());
173 ret.i = Teuchos::as<double>(t.imag());
177 static SLUD::Z::doublecomplex safeConvert(
const TypeFrom t )
179 SLUD::Z::doublecomplex ret;
180 ret.r = Teuchos::as<double>(t.real());
181 ret.i = Teuchos::as<double>(t.imag());
188 template <
typename TypeTo>
189 class ValueTypeConversionTraits<TypeTo,
SLUD::Z::doublecomplex>
192 static TypeTo convert(
const SLUD::Z::doublecomplex t )
194 typedef typename TypeTo::value_type value_type;
195 value_type ret_r = Teuchos::as<value_type>( t.r );
196 value_type ret_i = Teuchos::as<value_type>( t.i );
197 return ( TypeTo( ret_r, ret_i ) );
201 static TypeTo safeConvert(
const SLUD::Z::doublecomplex t )
203 typedef typename TypeTo::value_type value_type;
204 value_type ret_r = Teuchos::as<value_type>( t.r );
205 value_type ret_i = Teuchos::as<value_type>( t.i );
206 return ( TypeTo( ret_r, ret_i ) );
210 template <
typename Ordinal>
211 class SerializationTraits<Ordinal,
SLUD::Z::doublecomplex>
212 :
public DirectSerializationTraits<Ordinal,SLUD::Z::doublecomplex>
228 ostream& operator<<(ostream& out,
const SLUD::Z::doublecomplex z);
232 #endif // HAVE_TEUCHOS_COMPLEX 238 template <
class,
class>
class Superludist;
245 struct TypeMap<Superludist,double>
247 static const SLUD::Dtype_t dtype = SLUD::SLU_D;
249 typedef double magnitude_type;
250 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2) 251 typedef SLUD::D::dLUstruct_t LUstruct_t;
252 typedef SLUD::D::dSOLVEstruct_t SOLVEstruct_t;
253 typedef SLUD::D::dScalePermstruct_t ScalePermstruct_t;
255 typedef SLUD::D::LUstruct_t LUstruct_t;
256 typedef SLUD::D::SOLVEstruct_t SOLVEstruct_t;
257 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
261 #if defined(HAVE_TEUCHOS_COMPLEX) && !defined(__clang__) 263 struct TypeMap<Superludist,
std::complex<double> >
265 static const SLUD::Dtype_t dtype = SLUD::SLU_Z;
266 typedef SLUD::Z::doublecomplex type;
267 typedef double magnitude_type;
268 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2) 269 typedef SLUD::Z::zLUstruct_t LUstruct_t;
270 typedef SLUD::Z::zSOLVEstruct_t SOLVEstruct_t;
271 typedef SLUD::Z::zScalePermstruct_t ScalePermstruct_t;
273 typedef SLUD::Z::LUstruct_t LUstruct_t;
274 typedef SLUD::Z::SOLVEstruct_t SOLVEstruct_t;
275 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
283 struct TypeMap<Superludist,
SLUD::Z::doublecomplex>
285 static const SLUD::Dtype_t dtype = SLUD::SLU_Z;
286 typedef SLUD::Z::doublecomplex type;
287 typedef double magnitude_type;
288 #if SUPERLU_DIST_MAJOR_VERSION > 6 || (SUPERLU_DIST_MAJOR_VERSION == 6 && SUPERLU_DIST_MINOR_VERSION > 2) 289 typedef SLUD::Z::zLUstruct_t LUstruct_t;
290 typedef SLUD::Z::zSOLVEstruct_t SOLVEstruct_t;
291 typedef SLUD::Z::zScalePermstruct_t ScalePermstruct_t;
293 typedef SLUD::Z::LUstruct_t LUstruct_t;
294 typedef SLUD::Z::SOLVEstruct_t SOLVEstruct_t;
295 typedef SLUD::ScalePermstruct_t ScalePermstruct_t;
299 #endif // HAVE_TEUCHOS_COMPLEX 306 #endif // AMESOS2_SUPERLUDIST_TYPEMAP_HPP
Definition: Amesos2_AbstractConcreteMatrixAdapter.hpp:48
Definition: Amesos2_Umfpack_TypeMap.hpp:60
Definition: Amesos2_Superludist_TypeMap.hpp:73