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


Category:algorithms Component type:function
Prototype
template <class Matrix, class VecX, class VecY, class VecZ>
void mult(const Matrix& A, const VecX& x, const VecY& y, VecZ z) ;
Description
Definition
mtl.h
Requirements on types
  • Matrix::value_type, VecX::value_type, VecY::value_type, and VecZ::value_type must be the same type
  • the multiplication operator must be defined for Matrix::value_type
  • the addition operator must be defined for Matrix::value_type
Preconditions
  • A.nrows() <= y.size()
  • A.nrows() <= z.size()
  • A.ncols() <= x.size()
  • no aliasing in the arguments
Complexity
Example
In symm_sparse_vec_prod.cc:
  const Matrix::size_type matrix_size=5;
  Matrix A(matrix_size,matrix_size);
  Vec y(matrix_size,1),x(matrix_size);
  double alpha=2, beta=3;
  //fill arrays...
  mult(A,scaled(x,alpha),scaled(y,beta),y);

  cout << "Ax + y =";
  print_vector(y);

Notes
See also

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