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


Category:algorithms Component type:function
Prototype
template <class LinalgObj, class T>
void scale(LinalgObj A, const T& alpha) ;
Description
Multiply all the elements in A (or x) by alpha.
Definition
mtl.h
Requirements on types
  • Vector must be mutable
  • T is convertible to Vector's value_type
  • The multiplication operator must be defined for Vector::value_type and T
Preconditions
Complexity
O(n)
Example
In vec_scale_algo.cc:
  mtl::dense1D< double > x(10, 2.0);
  mtl::scale(x, 2.0);
  mtl::print_vector(x);

Notes
See also

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