add [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:algorithms Component type:function
Prototype
template <class VecW, class VecX, class VecY, class VecZ>
void add(const VecX& x, const VecY& y, const VecZ& z, VecW w) ;
Description
Add the elements of x, y, and z and assign into w. For now just dense vectors.
Definition
mtl.h
Requirements on types
  • VecX::value_type, VecY::value_type, VecZ::value_type, and VecW::value_type should be the same type
  • The addition operator must be defined for the value_type.
Preconditions
Complexity
linear time
Example
In vecvec_add3.cc:
  dense1D<double> x(20,2), y(20,3), z(10,1), w(10);
  add(strided(x,2), strided(y,2), z, w);

Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.