[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/numeric/valarray/exp [Back]  [Original]

std::exp<div class="t-tr-text">(STD :: valarray)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">:</div><div class="t-tr-dropdown-orig">(std::valarray)</div><div class="t-tr-dropdown-notes"> [http://translate.google.com Google].<br/> . [http://en.cppreference.com/w/Cppreference:MachineTranslations ].</div></div></div></div></div> cppreference.com
cppreference.com

std::exp<div class="t-tr-text">(STD :: valarray)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">:</div><div class="t-tr-dropdown-orig">(std::valarray)</div><div class="t-tr-dropdown-notes"> [http://translate.google.com Google].<br/> . [http://en.cppreference.com/w/Cppreference:MachineTranslations ].</div></div></div></div></div>

cppreference.com

<metanoindex/>

 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
(C++17)
(C++20)
(C++11)
(C++11)
(C++17)
(C++17)
(C++20)
(C++20)
(C++11)
(C++17)
(C++20)
(C++23)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
 
 
<tbody> </tbody>
template< class T > valarray<T> exp( const valarray<T>& va );
va , , .
:
For each element in va computes e raised to the power equal to the value of the element.
Google.
. .

va
,
:
value array to apply the operation to
Google.
. .

, va.
:
Value array containing e raised by the values in va.
Google.
. .

(exp) . , std::exp .
:
Unqualified function (exp) is used to perform the computation. If such function is not available, std::exp is used due to argument dependent lookup.
Google.
. .
std::valarray. , :
:
The function can be implemented with the return type different from std::valarray. In this case, the replacement type has the following properties:
Google.
. .
  • const - std::valarray .
    :
    All const member functions of std::valarray are provided.
    Google.
    . .
  • std::valarray, std::slice_array, std::gslice_array, std::mask_array std::indirect_array .
    :
    std::valarray, std::slice_array, std::gslice_array, std::mask_array and std::indirect_array can be constructed from the replacement type.
    Google.
    . .
  • , const std::valarray& .
    :
    All functions accepting a arguments of type const std::valarray& should also accept the replacement type.
    Google.
    . .
  • const std::valarray& const std::valarray& .
    :
    All functions accepting two arguments of type const std::valarray& should accept every combination of const std::valarray& and the replacement type.
    Google.
    . .

template< class T >
valarray<T> exp( const valarray<T>& va )
{
    valarray<T> other = va;
    for (T &i : other) {
        i = exp(i);
    }
    return other; // proxy object may be returned
}

e
= -1
.
:
This example demonstrates the Euler's identity e
= -1
and the related exponents.
Google.
. .

#include <iostream>
#include <complex>
#include <valarray>

int main()
{
    const double pi = std::acos(-1);
    std::valarray<std::complex<double>> v = {
        {0, 0}, {0, pi/2}, {0, pi}, {0, 3*pi/2}, {0, 2*pi}
    };
    std::valarray<std::complex<double>> v2 = std::exp(v);
    for(auto n : v2) {
        std::cout << std::fixed << n << '\n';
    }
}

:

(1.000000,0.000000)
(0.000000,1.000000)
(-1.000000,0.000000)
(-0.000000,-1.000000)
(1.000000,-0.000000)

.

(C++11)(C++11)
e (\({\small e^x}\)ex)
() []
e
( ) []

Web Proxy Viewer  |  New URL  |  Original Page