text:
template<typename T1>
struct unwrap_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  unwrap_default(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT> M;
  };

template<typename T1>
struct unwrap_fixed
  {
  typedef T1 stored_type;

  inline explicit
  unwrap_fixed(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const T1& M;
  };

template<typename T1, bool condition>
struct unwrap_redirect {};

template<typename T1>
struct unwrap_redirect<T1, false> { typedef unwrap_default<T1> result; };

template<typename T1>
struct unwrap_redirect<T1, true>  { typedef unwrap_fixed<T1>   result; };

template<typename T1>
struct unwrap : public unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  inline
  unwrap(const T1& A)
    : unwrap_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct unwrap< Mat<eT> >
  {
  typedef Mat<eT> stored_type;

  inline
  unwrap(const Mat<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT>& M;
  };

template<typename eT>
struct unwrap< Row<eT> >
  {
  typedef Row<eT> stored_type;

  inline
  unwrap(const Row<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Row<eT>& M;
  };

template<typename eT>
struct unwrap< Col<eT> >
  {
  typedef Col<eT> stored_type;

  inline
  unwrap(const Col<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Col<eT>& M;
  };

template<typename out_eT, typename T1, typename T2, typename glue_type>
struct unwrap< mtGlue<out_eT, T1, T2, glue_type> >
  {
  typedef Mat<out_eT> stored_type;

  inline
  unwrap(const mtGlue<out_eT, T1, T2, glue_type>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<out_eT> M;
  };

template<typename out_eT, typename T1, typename op_type>
struct unwrap< mtOp<out_eT, T1, op_type> >
  {
  typedef Mat<out_eT> stored_type;

  inline
  unwrap(const mtOp<out_eT, T1, op_type>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<out_eT> M;
  };

//
//
//

template<typename T1>
struct quasi_unwrap_default
  {
  typedef typename T1::elem_type eT;

  static const bool has_subview = false;

  inline
  quasi_unwrap_default(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  // NOTE: DO NOT DIRECTLY CHECK FOR ALIASING BY TAKING THE ADDRESS OF THE "M" OBJECT IN ANY quasi_unwrap CLASS !!!
  const Mat<eT> M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
  };

template<typename T1>
struct quasi_unwrap_fixed
  {
  typedef typename T1::elem_type eT;

  static const bool has_subview = false;

  inline explicit
  quasi_unwrap_fixed(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT>& M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
  };

template<typename T1, bool condition>
struct quasi_unwrap_redirect {};

template<typename T1>
struct quasi_unwrap_redirect<T1, false> { typedef quasi_unwrap_default<T1> result; };

template<typename T1>
struct quasi_unwrap_redirect<T1, true>  { typedef quasi_unwrap_fixed<T1>   result; };

template<typename T1>
struct quasi_unwrap : public quasi_unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename quasi_unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result quasi_unwrap_extra;

  static const bool has_subview = quasi_unwrap_extra::has_subview;

  inline
  quasi_unwrap(const T1& A)
    : quasi_unwrap_extra(A)
    {
    }

  using quasi_unwrap_extra::M;
  using quasi_unwrap_extra::is_alias;
  };

template<typename eT>
struct quasi_unwrap< Mat<eT> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const Mat<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT>& M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
  };

template<typename eT>
struct quasi_unwrap< Row<eT> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const Row<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Row<eT>& M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
  };

template<typename eT>
struct quasi_unwrap< Col<eT> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const Col<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Col<eT>& M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
  };

template<typename eT>
struct quasi_unwrap< subview_row<eT> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const subview_row<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Row<eT> M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
  };

template<typename eT>
struct quasi_unwrap< subview_col<eT> >
  {
  static const bool has_subview = true;

  inline
  quasi_unwrap(const subview_col<eT>& A)
    : orig( A.m )
    , M  ( const_cast<eT*>( A.colptr(0) ), A.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT>& orig;
  const Col<eT>  M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
  };

template<typename out_eT, typename T1, typename T2, typename glue_type>
struct quasi_unwrap< mtGlue<out_eT, T1, T2, glue_type> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const mtGlue<out_eT, T1, T2, glue_type>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<out_eT> M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
  };

template<typename out_eT, typename T1, typename op_type>
struct quasi_unwrap< mtOp<out_eT, T1, op_type> >
  {
  static const bool has_subview = false;

  inline
  quasi_unwrap(const mtOp<out_eT, T1, op_type>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<out_eT> M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
  };

template<typename T1>
struct quasi_unwrap< Op<T1, op_vectorise_col> >
  {
  static const bool has_subview = true;

  typedef typename T1::elem_type eT;

  inline
  quasi_unwrap(const Op<T1, op_vectorise_col>& A)
    : U( A.m )
    , M( const_cast<eT*>(U.M.memptr()), U.M.n_elem, 1, false, false )
    {
    arma_extra_debug_sigprint();
    }

  const unwrap<T1> U;
  const Mat<eT>    M;

  template<typename eT2>
  arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(U.M)) == void_ptr(&X)); }
  };

//
//
//

template<typename T1>
struct unwrap_check_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  unwrap_check_default(const T1& A, const Mat<eT>&)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  inline
  unwrap_check_default(const T1& A, const bool)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT> M;
  };

template<typename T1>
struct unwrap_check_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline
  unwrap_check_fixed(const T1& A, const Mat<eT>& B)
    : M_local( (&A == &B) ? new T1(A) : 0 )
    , M      ( (&A == &B) ? *M_local  : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  unwrap_check_fixed(const T1& A, const bool is_alias)
    : M_local( is_alias ? new T1(A) : 0 )
    , M      ( is_alias ? *M_local  : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct unwrap_check_redirect {};

template<typename T1>
struct unwrap_check_redirect<T1, false> { typedef unwrap_check_default<T1> result; };

template<typename T1>
struct unwrap_check_redirect<T1, true>  { typedef unwrap_check_fixed<T1>   result; };

template<typename T1>
struct unwrap_check : public unwrap_check_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  inline unwrap_check(const T1& A, const Mat<typename T1::elem_type>& B)
    : unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }

  inline unwrap_check(const T1& A, const bool is_alias)
    : unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, is_alias)
    {
    }
  };

template<typename eT>
struct unwrap_check< Mat<eT> >
  {
  typedef Mat<eT> stored_type;

  inline
  unwrap_check(const Mat<eT>& A, const Mat<eT>& B)
    : M_local( (&A == &B) ? new Mat<eT>(A) : 0 )
    , M      ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  unwrap_check(const Mat<eT>& A, const bool is_alias)
    : M_local( is_alias ? new Mat<eT>(A) : 0 )
    , M      ( is_alias ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct unwrap_check< Row<eT> >
  {
  typedef Row<eT> stored_type;

  inline
  unwrap_check(const Row<eT>& A, const Mat<eT>& B)
    : M_local( (&A == &B) ? new Row<eT>(A) : 0 )
    , M      ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  unwrap_check(const Row<eT>& A, const bool is_alias)
    : M_local( is_alias ? new Row<eT>(A) : 0 )
    , M      ( is_alias ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct unwrap_check< Col<eT> >
  {
  typedef Col<eT> stored_type;

  inline
  unwrap_check(const Col<eT>& A, const Mat<eT>& B)
    : M_local( (&A == &B) ? new Col<eT>(A) : 0 )
    , M      ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  unwrap_check(const Col<eT>& A, const bool is_alias)
    : M_local( is_alias ? new Col<eT>(A) : 0 )
    , M      ( is_alias ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Col<eT>* M_local;
  const Col<eT>& M;
  };

//
//
//

template<typename T1>
struct unwrap_check_mixed
  {
  typedef typename T1::elem_type eT1;

  template<typename eT2>
  inline
  unwrap_check_mixed(const T1& A, const Mat<eT2>&)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  //template<typename eT2>
  inline
  unwrap_check_mixed(const T1& A, const bool)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  const Mat<eT1> M;
  };

template<typename eT1>
struct unwrap_check_mixed< Mat<eT1> >
  {
  template<typename eT2>
  inline
  unwrap_check_mixed(const Mat<eT1>& A, const Mat<eT2>& B)
    : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat<eT1>(A) : 0 )
    , M      ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  //template<typename eT2>
  inline
  unwrap_check_mixed(const Mat<eT1>& A, const bool is_alias)
    : M_local( is_alias ? new Mat<eT1>(A) : 0 )
    , M      ( is_alias ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check_mixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Mat<eT1>* M_local;
  const Mat<eT1>& M;
  };

template<typename eT1>
struct unwrap_check_mixed< Row<eT1> >
  {
  template<typename eT2>
  inline
  unwrap_check_mixed(const Row<eT1>& A, const Mat<eT2>& B)
    : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row<eT1>(A) : 0 )
    , M      ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  //template<typename eT2>
  inline
  unwrap_check_mixed(const Row<eT1>& A, const bool is_alias)
    : M_local( is_alias ? new Row<eT1>(A) : 0 )
    , M      ( is_alias ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check_mixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Row<eT1>* M_local;
  const Row<eT1>& M;
  };

template<typename eT1>
struct unwrap_check_mixed< Col<eT1> >
  {
  template<typename eT2>
  inline
  unwrap_check_mixed(const Col<eT1>& A, const Mat<eT2>& B)
    : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col<eT1>(A) : 0 )
    , M      ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  //template<typename eT2>
  inline
  unwrap_check_mixed(const Col<eT1>& A, const bool is_alias)
    : M_local( is_alias ? new Col<eT1>(A) : 0 )
    , M      ( is_alias ? (*M_local)      : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~unwrap_check_mixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  // the order below is important
  const Col<eT1>* M_local;
  const Col<eT1>& M;
  };

//
//
//

template<typename T1>
struct partial_unwrap_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_default(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_fixed(const T1& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_redirect {};

template<typename T1>
struct partial_unwrap_redirect<T1, false> { typedef partial_unwrap_default<T1> result; };

template<typename T1>
struct partial_unwrap_redirect<T1, true>  { typedef partial_unwrap_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap : public partial_unwrap_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  inline
  partial_unwrap(const T1& A)
    : partial_unwrap_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct partial_unwrap< Mat<eT> >
  {
  typedef Mat<eT> stored_type;

  inline
  partial_unwrap(const Mat<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return ((&X) == (&M)); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Row<eT> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const Row<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Col<eT> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const Col<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Col<eT>& M;
  };

template<typename eT>
struct partial_unwrap< subview_col<eT> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const subview_col<eT>& A)
    : orig( A.m )
    , M   ( const_cast<eT*>( A.colptr(0) ), A.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Mat<eT>& orig;
  const Col<eT>  M;
  };

template<typename eT>
struct partial_unwrap< subview_row<eT> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const subview_row<eT>& A)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Row<eT> M;
  };

template<typename T1>
struct partial_unwrap_htrans_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_htrans_default(const Op<T1, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_htrans_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_htrans_fixed(const Op<T1, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_htrans_redirect {};

template<typename T1>
struct partial_unwrap_htrans_redirect<T1, false> { typedef partial_unwrap_htrans_default<T1> result; };

template<typename T1>
struct partial_unwrap_htrans_redirect<T1, true>  { typedef partial_unwrap_htrans_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap< Op<T1, op_htrans> > : public partial_unwrap_htrans_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  inline partial_unwrap(const Op<T1, op_htrans>& A)
    : partial_unwrap_htrans_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct partial_unwrap< Op< Mat<eT>, op_htrans> >
  {
  typedef Mat<eT> stored_type;

  inline
  partial_unwrap(const Op< Mat<eT>, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< Row<eT>, op_htrans> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const Op< Row<eT>, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< Col<eT>, op_htrans> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const Op< Col<eT>, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Col<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< subview_col<eT>, op_htrans> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const Op< subview_col<eT>, op_htrans>& A)
    : orig( A.m.m )
    , M   ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Mat<eT>& orig;
  const Col<eT>  M;
  };

template<typename eT>
struct partial_unwrap< Op< subview_row<eT>, op_htrans> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const Op< subview_row<eT>, op_htrans>& A)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Row<eT> M;
  };

template<typename T1>
struct partial_unwrap_htrans2_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_htrans2_default(const Op<T1, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return val; }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT      val;
  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_htrans2_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_htrans2_fixed(const Op<T1, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT  val;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_htrans2_redirect {};

template<typename T1>
struct partial_unwrap_htrans2_redirect<T1, false> { typedef partial_unwrap_htrans2_default<T1> result; };

template<typename T1>
struct partial_unwrap_htrans2_redirect<T1, true>  { typedef partial_unwrap_htrans2_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap< Op<T1, op_htrans2> > : public partial_unwrap_htrans2_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  inline partial_unwrap(const Op<T1, op_htrans2>& A)
    : partial_unwrap_htrans2_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct partial_unwrap< Op< Mat<eT>, op_htrans2> >
  {
  typedef Mat<eT> stored_type;

  inline
  partial_unwrap(const Op< Mat<eT>, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT       val;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< Row<eT>, op_htrans2> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const Op< Row<eT>, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT       val;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< Col<eT>, op_htrans2> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const Op< Col<eT>, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT       val;
  const Col<eT>& M;
  };

template<typename eT>
struct partial_unwrap< Op< subview_col<eT>, op_htrans2> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const Op< subview_col<eT>, op_htrans2>& A)
    : orig( A.m.m )
    , val ( A.aux )
    , M   ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }

  static const bool do_trans = true;
  static const bool do_times = true;

  const Mat<eT>& orig;

  const eT      val;
  const Col<eT> M;
  };

template<typename eT>
struct partial_unwrap< Op< subview_row<eT>, op_htrans2> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const Op< subview_row<eT>, op_htrans2>& A)
    : val(A.aux)
    , M  (A.m  )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return val; }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT      val;
  const Row<eT> M;
  };

template<typename T1>
struct partial_unwrap_scalar_times_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_scalar_times_default(const eOp<T1, eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return val; }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT      val;
  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_scalar_times_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_scalar_times_fixed(const eOp<T1, eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT  val;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_scalar_times_redirect {};

template<typename T1>
struct partial_unwrap_scalar_times_redirect<T1, false> { typedef partial_unwrap_scalar_times_default<T1> result; };

template<typename T1>
struct partial_unwrap_scalar_times_redirect<T1, true>  { typedef partial_unwrap_scalar_times_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap< eOp<T1, eop_scalar_times> > : public partial_unwrap_scalar_times_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline
  partial_unwrap(const eOp<T1, eop_scalar_times>& A)
    : partial_unwrap_scalar_times_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct partial_unwrap< eOp<Mat<eT>, eop_scalar_times> >
  {
  typedef Mat<eT> stored_type;

  inline
  partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<Row<eT>, eop_scalar_times> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<Col<eT>, eop_scalar_times> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Col<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<subview_col<eT>, eop_scalar_times> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap(const eOp<subview_col<eT>,eop_scalar_times>& A)
    : orig( A.P.Q.m )
    , val ( A.aux   )
    , M   ( const_cast<eT*>( A.P.Q.colptr(0) ), A.P.Q.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  arma_hot arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT>& orig;

  const eT      val;
  const Col<eT> M;
  };

template<typename eT>
struct partial_unwrap< eOp<subview_row<eT>, eop_scalar_times> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap(const eOp<subview_row<eT>,eop_scalar_times>& A)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return val; }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT      val;
  const Row<eT> M;
  };

template<typename T1>
struct partial_unwrap_neg_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_neg_default(const eOp<T1, eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_neg_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_neg_fixed(const eOp<T1, eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_neg_redirect {};

template<typename T1>
struct partial_unwrap_neg_redirect<T1, false> { typedef partial_unwrap_neg_default<T1> result; };

template<typename T1>
struct partial_unwrap_neg_redirect<T1, true>  { typedef partial_unwrap_neg_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap< eOp<T1, eop_neg> > : public partial_unwrap_neg_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline
  partial_unwrap(const eOp<T1, eop_neg>& A)
    : partial_unwrap_neg_redirect< T1, is_Mat_fixed<T1>::value >::result(A)
    {
    }
  };

template<typename eT>
struct partial_unwrap< eOp<Mat<eT>, eop_neg> >
  {
  typedef Mat<eT> stored_type;

  inline
  partial_unwrap(const eOp<Mat<eT>,eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<Row<eT>, eop_neg> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const eOp<Row<eT>,eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<Col<eT>, eop_neg> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const eOp<Col<eT>,eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&M)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Col<eT>& M;
  };

template<typename eT>
struct partial_unwrap< eOp<subview_col<eT>, eop_neg> >
  {
  typedef Col<eT> stored_type;

  inline
  partial_unwrap(const eOp<subview_col<eT>,eop_neg>& A)
    : orig( A.P.Q.m )
    , M   ( const_cast<eT*>( A.P.Q.colptr(0) ), A.P.Q.n_rows, false, false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT>& orig;
  const Col<eT>  M;
  };

template<typename eT>
struct partial_unwrap< eOp<subview_row<eT>, eop_neg> >
  {
  typedef Row<eT> stored_type;

  inline
  partial_unwrap(const eOp<subview_row<eT>,eop_neg>& A)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  arma_inline bool is_alias(const Mat<eT>&) const { return false; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Row<eT> M;
  };

//

template<typename T1>
struct partial_unwrap_check_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_check_default(const T1& A, const Mat<eT>&)
    : M(A)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_check_fixed(const T1& A, const Mat<eT>& B)
    : M_local( (&A == &B) ? new T1(A)  : 0 )
    , M      ( (&A == &B) ? (*M_local) : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_check_redirect {};

template<typename T1>
struct partial_unwrap_check_redirect<T1, false> { typedef partial_unwrap_check_default<T1> result; };

template<typename T1>
struct partial_unwrap_check_redirect<T1, true>  { typedef partial_unwrap_check_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap_check : public partial_unwrap_check_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline partial_unwrap_check(const T1& A, const Mat<eT>& B)
    : partial_unwrap_check_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }
  };

template<typename eT>
struct partial_unwrap_check< Mat<eT> >
  {
  typedef Mat<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B)
    : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
    , M       ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  // the order below is important
  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Row<eT> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B)
    : M_local ( (&A == &B) ? new Row<eT>(A) : 0 )
    , M       ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  // the order below is important
  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Col<eT> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B)
    : M_local ( (&A == &B) ? new Col<eT>(A) : 0 )
    , M       ( (&A == &B) ? (*M_local)     : A )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  // the order below is important
  const Col<eT>* M_local;
  const Col<eT>& M;
  };

// NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class,
// NOTE: which relies on partial_unwrap_check to check for aliasing
template<typename eT>
struct partial_unwrap_check< subview_col<eT> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const subview_col<eT>& A, const Mat<eT>& B)
    : M  ( const_cast<eT*>( A.colptr(0) ), A.n_rows, (&(A.m) == &B), false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = false;
  static const bool do_times = false;

  const Col<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_htrans_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_check_htrans_default(const Op<T1, op_htrans>& A, const Mat<eT>&)
    : M(A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_htrans_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_check_htrans_fixed(const Op<T1, op_htrans>& A, const Mat<eT>& B)
    : M_local( (&(A.m) == &B) ? new T1(A.m) : 0   )
    , M      ( (&(A.m) == &B) ? (*M_local)  : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check_htrans_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_check_htrans_redirect {};

template<typename T1>
struct partial_unwrap_check_htrans_redirect<T1, false> { typedef partial_unwrap_check_htrans_default<T1> result; };

template<typename T1>
struct partial_unwrap_check_htrans_redirect<T1, true>  { typedef partial_unwrap_check_htrans_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap_check< Op<T1, op_htrans> > : public partial_unwrap_check_htrans_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline partial_unwrap_check(const Op<T1, op_htrans>& A, const Mat<eT>& B)
    : partial_unwrap_check_htrans_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }
  };

template<typename eT>
struct partial_unwrap_check< Op< Mat<eT>, op_htrans> >
  {
  typedef Mat<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B)
    : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  // the order below is important
  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Op< Row<eT>, op_htrans> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B)
    : M_local ( (&A.m == &B) ? new Row<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  // the order below is important
  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Op< Col<eT>, op_htrans> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B)
    : M_local ( (&A.m == &B) ? new Col<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  // the order below is important
  const Col<eT>* M_local;
  const Col<eT>& M;
  };

// NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class,
// NOTE: which relies on partial_unwrap_check to check for aliasing
template<typename eT>
struct partial_unwrap_check< Op< subview_col<eT>, op_htrans> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< subview_col<eT>, op_htrans>& A, const Mat<eT>& B)
    : M  ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, (&(A.m.m) == &B), false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(1); }

  static const bool do_trans = true;
  static const bool do_times = false;

  const Col<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_htrans2_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_check_htrans2_default(const Op<T1, op_htrans2>& A, const Mat<eT>&)
    : val(A.aux)
    , M  (A.m)
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT      val;
  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_htrans2_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_check_htrans2_fixed(const Op<T1, op_htrans2>& A, const Mat<eT>& B)
    : val    (A.aux)
    , M_local( (&(A.m) == &B) ? new T1(A.m) : 0   )
    , M      ( (&(A.m) == &B) ? (*M_local)  : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check_htrans2_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT  val;
  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_check_htrans2_redirect {};

template<typename T1>
struct partial_unwrap_check_htrans2_redirect<T1, false> { typedef partial_unwrap_check_htrans2_default<T1> result; };

template<typename T1>
struct partial_unwrap_check_htrans2_redirect<T1, true>  { typedef partial_unwrap_check_htrans2_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap_check< Op<T1, op_htrans2> > : public partial_unwrap_check_htrans2_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline partial_unwrap_check(const Op<T1, op_htrans2>& A, const Mat<eT>& B)
    : partial_unwrap_check_htrans2_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }
  };

template<typename eT>
struct partial_unwrap_check< Op< Mat<eT>, op_htrans2> >
  {
  typedef Mat<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B)
    : val     (A.aux)
    , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  // the order below is important
  const eT       val;
  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Op< Row<eT>, op_htrans2> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B)
    : val     (A.aux)
    , M_local ( (&A.m == &B) ? new Row<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  // the order below is important
  const eT       val;
  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< Op< Col<eT>, op_htrans2> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< Col<eT>, op_htrans2>& A, const Mat<eT>& B)
    : val     (A.aux)
    , M_local ( (&A.m == &B) ? new Col<eT>(A.m) : 0   )
    , M       ( (&A.m == &B) ? (*M_local)       : A.m )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  // the order below is important
  const eT       val;
  const Col<eT>* M_local;
  const Col<eT>& M;
  };

// NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class,
// NOTE: which relies on partial_unwrap_check to check for aliasing
template<typename eT>
struct partial_unwrap_check< Op< subview_col<eT>, op_htrans2> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const Op< subview_col<eT>, op_htrans2>& A, const Mat<eT>& B)
    : val( A.aux )
    , M  ( const_cast<eT*>( A.m.colptr(0) ), A.m.n_rows, (&(A.m.m) == &B), false )
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = true;
  static const bool do_times = true;

  const eT      val;
  const Col<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_scalar_times_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_check_scalar_times_default(const eOp<T1, eop_scalar_times>& A, const Mat<eT>&)
    : val(A.aux)
    , M  (A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT      val;
  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_scalar_times_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_check_scalar_times_fixed(const eOp<T1, eop_scalar_times>& A, const Mat<eT>& B)
    : val    ( A.aux )
    , M_local( (&(A.P.Q) == &B) ? new T1(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? (*M_local)    : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check_scalar_times_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT  val;
  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_check_scalar_times_redirect {};

template<typename T1>
struct partial_unwrap_check_scalar_times_redirect<T1, false> { typedef partial_unwrap_check_scalar_times_default<T1> result; };

template<typename T1>
struct partial_unwrap_check_scalar_times_redirect<T1, true>  { typedef partial_unwrap_check_scalar_times_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap_check< eOp<T1, eop_scalar_times> > : public partial_unwrap_check_scalar_times_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline partial_unwrap_check(const eOp<T1, eop_scalar_times>& A, const Mat<eT>& B)
    : partial_unwrap_check_scalar_times_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }
  };

template<typename eT>
struct partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> >
  {
  typedef Mat<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>& B)
    : val    (A.aux)
    , M_local( (&(A.P.Q) == &B) ? new Mat<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT>& B)
    : val(A.aux)
    , M_local( (&(A.P.Q) == &B) ? new Row<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT>& B)
    : val    ( A.aux )
    , M_local( (&(A.P.Q) == &B) ? new Col<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT       val;
  const Col<eT>* M_local;
  const Col<eT>& M;
  };

// NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class,
// NOTE: which relies on partial_unwrap_check to check for aliasing
template<typename eT>
struct partial_unwrap_check< eOp<subview_col<eT>, eop_scalar_times> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<subview_col<eT>,eop_scalar_times>& A, const Mat<eT>& B)
    : val( A.aux )
    , M  ( const_cast<eT*>( A.P.Q.colptr(0) ), A.P.Q.n_rows, (&(A.P.Q.m) == &B), false )
    {
    arma_extra_debug_sigprint();
    }

  arma_hot arma_inline eT get_val() const { return val; }

  static const bool do_trans = false;
  static const bool do_times = true;

  const eT      val;
  const Col<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_neg_default
  {
  typedef typename T1::elem_type eT;
  typedef Mat<eT>                stored_type;

  inline
  partial_unwrap_check_neg_default(const eOp<T1, eop_neg>& A, const Mat<eT>&)
    : M(A.P.Q)
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT> M;
  };

template<typename T1>
struct partial_unwrap_check_neg_fixed
  {
  typedef typename T1::elem_type eT;
  typedef T1                     stored_type;

  inline explicit
  partial_unwrap_check_neg_fixed(const eOp<T1, eop_neg>& A, const Mat<eT>& B)
    : M_local( (&(A.P.Q) == &B) ? new T1(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? (*M_local)    : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check_neg_fixed()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const T1* M_local;
  const T1& M;
  };

template<typename T1, bool condition>
struct partial_unwrap_check_neg_redirect {};

template<typename T1>
struct partial_unwrap_check_neg_redirect<T1, false> { typedef partial_unwrap_check_neg_default<T1> result; };

template<typename T1>
struct partial_unwrap_check_neg_redirect<T1, true>  { typedef partial_unwrap_check_neg_fixed<T1>   result; };

template<typename T1>
struct partial_unwrap_check< eOp<T1, eop_neg> > : public partial_unwrap_check_neg_redirect<T1, is_Mat_fixed<T1>::value >::result
  {
  typedef typename T1::elem_type eT;

  inline partial_unwrap_check(const eOp<T1, eop_neg>& A, const Mat<eT>& B)
    : partial_unwrap_check_neg_redirect< T1, is_Mat_fixed<T1>::value >::result(A, B)
    {
    }
  };

template<typename eT>
struct partial_unwrap_check< eOp<Mat<eT>, eop_neg> >
  {
  typedef Mat<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Mat<eT>,eop_neg>& A, const Mat<eT>& B)
    : M_local( (&(A.P.Q) == &B) ? new Mat<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Mat<eT>* M_local;
  const Mat<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< eOp<Row<eT>, eop_neg> >
  {
  typedef Row<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Row<eT>,eop_neg>& A, const Mat<eT>& B)
    : M_local( (&(A.P.Q) == &B) ? new Row<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Row<eT>* M_local;
  const Row<eT>& M;
  };

template<typename eT>
struct partial_unwrap_check< eOp<Col<eT>, eop_neg> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<Col<eT>,eop_neg>& A, const Mat<eT>& B)
    : M_local( (&(A.P.Q) == &B) ? new Col<eT>(A.P.Q) : 0     )
    , M      ( (&(A.P.Q) == &B) ? *M_local           : A.P.Q )
    {
    arma_extra_debug_sigprint();
    }

  inline
  ~partial_unwrap_check()
    {
    arma_extra_debug_sigprint();

    if(M_local) { delete M_local; }
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Col<eT>* M_local;
  const Col<eT>& M;
  };

// NOTE: we can get away with this shortcut as the partial_unwrap_check class is only used by the glue_times class,
// NOTE: which relies on partial_unwrap_check to check for aliasing
template<typename eT>
struct partial_unwrap_check< eOp<subview_col<eT>, eop_neg> >
  {
  typedef Col<eT> stored_type;

  arma_hot inline
  partial_unwrap_check(const eOp<subview_col<eT>,eop_neg>& A, const Mat<eT>& B)
    : M  ( const_cast<eT*>( A.P.Q.colptr(0) ), A.P.Q.n_rows, (&(A.P.Q.m) == &B), false )
    {
    arma_extra_debug_sigprint();
    }

  arma_inline eT get_val() const { return eT(-1); }

  static const bool do_trans = false;
  static const bool do_times = true;

  const Col<eT> M;
  };

//! @}


text:
/*@import "bootswatch/bootstrap.min.css";*/
@import "bootstrap";
@import "metismenu/src/metisMenu.css";
@import "font-awesome/css/font-awesome.css";
@import "../static/sb-admin-2.css";
@import "./grid-oil.css";
@import "./spinner.css"
/*@import "react-datepicker/dist/react-datepicker.css";
@import "react-bootstrap-datetimepicker/css/bootstrap-datetimepicker.css";*/
/*@import 'react-datagrid/index.css';*/

redpajama_set_name: RedPajamaGithub


text:
#include "animaShrinkageNode.h"

MTypeId     animaShrinkage::id(0x00114972);

// attributes
MObject     animaShrinkage::aOrigMesh;
MObject     animaShrinkage::aInMesh;
MObject     animaShrinkage::aOutMesh;
MObject     animaShrinkage::aShrinkMin;
MObject     animaShrinkage::aShrinkMax;
MObject     animaShrinkage::aStretchMin;
MObject     animaShrinkage::aStretchMax;

animaShrinkage::animaShrinkage() {}

animaShrinkage::~animaShrinkage() {}

MStatus animaShrinkage::compute(const MPlug& plug, MDataBlock& block)
{
    MStatus returnStatus;

    // get attributes
    // origMesh (non-deformed mesh)
    MPlug origMeshPlug(thisMObject(),aOrigMesh);
    bool origMeshOn = origMeshPlug.isConnected();
    bool origDirty = !block.isClean(aOrigMesh);

    MDataHandle origMeshData = block.inputValue(aOrigMesh, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    MObject OrigMeshObj = origMeshData.asMesh();
    MFnMesh origMesh(OrigMeshObj);

    // inMesh (deformed mesh)
    MPlug inMeshPlug(thisMObject(),aInMesh);
    bool inMeshOn = inMeshPlug.isConnected();

    MDataHandle inMeshData = block.inputValue(aInMesh, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    MObject inMeshObj = inMeshData.asMesh();
    MFnMesh inMesh(inMeshObj);

    MDataHandle shrinkMinData = block.inputValue(aShrinkMin, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    float shMin = shrinkMinData.asFloat();

    MDataHandle shrinkMaxData = block.inputValue(aShrinkMax, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    float shMax = shrinkMaxData.asFloat();

    MDataHandle stretchMinData = block.inputValue(aStretchMin, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    float stMin = stretchMinData.asFloat();

    MDataHandle stretchMaxData = block.inputValue(aStretchMax, &returnStatus);
    if (MS::kSuccess != returnStatus) return returnStatus;
    float stMax = stretchMaxData.asFloat();

    if (origMeshOn && (origEdgeLengths.length() == 0 || origDirty))
    {
        origEdgeLengths.clear();
        for (int i=0; i<origMesh.numEdges(); i++)
        {
            int2 edgeVtxIndices;
            origMesh.getEdgeVertices(i,edgeVtxIndices);
            MPoint vtx1, vtx2;
            origMesh.getPoint(edgeVtxIndices[0],vtx1);
            origMesh.getPoint(edgeVtxIndices[1],vtx2);
            MVector edgeVec = vtx1-vtx2;
            origEdgeLengths.append((float)edgeVec.length());
        }
    }

    if (inMeshOn)
    {
        int i;
        vtxShrinkage = new float[inMesh.numVertices()];
        vtxShrinkCount = new int[inMesh.numVertices()];

        for (i=0; i<inMesh.numVertices(); i++)
        {
            vtxShrinkage[i] = 0.0f;
            vtxShrinkCount[i] = 0;
        }

        edgeShrinkage.clear();
        for (i=0; i<inMesh.numEdges(); i++)
        {
            int2 edgeVtxIndices;
            inMesh.getEdgeVertices(i,edgeVtxIndices);
            MPoint vtx1, vtx2;
            inMesh.getPoint(edgeVtxIndices[0],vtx1);
            inMesh.getPoint(edgeVtxIndices[1],vtx2);
            MVector edgeVec = vtx1-vtx2;
            float shrinkage = (float)(edgeVec.length()-origEdgeLengths[i]);

            vtxShrinkage[edgeVtxIndices[0]] += shrinkage;
            vtxShrinkCount[edgeVtxIndices[0]] += 1;
            vtxShrinkage[edgeVtxIndices[1]] += shrinkage;
            vtxShrinkCount[edgeVtxIndices[1]] += 1;
        }

        for (i=0; i<inMesh.numVertices(); i++)
        {
            MColor shrinkCol;
            float vtxShrink = vtxShrinkage[i] / (float)vtxShrinkCount[i];
            if (vtxShrink<0.0f)
                shrinkCol = MColor((-1.0f*vtxShrink-shMin)/(shMax-shMin), 0, 0);
            else if (vtxShrink>0.0f)
                shrinkCol = MColor(0,((vtxShrink)-stMin)/(stMax-stMin), 0);
            else
                shrinkCol = MColor(0, 0, 0);

            inMesh.setVertexColor(shrinkCol,i);
        }
    }

    MDataHandle outMeshDataHandle = block.outputValue(aOutMesh);

    outMeshDataHandle.set(inMeshObj);
    outMeshDataHandle.setClean();

    return returnStatus;
}

void* animaShrinkage::creator()
{
    return new animaShrinkage();
}

MStatus animaShrinkage::initialize()
{
    MFnNumericAttribute nAttr;
    MFnTypedAttribute tAttr;
    MFnMatrixAttribute mAttr;
    MStatus stat;

    aOrigMesh = tAttr.create("origMesh", "orm", MFnData::kMesh);
    tAttr.setStorable(true);

    aInMesh = tAttr.create("inMesh", "im", MFnData::kMesh);
    tAttr.setStorable(true);
    aOutMesh = tAttr.create("outMesh", "om", MFnData::kMesh);
    tAttr.setStorable(true);
    tAttr.setReadable(true);
    tAttr.setWritable(false);

    aShrinkMin = nAttr.create("shrinkMin", "smi", MFnNumericData::kFloat, 0.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);

    aShrinkMax = nAttr.create("shrinkMax", "sma", MFnNumericData::kFloat, 1.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);

    aStretchMin = nAttr.create("stretchMin", "stm", MFnNumericData::kFloat, 0.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);

    aStretchMax = nAttr.create("stretchMax", "stx", MFnNumericData::kFloat, 1.0);
    nAttr.setStorable(true);
    nAttr.setKeyable(true);

    // Add the attributes we have created to the node
    addAttribute(aOrigMesh);
    addAttribute(aInMesh);
    addAttribute(aOutMesh);

    addAttribute(aShrinkMin);
    addAttribute(aShrinkMax);
    addAttribute(aStretchMin);
    addAttribute(aStretchMax);

    attributeAffects(aOrigMesh, aOutMesh);
    attributeAffects(aInMesh, aOutMesh);
    attributeAffects(aShrinkMin, aOutMesh);
    attributeAffects(aShrinkMax, aOutMesh);
    attributeAffects(aStretchMin, aOutMesh);
    attributeAffects(aStretchMax, aOutMesh);

    return MS::kSuccess;

}


text:
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public final class QueenAttackCalculatorTest {

    /*
     * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
     * ExpectedExceptions in particular.
     */
    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Test
    public void testQueensThatDoNotShareRankFileOrDiagonalCannotAttack() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(6, 6));

        assertFalse(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnTheSameRank() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(2, 6));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnTheSameFile() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(4, 5), new BoardCoordinate(2, 5));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnFirstDiagonal() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(0, 4));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnSecondDiagonal() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(3, 1));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnThirdDiagonal() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(1, 1));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testQueensCanAttackOnFourthDiagonal() {
        final QueenAttackCalculator calculator
                = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(5, 5));

        assertTrue(calculator.canQueensAttackOneAnother());
    }

    @Ignore
    @Test
    public void testCoordinateWithNegativeRankNotAllowed() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Coordinate must have positive rank.");

        new BoardCoordinate(-2, 2);
    }

    @Ignore
    @Test
    public void testCoordinateWithRankGreaterThan7NotAllowed() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Coordinate must have rank <= 7.");

        new BoardCoordinate(8, 4);
    }

    @Ignore
    @Test
    public void testCoordinateWithNegativeFileNotAllowed() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Coordinate must have positive file.");

        new BoardCoordinate(2, -2);
    }

    @Ignore
    @Test
    public void testCoordinateWithFileGreaterThan7NotAllowed() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Coordinate must have file <= 7.");

        new BoardCoordinate(4, 8);
    }

    @Ignore
    @Test
    public void testNullCoordinateNotAllowed() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("You must supply valid board coordinates for both Queens.");

        new QueenAttackCalculator(null, new BoardCoordinate(0, 7));
    }

    @Ignore
    @Test
    public void testQueensMustNotOccupyTheSameSquare() {
        expectedException.expect(IllegalArgumentException.class);
        expectedException.expectMessage("Queens may not occupy the same board coordinate.");

        new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(2, 2));
    }

}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Service */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'type')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'service')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'cost')->textInput() ?>

    <?= $form->field($model, 'created_at')->textInput() ?>

    <?= $form->field($model, 'updated_at')->textInput() ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
require 'rails_helper'

RSpec.describe 'v1/role_types', type: :request do
  let(:role_type1) { create(:role_type) }
  let(:role_type2) { create(:role_type) }

  before do
    role_type1
    role_type2
  end

  describe '#index' do
    it 'lists role_types' do
      get '/api/v1/role_types'
      expect(json_ids(true)).to eq([role_type1.id, role_type2.id])
      assert_payload(:role_type, role_type1, json_items[0])
    end

    context 'when sideloading roles' do
      let!(:role1)  { create(:role, role_type: role_type1) }
      let!(:role2)  { create(:role, role_type: role_type1) }
      let!(:role3)  { create(:role, role_type: role_type2) }

      it 'returns relevant roles in response' do
        get '/api/v1/role_types', params: {
          include: 'roles'
        }
        json_roles = json_includes('roles')
        expect(json_roles.length).to eq(3)
        assert_payload(:role, role1, json_roles[0])
        assert_payload(:role, role2, json_roles[1])
        assert_payload(:role, role3, json_roles[2])
      end
    end
  end

  describe '#show' do
    it 'returns relevant role_type' do
      get "/api/v1/role_types/#{role_type1.id}"
      assert_payload(:role_type, role_type1, json_item)
    end

    context 'when sideloading roles' do
      let!(:role1)  { create(:role, role_type: role_type1) }
      let!(:role2)  { create(:role, role_type: role_type1) }
      let!(:role3)  { create(:role, role_type: role_type2) }

      it 'returns relevant roles in response' do
        get "/api/v1/role_types/#{role_type1.id}", params: {
          include: 'roles'
        }
        json_roles = json_includes('roles')
        expect(json_roles.length).to eq(2)
        assert_payload(:role, role1, json_roles[0])
        assert_payload(:role, role2, json_roles[1])
      end
    end
  end
end


text:
require 'spec_helper'

describe "the member function" do
  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  it "should exist" do
    Puppet::Parser::Functions.function("member").should == "function_member"
  end

  it "should raise a ParseError if there is less than 1 arguments" do
    lambda { scope.function_member([]) }.should( raise_error(Puppet::ParseError))
  end

  it "should return true if a member is in an array" do
    result = scope.function_member([["a","b","c"], "a"])
    result.should(eq(true))
  end

  it "should return false if a member is not in an array" do
    result = scope.function_member([["a","b","c"], "d"])
    result.should(eq(false))
  end
end


text:
package main.java.CucumberTableExpander;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;

public class CucumberTableExpanderUseSample {

	public static void main(String[] args) throws IOException {
		// Class for testing Cucumber Table Expander

		//Read the feature data from a file
		String file = readFile("src/main/resources/test.feature");
	    //Call the cucumber table expander passing the file readed as string and return the
		//	cucumber feature expanded
		String cucumberTableExpanded = new CucumberTableExpander(file).getFeatureExpanded();
		ArrayList<String> cucumberTableExpandedAsList = new CucumberTableExpander(file).getFeatureExpandedAsList();

		//Display the original file and the processed one.
	    System.out.println("original:------------------------>  \n"+ file);
	    System.out.println("expanded:------------------------>  \n"+ cucumberTableExpanded);

	    System.out.println("expanded-as-list-----------------> : \n");
	    for (int j = 0; j < cucumberTableExpandedAsList.size(); j++) {
			String outlineLineValue = cucumberTableExpandedAsList.get(j).toString();
			System.out.println("Scenario List element("+j+")"+outlineLineValue);
		}
	}

	static String readFile(String path)
			  throws IOException
			{
			  byte[] encoded = Files.readAllBytes(Paths.get(path));
			  return new String(encoded, "UTF-8");
			}

}


text:
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts, OverlappingInstances, TypeFamilies, RecordWildCards #-}

module YaLedger.Reports.Stats
  (Stats (..),
   StatRecord (..),
   calculate, toDouble, toList) where

import Text.Printf
import qualified Data.Vector as V
import Statistics.Sample
import Statistics.Quantile
import Data.Dates

import YaLedger.Reports.API

data Stats = Stats

data SOptions =
         Amounts
       | SInternal (Maybe String)
       | Common CommonFlags
  deriving (Eq, Show)

instance ReportClass Stats where
  type Options Stats = SOptions
  type Parameters Stats = Maybe Path
  reportOptions _ =
    [Option "z" ["no-zeros"] (NoArg $ Common CNoZeros) "Do not show records for accounts/periods with no postings",
     Option "g" ["hide-groups"] (NoArg $ Common CHideGroups) "Hide accounts groups in CSV output",
     Option ""  ["no-currencies"] (NoArg $ Common CNoCurrencies) "Do not show currencies in amounts",
     Option "A" ["amounts"] (NoArg Amounts) "Show amounts statistics instead of balances statistics",
     Option "l" ["ledger"] (NoArg $ Common CLedgerBalances) "Show ledger balances instead of available balances",
     Option "i" ["internal"] (OptArg SInternal "GROUP") "Show only entries where all accounts belong to GROUP",
     Option "C" ["csv"] (OptArg (Common . CCSV) "SEPARATOR") "Output data in CSV format using given fields delimiter (semicolon by default)",
     Option "H" ["html"] (NoArg (Common CHTML)) "Output data in HTML format"]
  defaultOptions _ = []
  reportHelp _ = "Show accounts statistics: min, max, avg, quantilies. One optional parameter: account or accounts group."

  initReport _ options _ = setOutputFormat (commonFlags options)

  runReport _ qry opts mbPath = stats [qry] opts mbPath
  runReportL _ qrys opts mbPath = stats qrys opts mbPath

commonFlags :: [SOptions] -> [CommonFlags]
commonFlags opts = [flag | Common flag <- opts]

toDouble :: Decimal -> Double
toDouble d = fromIntegral (decimalMantissa d) / (10 ^ decimalPlaces d)

data StatRecord = StatRecord {
       srFrom   :: Maybe DateTime,
       srTo     :: Maybe DateTime,
       srOpen   :: Double,
       srMin    :: Double,
       srQ1     :: Double,
       srMedian :: Double,
       srQ3     :: Double,
       srMax    :: Double,
       srAvg    :: Double,
       srSd     :: Double,
       srClose  :: Double,
       srSum    :: Double }
  deriving (Eq, Show)

toList :: StatRecord -> [Double]
toList (StatRecord {..}) =
  [srOpen, srMin, srQ1, srMedian, srQ3, srMax, srAvg, srSd, srClose]

stats queries options mbPath = (do
    coa <- getCoAItemL mbPath
    case coa of
      Leaf {..} -> byOneAccount coa queries options leafData
      _         -> byGroup queries options coa )
  `catchWithSrcLoc`
    (\l (e :: InvalidPath) -> handler l e)
  `catchWithSrcLoc`
    (\l (e :: NoSuchRate) -> handler l e)

checkPosting :: ChartOfAccounts -> Maybe ChartOfAccounts -> Query -> Ext (Posting Decimal t) -> Bool
checkPosting _ Nothing qry ep = checkQuery qry ep
checkPosting coa (Just grp) qry ep =
    checkQuery qry ep &&
    any (postingAccount (getContent ep) `isInCoA`) [grp,coa]

getPostings :: Throws InternalError l
            => ChartOfAccounts
            -> Maybe ChartOfAccounts
            -> Query -> AnyAccount -> Ledger l [Ext (AnyPosting Decimal)]
getPostings coa internalGroup qry account = do
    crp <- filter (checkPosting coa internalGroup qry) <$> (readIOListL =<< creditPostings account)
    drp <- filter (checkPosting coa internalGroup qry) <$> (readIOListL =<< debitPostings account)
    let toCP ep = mapExt CP ep
    let toDP ep = mapExt DP ep
    return $ map toCP crp ++ map toDP drp

postingToDouble :: LedgerOptions -> AnyPosting Decimal -> Double
postingToDouble opts (CP p) = (if isAssetPosting opts p then negate else id) $ toDouble $ postingValue p
postingToDouble opts (DP p) = (if isAssetPosting opts p then id else negate) $ toDouble $ postingValue p

isAssetPosting :: LedgerOptions -> Posting v t -> Bool
isAssetPosting opts p = isAssets opts $ accountAttributes $ postingAccount p

getEntryPosting :: AnyAccount -> Ext (Entry Decimal Checked) -> Maybe (Entry Decimal Checked, Ext (AnyPosting Decimal))
getEntryPosting acc ee@(Ext {getContent = e}) =
    case map CP (filter check $ cEntryCreditPostings e) ++ map DP (filter check $ cEntryDebitPostings e) of
      [] -> Nothing
      (p:_) -> Just (e, mapExt (const p) ee)
  where
    check :: Posting Decimal t -> Bool
    check p = getID (postingAccount p) == getID acc

getExtEntry :: Ext (Balance Checked) -> Maybe (Ext (Entry Decimal Checked))
getExtEntry extBal@(Ext {..}) =
  case causedBy getContent of
    Nothing -> Nothing
    Just e -> Just $ mapExt (const e) extBal

loadData :: Throws InternalError l
         => LedgerOptions
         -> [SOptions]
         -> ChartOfAccounts
         -> Maybe ChartOfAccounts
         -> Query
         -> AnyAccount
         -> Ledger l [Ext Double]
loadData lopts opts coa internalGroup qry account
  | Amounts `elem` opts && isJust internalGroup = do
      let Just grp = internalGroup
      balances <- readIOListL (accountBalances account)
      let balances' = reverse $ filter (checkBalance coa internalGroup qry) balances
          entries   = mapMaybe getExtEntry balances'
          eps       = mapMaybe (getEntryPosting account) entries
          postings  = [p | (e,p) <- eps, checkEntryAccs [grp,coa] e]
      let doublePosting ep = mapExt (postingToDouble lopts) ep
      return $ map doublePosting (sort postings)

  | Amounts `elem` opts = do
      postings <- getPostings coa internalGroup qry account
      let doublePosting ep = mapExt (postingToDouble lopts) ep
      return $ map doublePosting (sort postings)

  | otherwise = do
      balances <- readIOListL (accountBalances account)
      let balances' = reverse $ filter (checkBalance coa internalGroup qry) balances
          btype = if CLedgerBalances `elem` commonFlags opts
                     then LedgerBalance
                     else AvailableBalance
          doubleBalance extBal = mapExt (\bal -> toDouble (balanceGetter btype bal)) extBal
      return $ map doubleBalance balances'

loadGroupData :: Throws InternalError l
              => [SOptions]
              -> Maybe ChartOfAccounts
              -> Query
              -> ChartOfAccounts
              -> Ledger l [Ext Double]
loadGroupData opts internalGroup qry coa = do
    lopts <- gets lsConfig
    tree <- mapLeafsM (loadData lopts opts coa internalGroup qry) coa
    return $ concat $ allLeafs tree

calculate :: Maybe DateTime -> Maybe DateTime -> V.Vector Double -> StatRecord
calculate d1 d2 v
  | V.length v == 0 = StatRecord {
                        srFrom   = d1,
                        srTo     = d2,
                        srOpen   = 0,
                        srMin    = 0,
                        srQ1     = 0,
                        srMedian = 0,
                        srQ3     = 0,
                        srMax    = 0,
                        srAvg    = 0,
                        srSd     = 0,
                        srClose  = 0,
                        srSum    = 0 }
  | V.length v == 1 = StatRecord {
                        srFrom   = d1,
                        srTo     = d2,
                        srOpen   = V.head v,
                        srMin    = V.head v,
                        srQ1     = V.head v,
                        srMedian = V.head v,
                        srQ3     = V.head v,
                        srMax    = V.head v,
                        srAvg    = V.head v,
                        srSd     = 0,
                        srClose  = V.head v,
                        srSum    = V.head v }
  | otherwise = StatRecord {
                  srFrom   = d1,
                  srTo     = d2,
                  srOpen   = V.head v,
                  srMin    = V.minimum v,
                  srQ1     = continuousBy cadpw 1 4 v,
                  srMedian = continuousBy cadpw 2 4 v,
                  srQ3     = continuousBy cadpw 3 4 v,
                  srMax    = V.maximum v,
                  srAvg    = mean v,
                  srSd     = stdDev v,
                  srClose  = V.last v,
                  srSum    = V.sum v }

isNotZeroSR :: StatRecord -> Bool
isNotZeroSR sr = any (/= 0.0) (toList sr)

byOneAccount coa queries options account = do
  internalGroup <- case [val | SInternal val <- options] of
                     [] -> return Nothing
                     (Nothing:_) -> return $ Just coa
                     (Just grp:_) -> Just <$> getCoAItem (mkPath grp)
  lopts <- gets lsConfig
  lists <- forM queries $ \qry -> loadData lopts options coa internalGroup qry account
  let starts = map qStart queries
      ends   = map qEnd   queries
      ccy = getCurrency account
      srcData = map (V.fromList . map getContent . sort) lists
      flags = commonFlags options
      showCcy = CNoCurrencies `notElem` flags
      results = zipWith3 calculate starts ends srcData
      prepare = if CNoZeros `elem` flags
                  then filter isNotZeroSR
                  else id
      results' = prepare results
      format = case selectOutputFormat flags of
                 OASCII _   -> tableColumns ASCII
                 OCSV csv   -> tableColumns csv
                 OHTML html -> tableColumns html
  outputText $ unlinesText $
           format [([output "FROM"],   ALeft,  map (showMaybeDate . srFrom) results'),
                   ([output "TO"],     ALeft,  map (showMaybeDate . srTo)   results'),
                   ([output "OPEN"],   ARight, map (showDouble showCcy ccy . srOpen)   results'),
                   ([output "MIN"],    ARight, map (showDouble showCcy ccy . srMin)    results'),
                   ([output "Q1"],     ARight, map (showDouble showCcy ccy . srQ1)     results'),
                   ([output "MEDIAN"], ARight, map (showDouble showCcy ccy . srMedian) results'),
                   ([output "Q3"],     ARight, map (showDouble showCcy ccy . srQ3)     results'),
                   ([output "MAX"],    ARight, map (showDouble showCcy ccy . srMax)    results'),
                   ([output "AVG"],    ARight, map (showDouble showCcy ccy . srAvg)    results'),
                   ([output "SD"],     ARight, map (showDouble showCcy ccy . srSd)     results'),
                   ([output "CLOSE"],  ARight, map (showDouble showCcy ccy . srClose)  results') ]

byGroup queries options coa = do
    internalGroup <- case [val | SInternal val <- options] of
                       [] -> return Nothing
                       (Nothing:_) -> return $ Just coa
                       (Just grp:_) -> Just <$> getCoAItem (mkPath grp)
    forM_ queries $ \qry -> do
        outputText $ showInterval qry
        go internalGroup qry
  where
    go internalGroup qry = do
      let flags = commonFlags options
      lopts <- gets lsConfig
      srcData <- mapTreeBranchesM (loadGroupData options internalGroup qry)
                                  (loadData lopts options coa internalGroup qry) coa
      let calc = toList . calculate (qStart qry) (qEnd qry) . V.fromList . map getContent . sort
      let results = mapTree calc calc srcData
      let prepare
            | CNoZeros `elem` flags = filterLeafs (any (/= 0.0))
            | otherwise = id
      let showD _ x
            | x < 0 = [Fragment (color Red) (printf "%0.4f" x)]
            | x == 0 = [Fragment faint (printf "%0.4f" x)]
            | otherwise = output $ printf "%0.4f" x
      let format = case selectOutputFormat flags of
                     OASCII _ -> \n qs rs -> unlinesText $ showTreeList [output "ACCOUNT"] (\x -> [x]) showD flags n qs rs
                     OCSV csv -> \n qs rs -> unlinesText $ tableColumns csv (treeTable (\x -> [x]) showD flags n qs rs)
                     OHTML html -> \n qs rs -> unlinesText $ tableColumns html (treeTable (\x -> [x]) showD flags n qs rs)
      let columns = map output ["OPEN", "MIN", "Q1", "MEDIAN", "Q3", "MAX", "AVG", "SD", "CLOSE"]
      outputText $ format (length columns) columns (prepare results)


text:
package info.novatec.amazon.shipping.calculator.entity;

public class AddressBuilder {
	private String street;
	private String postOfficeBox;
	private String zipCode;
	private String city;
	private Country country;

	public AddressBuilder() {
		this.street = "myStreet";
		this.postOfficeBox = null;
		this.zipCode = "12345";
		this.city = "myCity";
		this.country = Country.GERMANY;
	}

	public AddressBuilder withStreet(String street) {
		this.street = street;
		return this;
	}

	public AddressBuilder withPostOfficeBox(String postOfficeBox) {
		this.postOfficeBox = postOfficeBox;
		return this;
	}

	public AddressBuilder withZipCode(String zipCode) {
		this.zipCode = zipCode;
		return this;
	}

	public AddressBuilder withCity(String city) {
		this.city = city;
		return this;
	}

	public AddressBuilder withCountry(Country country) {
		this.country = country;
		return this;
	}

	public Address build() {
		return new Address(street, postOfficeBox, zipCode, city, country);
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<View xmlns="http://schemas.mediachase.com/ecf/view">
	<ListViewUI>
		<Grid>
			<add>
				<Columns>
					<Column isDefault="true" headingText="{SharedStrings:Edit_Command}" dataCellClientTemplateId="EditTemplate" editControlType="EditCommand" width="100" align="Center" />
					<Column isDefault="true" visible="false" allowSorting="false" dataField="CurrencyRateId" headingText="{CatalogStrings:Currency_CurrencyRateId}" />
					<Column isDefault="true" visible="false" allowEditing="false" allowSorting="false" dataField="ToCurrencyId" headingText="{CatalogStrings:Currency_ToCurrencyId}" />
					<Column isDefault="true" visible="true" allowEditing="false" isSearchable="false" allowSorting="false" dataField="CurrencyCode" headingText="{SharedStrings:Currency}" />
					<Column isDefault="true" width="100" visible="true" allowEditing="false" isSearchable="false" allowSorting="false" dataField="EndOfDayRate" headingText="{SharedStrings:Rate}" formatString="#0.0000" />
					<Column dataCellServerTemplateId="DateTimeTemplate" width="200" visible="true" allowEditing="false" isSearchable="false" allowSorting="false" dataField="CurrencyRateDate" headingText="{SharedStrings:Rate_Date}">
						<Template id="DateTimeTemplate" controlUrl="~/Apps/Core/Controls/GridTemplates/DateTimeTemplate.ascx" DateArgument="CurrencyRateDate" FormatWithoutConversion="true" />
					</Column>
					<Column dataCellServerTemplateId="DateTimeTemplate2" width="200" visible="true" allowEditing="false" isSearchable="false" allowSorting="false" dataField="ModifiedDate" headingText="{SharedStrings:Modified}">
						<Template id="DateTimeTemplate2" controlUrl="~/Apps/Core/Controls/GridTemplates/DateTimeTemplate.ascx" DateArgument="ModifiedDate" />
					</Column>
				</Columns>
			</add>
		</Grid>
	</ListViewUI>
	<ViewConfig>
		<setAttributes id="CurrencyRates" controlUrl="" />
	</ViewConfig>
</View>


text:
package de.fhg.fokus.ims.core.event.reg;

import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

import org.kxml2.kdom.Element;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

import de.fhg.fokus.ims.core.utils.xml.XmlSerializable;

/**
 *

 * Java class for anonymous complex type.
 *
 *

 * The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{urn:ietf:params:xml:ns:reginfo}registration" maxOccurs="unbounded" minOccurs="0"/>
 *         <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="version" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
 *       <attribute name="state" use="required">
 *         <simpleType>
 *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *             <enumeration value="full"/>
 *             <enumeration value="partial"/>
 *           </restriction>
 *         </simpleType>
 *       </attribute>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
public class Reginfo implements XmlSerializable
{
	public static final class State extends de.fhg.fokus.ims.core.utils.Enum
	{
		public static final State FULL = new State("full");

		public static final State PARTIAL = new State("partial");

		private State(String value)
		{
			super(value);
		}
	}

	public static final String NAMESPACE = "urn:ietf:params:xml:ns:reginfo";

	private List registration;

	private List any;

	protected int version;

	protected State state;

	/**
	 * Gets the value of the registration property.
	 *
	 *

	 * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present
	 * inside the JAXB object. This is why there is not a set method for the registration property.
	 *
	 *

	 * For example, to add a new item, do as follows:
	 *
	 *

	 * getRegistration().add(newItem);
	 *

	 *
	 *
	 *

	 * Objects of the following type(s) are allowed in the list {@link Registration }
	 *
	 *
	 */
	public List getRegistration()
	{
		if (registration == null)
		{
			registration = new ArrayList();
		}
		return this.registration;
	}

	/**
	 * Gets the value of the any property.
	 *
	 *

	 * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present
	 * inside the JAXB object. This is why there is not a set method for the any property.
	 *
	 *

	 * For example, to add a new item, do as follows:
	 *
	 *

	 * getAny().add(newItem);
	 *

	 *
	 *
	 *

	 * Objects of the following type(s) are allowed in the list {@link Element } {@link Object }
	 *
	 *
	 */
	public List getAny()
	{
		if (any == null)
		{
			any = new ArrayList();
		}
		return this.any;
	}

	/**
	 * Gets the value of the version property.
	 *
	 * @return possible object is {@link BigInteger }
	 *
	 */
	public int getVersion()
	{
		return version;
	}

	/**
	 * Sets the value of the version property.
	 *
	 * @param value
	 *            allowed object is {@link BigInteger }
	 *
	 */
	public void setVersion(int value)
	{
		this.version = value;
	}

	/**
	 * Gets the value of the state property.
	 *
	 * @return possible object is {@link String }
	 *
	 */
	public State getState()
	{
		return state;
	}

	/**
	 * Sets the value of the state property.
	 *
	 * @param value
	 *            allowed object is {@link String }
	 *
	 */
	public void setState(State value)
	{
		this.state = value;
	}

	public void deserialize(XmlPullParser reader) throws XmlPullParserException, IOException
	{
		version = Integer.decode(reader.getAttributeValue(XmlPullParser.NO_NAMESPACE, "version")).intValue();
		state = (State) de.fhg.fokus.ims.core.utils.Enum.parse(State.class, reader.getAttributeValue(XmlPullParser.NO_NAMESPACE, "state"));

		String startTagName = reader.getName();

		int eventType = reader.nextTag();
		String namespace = reader.getNamespace();
		String name = reader.getName();

		while (!(eventType == XmlPullParser.END_TAG & name.equals(startTagName)))
		{
			if (Reginfo.NAMESPACE.equals(namespace))
			{
				if (name.equals("registration"))
				{
					Registration reg = new Registration();
					reg.deserialize(reader);
					getRegistration().add(reg);
				}
			}
			else
			{
				Element element = new Element();
				element.parse(reader);
				getAny().add(element);
			}

			eventType = reader.nextTag();
			namespace = reader.getNamespace();
			name = reader.getName();
		}
	}

	public void serialize(XmlSerializer writer) throws IOException
	{
		writer.startTag(NAMESPACE, "reginfo");

		writer.attribute(XmlPullParser.NO_NAMESPACE, "version", String.valueOf(version));

		writer.attribute(XmlPullParser.NO_NAMESPACE, "state", state.toString());

		if (registration != null && registration.size() > 0)
		{

			for(int i = 0; i < registration.size(); i++)
			{
				writer.startTag(NAMESPACE, "registration");
				((Registration)registration.get(i)).serialize(writer);
				writer.endTag(NAMESPACE, "registration");
			}
		}

		writer.endTag(NAMESPACE, "reginfo");
	}

}