10 #ifndef SACADO_MP_SCALAR_TRAITS_IMP_HPP 
   11 #define SACADO_MP_SCALAR_TRAITS_IMP_HPP 
   18 #include "Sacado_mpl_apply.hpp" 
   23     template <
typename S, 
bool reduct_across_vector>
 
   40       typedef typename Sacado::mpl::apply<S,ordinal_type,value_mag_type>::type 
storage_mag_type;
 
   41       typedef typename Sacado::mpl::apply<S,ordinal_type,value_half_type>::type 
storage_half_type;
 
   49       static const bool isComplex = TVT::isComplex;
 
   50       static const bool isOrdinal = TVT::isOrdinal;
 
   51       static const bool isComparable = TVT::isComparable;
 
   52       static const bool hasMachineParameters = TVT::hasMachineParameters;
 
   92         for (
int i=0; i<sz; i++)
 
   93           y.fastAccessCoeff(i) = TVT::conjugate(x.fastAccessCoeff(i));
 
  122         for (
int i=0; i<x.size(); i++)
 
  123           if (TVT::isnaninf(x.fastAccessCoeff(i)))
 
  128       static void seedrandom(
unsigned int s) { TVT::seedrandom(s); }
 
  132       static const char * 
name() { 
return "Sacado::MP::Vector<>"; }
 
  149     template <
typename S>
 
  169       static const bool isComplex = TVT::isComplex;
 
  170       static const bool isOrdinal = TVT::isOrdinal;
 
  171       static const bool isComparable = TVT::isComparable;
 
  172       static const bool hasMachineParameters = TVT::hasMachineParameters;
 
  206         for (
int i=0; i<sz; i++)
 
  207           y.fastAccessCoeff(i) = TVT::conjugate(x.fastAccessCoeff(i));
 
  214         for (
int i=0; i<sz; i++)
 
  215           y.fastAccessCoeff(i) = TVT::real(x.fastAccessCoeff(i));
 
  222         for (
int i=0; i<sz; i++)
 
  223           y.fastAccessCoeff(i) = TVT::imag(x.fastAccessCoeff(i));
 
  230         for (
int i=0; i<x.size(); i++)
 
  231           if (TVT::isnaninf(x.fastAccessCoeff(i)))
 
  236       static void seedrandom(
unsigned int s) { TVT::seedrandom(s); }
 
  240       static const char * 
name() { 
return "Sacado::MP::Vector<>"; }
 
  255     template <
typename Ordinal, 
typename VecType, 
typename Serializer>
 
  261       typedef typename Sacado::ValueType<VecType>::type 
ValueT;
 
  280                                               const VecType buffer[],
 
  285         for (
Ordinal i=0; i<count; i++) {
 
  286           int my_sz = buffer[i].size();
 
  288           if (sz == 0) tot_sz = my_sz;
 
  290           if (tot_sz != my_sz) {
 
  299           Ordinal b2 = vs.fromCountToIndirectBytes(tot_sz, cx->coeff());
 
  311                              const VecType buffer[],
 
  317         for (
Ordinal i=0; i<count; i++) {
 
  319           int my_sz = buffer[i].size();
 
  321           if (sz == 0) tot_sz = my_sz;
 
  327           if (tot_sz != my_sz) {
 
  336           Ordinal b2 = vs.fromCountToIndirectBytes(tot_sz, cx->coeff());
 
  340           vs.serialize(tot_sz, cx->coeff(), b2, charBuffer);
 
  350                                               const char charBuffer[],
 
  354         while (bytes_used < bytes) {
 
  377                                const char charBuffer[],
 
  381         for (
Ordinal i=0; i<count; i++) {
 
  390           if (sz == 0) tot_sz = *my_sz;
 
  391           buffer[i] = VecType(tot_sz, 
ValueT(0.0));
 
  397           vs.deserialize(*b2, charBuffer, *my_sz, buffer[i].coeff());
 
  407     template <
typename Ordinal, 
typename VecType, 
bool is_static = false>
 
  413       typedef typename Sacado::ValueType<VecType>::type 
ValueT;
 
  435                                               const VecType buffer[]) {
 
  442                              const VecType buffer[],
 
  451                                               const char charBuffer[]) {
 
  458                                const char charBuffer[],
 
  470     template <
typename Ordinal, 
typename VecType>
 
  472       typedef typename Sacado::ValueType<VecType>::type 
ValueT;
 
  479         vSerT::supportsDirectSerialization;
 
  486         return DSerT::fromCountToDirectBytes(count);
 
  491         return DSerT::convertToCharPtr(ptr);
 
  496         return DSerT::convertToCharPtr(ptr);
 
  501         return DSerT::fromDirectBytesToCount(bytes);
 
  506         return DSerT::convertFromCharPtr(ptr);
 
  511         return DSerT::convertFromCharPtr(ptr);
 
  521                                               const VecType buffer[]) {
 
  523           return DSerT::fromCountToIndirectBytes(count, buffer);
 
  525           return STI::fromCountToIndirectBytes(count, buffer);
 
  530                              const VecType buffer[],
 
  534           return DSerT::serialize(count, buffer, bytes, charBuffer);
 
  536           return STI::serialize(count, buffer, bytes, charBuffer);
 
  541                                               const char charBuffer[]) {
 
  543           return DSerT::fromIndirectBytesToCount(bytes, charBuffer);
 
  545           return STI::fromIndirectBytesToCount(bytes, charBuffer);
 
  550                                const char charBuffer[],
 
  554           return DSerT::deserialize(bytes, charBuffer, count, buffer);
 
  556           return STI::deserialize(bytes, charBuffer, count, buffer);
 
  564     template <
typename Ordinal, 
typename VecType, 
typename ValueSerializer>
 
  604                                        const VecType buffer[])
 const {
 
  610                       const VecType buffer[],
 
  612                       char charBuffer[])
 const {
 
  618                                        const char charBuffer[])
 const {
 
  624                         const char charBuffer[],
 
  626                         VecType buffer[])
 const {
 
  638 #endif // SACADO_MP_SCALAR_TRAITS_IMP_HPP 
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
 
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
 
SerializationImp< Ordinal, VecType, ValueSerializer > Imp
Implementation. 
 
static magnitudeType imag(const ScalarType &x)
 
static Ordinal fromIndirectBytesToCount(const Serializer &vs, const Ordinal bytes, const char charBuffer[], const Ordinal sz=0)
Return the number of objects for bytes of storage. 
 
static void serialize(const Ordinal count, const intbuffer[], const Ordinal bytes, char charBuffer[])
 
static const VecType * convertFromCharPtr(const char *ptr)
Convert the pointer type from char*. 
 
static value_mag_type rmax()
 
TVT::magnitudeType value_mag_type
 
Teuchos::RCP< const ValueSerializer > vs
Serializer for value types. 
 
static char * convertToCharPtr(VecType *ptr)
Convert the pointer type to char*. 
 
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, VecType buffer[])
Deserialize from an indirect char[] buffer. 
 
static value_mag_type emax()
 
static const char * name()
 
static value_mag_type sfmin()
 
static Ordinal fromCountToIndirectBytes(const Ordinal count, const intbuffer[])
 
static Ordinal fromCountToDirectBytes(const Ordinal count)
 
static ScalarType log10(const ScalarType &x)
 
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, VecType buffer[])
Deserialize from an indirect char[] buffer. 
 
static value_mag_type rmin()
 
static void deserialize(const Serializer &vs, const Ordinal bytes, const char charBuffer[], const Ordinal count, VecType buffer[], const Ordinal sz=0)
Deserialize from an indirect char[] buffer. 
 
Teuchos::DirectSerializationTraits< Ordinal, VecType > DSerT
 
static ScalarType log10(const ScalarType &x)
 
TVT::doublePrecision value_double_type
 
static Ordinal fromCountToDirectBytes(const Ordinal count)
Return the number of bytes for count objects. 
 
static value_mag_type rmin()
 
static ScalarType log(const ScalarType &x)
 
Teuchos::ScalarTraits< value_type >::coordinateType coordinateType
 
static magnitudeType magnitude(const ScalarType &a)
 
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
 
static Ordinal fromCountToIndirectBytes(const Ordinal count, const T buffer[])
 
value_mag_type magnitudeType
 
SerializationImp< Ordinal, VecType, ValueSerializer > Imp
Implementation. 
 
static VecType * convertFromCharPtr(char *ptr)
Convert the pointer type from char*. 
 
static value_mag_type sfmin()
 
TVT::halfPrecision value_half_type
 
Sacado::ValueType< VecType >::type ValueT
Value type. 
 
static value_mag_type eps()
 
static bool isnaninf(const ScalarType &x)
 
static ScalarType squareroot(const ScalarType &x)
 
static value_mag_type emin()
 
static value_mag_type prec()
 
static value_mag_type rnd()
 
Teuchos::SerializationTraits< Ordinal, int > iSerT
How to serialize ints. 
 
static void seedrandom(unsigned int s)
 
Ordinal fromCountToIndirectBytes(const Ordinal count, const VecType buffer[]) const 
Return the number of bytes for count objects. 
 
static const char * name()
 
TVT::magnitudeType value_mag_type
 
Teuchos::SerializationTraits< Ordinal, ValueT > vSerT
 
static value_mag_type rnd()
 
DS::DefaultSerializerType ValueSerializer
Default serializer type for values. 
 
static value_mag_type base()
 
Sacado::mpl::apply< S, ordinal_type, value_mag_type >::type storage_mag_type
 
static ScalarType squareroot(const ScalarType &x)
 
static Ordinal fromCountToIndirectBytes(const Ordinal count, const VecType buffer[])
Return the number of bytes for count objects. 
 
static magnitudeType real(const ScalarType &x)
 
static void seedrandom(unsigned int s)
 
static DefaultSerializerType getDefaultSerializer()
 
static void serialize(const Serializer &vs, const Ordinal count, const VecType buffer[], const Ordinal bytes, char charBuffer[], const Ordinal sz=0)
Serialize to an indirect char[] buffer. 
 
static value_mag_type emin()
 
Sacado::MP::Vector< storage_double_type > doublePrecision
 
Ordinal sz
Specified number of derivative components;. 
 
SerializerImp(const Teuchos::RCP< const ValueSerializer > &vs_, Ordinal sz_=0)
Constructor. 
 
static int * convertFromCharPtr(char *ptr)
 
static ScalarType conjugate(const ScalarType &x)
 
static ScalarType random()
 
static value_mag_type base()
 
Sacado::MP::Vector< storage_double_type > doublePrecision
 
Serialization implementation for all Vector types. 
 
Ordinal getSerializerSize() const 
Return specified serializer size. 
 
Sacado::MP::Vector< S > ScalarType
 
static Ordinal fromDirectBytesToCount(const Ordinal bytes)
Return the number of objects for bytes of storage. 
 
static ScalarType pow(const ScalarType &x, const ScalarType &y)
 
static T * convertFromCharPtr(char *ptr)
 
Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[]) const 
Return the number of objects for bytes of storage. 
 
static Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[])
Return the number of objects for bytes of storage. 
 
TVT::doublePrecision value_double_type
 
Sacado::MP::Vector< storage_half_type > halfPrecision
 
static ScalarType random()
 
static Ordinal fromCountToIndirectBytes(const Ordinal count, const VecType buffer[])
Return the number of bytes for count objects. 
 
value_type doublePrecision
 
static ScalarType conjugate(const ScalarType &x)
 
static const bool supportsDirectSerialization
Whether the type T supports direct serialization. 
 
Teuchos::SerializationTraits< Ordinal, Ordinal > oSerT
How to serialize ordinals. 
 
static const bool supportsDirectSerialization
Whether the type T supports direct serialization. 
 
Sacado::MP::Vector< S > ScalarType
 
static ScalarType real(const ScalarType &x)
 
Sacado::Random< double > rnd
 
void serialize(const Ordinal count, const VecType buffer[], const Ordinal bytes, char charBuffer[]) const 
Serialize to an indirect char[] buffer. 
 
S::ordinal_type ordinal_type
 
Teuchos::ScalarTraits< value_type > TVT
 
static ScalarType pow(const ScalarType &x, const ScalarType &y)
 
Sacado::ValueType< VecType >::type ValueT
Value type of Vec type. 
 
Implementation of Teuchos::SerializationTraits for all Vector types. 
 
static magnitudeType magnitude(const ScalarType &a)
 
static const char * convertToCharPtr(const VecType *ptr)
Convert the pointer type to const char*. 
 
static Ordinal fromCountToIndirectBytes(const Serializer &vs, const Ordinal count, const VecType buffer[], const Ordinal sz=0)
Return the number of bytes for count objects. 
 
static Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[])
Return the number of objects for bytes of storage. 
 
Sacado::mpl::apply< S, ordinal_type, value_half_type >::type storage_half_type
 
static ScalarType log(const ScalarType &x)
 
Sacado::mpl::apply< S, ordinal_type, value_half_type >::type storage_half_type
 
TVT::halfPrecision value_half_type
 
Sacado::mpl::apply< S, ordinal_type, value_double_type >::type storage_double_type
 
static value_mag_type rmax()
 
static ScalarType imag(const ScalarType &x)
 
Teuchos::ScalarTraits< value_type >::coordinateType coordinateType
 
Sacado::ValueType< VecType >::type ValueT
 
void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, VecType buffer[]) const 
Deserialize from an indirect char[] buffer. 
 
static value_mag_type t()
 
Teuchos::DefaultSerializer< Ordinal, ValueT > DS
Default serializer for values. 
 
An indirect serialization object for all Vector types. 
 
Sacado::MP::Vector< storage_half_type > halfPrecision
 
Sacado::MP::Vector< storage_mag_type > magnitudeType
 
ValueSerializer value_serializer_type
Typename of value serializer. 
 
Teuchos::RCP< const value_serializer_type > getValueSerializer() const 
Get nested value serializer. 
 
KOKKOS_INLINE_FUNCTION PCE< Storage > log(const PCE< Storage > &a)
 
static value_mag_type eps()
 
static value_mag_type t()
 
static const bool supportsDirectSerialization
Whether we support direct serialization. 
 
KOKKOS_INLINE_FUNCTION PCE< Storage > log10(const PCE< Storage > &a)
 
Teuchos::ScalarTraits< value_type > TVT
 
static void serialize(const Ordinal count, const VecType buffer[], const Ordinal bytes, char charBuffer[])
Serialize to an indirect char[] buffer. 
 
Sacado::mpl::apply< S, ordinal_type, value_double_type >::type storage_double_type
 
static void serialize(const Ordinal count, const T buffer[], const Ordinal bytes, char charBuffer[])
 
Sacado::MP::SerializationTraitsImp< Ordinal, VecType > STI
 
static Ordinal fromCountToDirectBytes(const Ordinal count)
 
static value_mag_type emax()
 
static bool isnaninf(const ScalarType &x)
 
static value_mag_type prec()
 
S::ordinal_type ordinal_type
 
Sacado::mpl::apply< S, ordinal_type, value_mag_type >::type storage_mag_type
 
static void serialize(const Ordinal count, const VecType buffer[], const Ordinal bytes, char charBuffer[])
Serialize to an indirect char[] buffer.