⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 valarray.cc

📁 Keil for ARM.rar
💻 CC
📖 第 1 页 / 共 5 页
字号:
      tmp_array[ind] = std::abs(a[ind]);             
#else
      tmp_array[ind] = ::abs(a[ind]);             
#endif

    // note: abs need to be overloaded for 
    // float, long double and long see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> acos(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::acos(a[ind]);             
#else
      tmp_array[ind] = ::acos(a[ind]);             
#endif

    // note: acos need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> asin(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::asin(a[ind]);             
#else
      tmp_array[ind] = ::asin(a[ind]);             
#endif

    // note: asin need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> atan(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::atan(a[ind]);             
#else
      tmp_array[ind] = ::atan(a[ind]);             
#endif

    // note: atan need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> cos(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::cos(a[ind]);
#else
      tmp_array[ind] = ::cos(a[ind]);
#endif

    // note: cos need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> cosh(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::cosh(a[ind]);             
#else
      tmp_array[ind] = ::cosh(a[ind]);             
#endif

    // note: cosh need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> exp(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::exp(a[ind]);             
#else
      tmp_array[ind] = ::exp(a[ind]);             
#endif

    // note: exp need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> log(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::log(a[ind]);             
#else
      tmp_array[ind] = ::log(a[ind]);             
#endif

    // note: log need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> log10(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::log10(a[ind]);             
#else
      tmp_array[ind] = ::log10(a[ind]);             
#endif

    // note: log10 need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> sinh(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::sinh(a[ind]);             
#else
      tmp_array[ind] = ::sinh(a[ind]);             
#endif

    // note: sinh need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> sin(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::sin(a[ind]);             
#else
      tmp_array[ind] = ::sin(a[ind]);             
#endif

    // note: sin need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> sqrt(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::sqrt(a[ind]);             
#else
      tmp_array[ind] = ::sqrt(a[ind]);             
#endif

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> tan(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::tan(a[ind]);             
#else
      tmp_array[ind] = ::tan(a[ind]);             
#endif

    // note: tan need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }


  template<class T>
  valarray<T> tanh(const valarray<T>& a)
  {
    valarray<T> tmp_array(a.size());

    for(size_t ind=0; ind< a.size(); ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::tanh(a[ind]);             
#else
      tmp_array[ind] = ::tanh(a[ind]);             
#endif

    // note: tanh need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = a.size();

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> atan2(const valarray<T>& a, const valarray<T>& b)
  {
    size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
    valarray<T> tmp_array(length);

    for(size_t ind=0; ind< length; ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::atan2(a[ind],b[ind]);             
#else
      tmp_array[ind] = ::atan2(a[ind],b[ind]);             
#endif

    // note: atan2 need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = length;

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> atan2(const valarray<T>& a, const T& b)
  {
    size_t length= a.size();
    valarray<T> tmp_array(length);

    for(size_t ind=0; ind< length; ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::atan2(a[ind],b);             
#else
      tmp_array[ind] = ::atan2(a[ind],b);             
#endif

    // note: atan2 need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = length;

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> atan2(const T& a, const valarray<T>& b)
  {
    size_t length= b.size();
    valarray<T> tmp_array(length);

    for(size_t ind=0; ind< length; ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::atan2(a,b[ind]);             
#else
      tmp_array[ind] = ::atan2(a,b[ind]);             
#endif

    // note: atan2 need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = length;

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> pow(const valarray<T>& a, const valarray<T>& b)
  {
    size_t length= ( a.size() > b.size() ) ? b.size() : a.size();
    valarray<T> tmp_array(length);

    for(size_t ind=0; ind< length; ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::pow(a[ind],b[ind]);             
#else
      tmp_array[ind] = ::pow(a[ind],b[ind]);             
#endif

    // note: pow need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = tmp_array._RW_get_memory_array()._RW_get_storage();
    _tmp_ret->length = length;

    tmp_array._RW_get_memory_array_adr()->_RW_invalidate();

    return _tmp_ret;
  }

  template<class T>
  valarray<T> pow(const valarray<T>& a, const T& b)
  {
    size_t length= a.size();
    valarray<T> tmp_array(length);

    for(size_t ind=0; ind< length; ind++ )
#if !defined (_RWSTD_NO_NEW_HEADER) && !defined (_RWSTD_NO_NAMESPACE)
      tmp_array[ind] = std::pow(a[ind],b);             
#else
      tmp_array[ind] = ::pow(a[ind],b);             
#endif

    // note: pow need to be overloaded for 
    // float, long double see (17.3.1.1)

    _RW_IMP_SPACE(_RW_temporary<T>)* _tmp_ret = new _RW_IMP_SPACE(_RW_temporary<T>);

    _tmp_ret->store_adr = t

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -