Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/valarray"

From cppreference.com
< cpp‎ | numeric
(mention the (lost) competition with expression templates.)
m (typo)
Line 9: Line 9:
  
 
===ONotes===
 
===ONotes===
{{cpp|std::valarray}} and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword {{tt|restrict}} in the C programming language. In addition, functions and operators that take {{tt|valarray}} arguments are allowed to return special objects which enable vectorization: an expression such as {{cpp|1=v1 = a*v2 + v3;}} would be compiled as a single loop that executes {{cpp|1=[v1[i] = a*v2[i] + v3[i];}} avoiding any temporaries or multiple passes. However, [[enwiki::Expression templates|expression templates]] make the same optimization technique available for any C++ container, and the majority of numeric libraries prefer expression templates to valarrays. A rare exception is [http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011/compiler_c/cref_cls/common/cppref_valarray_intro.htm Intel Parallel Studio ]  
+
{{cpp|std::valarray}} and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword {{tt|restrict}} in the C programming language. In addition, functions and operators that take {{tt|valarray}} arguments are allowed to return special objects which enable vectorization: an expression such as {{cpp|1=v1 = a*v2 + v3;}} would be compiled as a single loop that executes {{cpp|1=v1[i] = a*v2[i] + v3[i];}} avoiding any temporaries or multiple passes. However, [[enwiki::Expression templates|expression templates]] make the same optimization technique available for any C++ container, and the majority of numeric libraries prefer expression templates to valarrays. A rare exception is [http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011/compiler_c/cref_cls/common/cppref_valarray_intro.htm Intel Parallel Studio ]  
  
 
===Member types===
 
===Member types===

Revision as of 11:13, 10 January 2012

Template:cpp/numeric/valarray/sidebar

Defined in header <valarray>
template< class T >
class valarray;

Template:cpp is the class for representing and manipulating arrays of values. It supports element-wise mathematical operations and various forms of generalized subscript operators, slicing and indirect access.

Contents

ONotes

Template:cpp and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword restrict in the C programming language. In addition, functions and operators that take valarray arguments are allowed to return special objects which enable vectorization: an expression such as Template:cpp would be compiled as a single loop that executes Template:cpp avoiding any temporaries or multiple passes. However, expression templates make the same optimization technique available for any C++ container, and the majority of numeric libraries prefer expression templates to valarrays. A rare exception is Intel Parallel Studio

Member types

Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list end

Member functions

Template:cpp/numeric/valarray/dcl list valarrayTemplate:cpp/numeric/valarray/dcl list ~valarrayTemplate:cpp/numeric/valarray/dcl list operator=Template:cpp/numeric/valarray/dcl list operator atTemplate:cpp/numeric/valarray/dcl list operator unaryTemplate:cpp/numeric/valarray/dcl list operator compoundTemplate:cpp/numeric/valarray/dcl list swapTemplate:cpp/numeric/valarray/dcl list sizeTemplate:cpp/numeric/valarray/dcl list resizeTemplate:cpp/numeric/valarray/dcl list sumTemplate:cpp/numeric/valarray/dcl list minTemplate:cpp/numeric/valarray/dcl list maxTemplate:cpp/numeric/valarray/dcl list shiftTemplate:cpp/numeric/valarray/dcl list cshiftTemplate:cpp/numeric/valarray/dcl list apply

Non-member functions

Template:cpp/numeric/valarray/dcl list swap2Template:cpp/numeric/valarray/dcl list begin2Template:cpp/numeric/valarray/dcl list end2Template:cpp/numeric/valarray/dcl list operator binaryTemplate:cpp/numeric/valarray/dcl list operator cmpTemplate:cpp/numeric/valarray/dcl list absTemplate:cpp/numeric/valarray/dcl list expTemplate:cpp/numeric/valarray/dcl list logTemplate:cpp/numeric/valarray/dcl list log10Template:cpp/numeric/valarray/dcl list powTemplate:cpp/numeric/valarray/dcl list sqrtTemplate:cpp/numeric/valarray/dcl list sinTemplate:cpp/numeric/valarray/dcl list cosTemplate:cpp/numeric/valarray/dcl list tanTemplate:cpp/numeric/valarray/dcl list asinTemplate:cpp/numeric/valarray/dcl list acosTemplate:cpp/numeric/valarray/dcl list atanTemplate:cpp/numeric/valarray/dcl list atan2Template:cpp/numeric/valarray/dcl list sinhTemplate:cpp/numeric/valarray/dcl list coshTemplate:cpp/numeric/valarray/dcl list tanh
Exponential functions
Power functions
Trigonometric functions
Hyperbolic functions

Helper classes

Template:cpp/numeric/valarray/dcl list sliceTemplate:cpp/numeric/valarray/dcl list slice arrayTemplate:cpp/numeric/valarray/dcl list gsliceTemplate:cpp/numeric/valarray/dcl list gslice arrayTemplate:cpp/numeric/valarray/dcl list mask arrayTemplate:cpp/numeric/valarray/dcl list indirect array