/* *****************************************************
   THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
   *****************************************************

   Generated by:
     scitbx.source_generators.array_family.generate_reductions
 */

#ifndef SCITBX_ARRAY_FAMILY_SHARED_REDUCTIONS_H
#define SCITBX_ARRAY_FAMILY_SHARED_REDUCTIONS_H

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include <scitbx/array_family/ref_reductions.h>
#include <scitbx/array_family/shared_plain.h>

namespace scitbx { namespace af {

  template <typename ElementType1,
            typename ElementType2>
  int
  inline
  order(
    shared_plain<ElementType1> const& a1,
    shared_plain<ElementType2> const& a2)
  {
    return order(a1.const_ref(), a2.const_ref());
  }

  template <typename ElementType>
  inline
  std::size_t
  max_index(shared_plain<ElementType> const& a)
  {
    return max_index(a.const_ref());
  }

  template <typename ElementType>
  inline
  std::size_t
  min_index(shared_plain<ElementType> const& a)
  {
    return min_index(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  max(shared_plain<ElementType> const& a)
  {
    return max(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  min(shared_plain<ElementType> const& a)
  {
    return min(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  max_absolute(shared_plain<ElementType> const& a)
  {
    return max_absolute(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  sum(shared_plain<ElementType> const& a)
  {
    return sum(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  sum_sq(shared_plain<ElementType> const& a)
  {
    return sum_sq(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  product(shared_plain<ElementType> const& a)
  {
    return product(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  mean(shared_plain<ElementType> const& a)
  {
    return mean(a.const_ref());
  }

  template <typename ElementType>
  inline
  ElementType
  mean_sq(shared_plain<ElementType> const& a)
  {
    return mean_sq(a.const_ref());
  }

  template <typename ElementTypeValues,
            typename ElementTypeWeights>
  inline
  ElementTypeValues
  mean_weighted(
    shared_plain<ElementTypeValues> const& values,
    shared_plain<ElementTypeWeights> const& weights)
  {
    return mean_weighted(values.const_ref(), weights.const_ref());
  }

  template <typename ElementTypeValues,
            typename ElementTypeWeights>
  inline
  ElementTypeValues
  mean_sq_weighted(
    shared_plain<ElementTypeValues> const& values,
    shared_plain<ElementTypeWeights> const& weights)
  {
    return mean_sq_weighted(values.const_ref(), weights.const_ref());
  }

  template <typename ElementType, class PredicateType>
  inline
  boost::optional<std::size_t>
  first_index(shared_plain<ElementType> const& a,
               PredicateType p)
  {
    return first_index(a.const_ref(), p);
  }

  template <typename ElementType, class PredicateType>
  inline
  boost::optional<std::size_t>
  last_index(shared_plain<ElementType> const& a,
               PredicateType p)
  {
    return last_index(a.const_ref(), p);
  }

}} // namespace scitbx::af

#endif // DOXYGEN_SHOULD_SKIP_THIS

#endif // SCITBX_ARRAY_FAMILY_SHARED_REDUCTIONS_H

