| ||||||
| ||||||
![]() | ||||||
Prototype | ||||||
template <class LinalgA, class LinalgB> void copy(const LinalgA& A, LinalgB B) ; | ||||||
![]() | ||||||
Description | ||||||
Copy the elements of matrix A into matrix B, or copy the elements of vector x into vector y. For shaped and sparse matrices, this copies only the elements stored in A to B. If x is a sparse vector and y is dense, a "scatter" is performed. If y is sparse and x is dense, then a "gather" is performed. If both vectors are sparse, but of different structure the result is undefined. | ||||||
![]() | ||||||
Definition | ||||||
mtl.h | ||||||
![]() | ||||||
Preconditions | ||||||
| ||||||
![]() | ||||||
Complexity | ||||||
O(m*n) for matrices. O(nnz) if either A or B are sparse and of the same orientation (otherwise it can be O(nnz^2). O(n) for vectors. | ||||||
![]() | ||||||
Example | ||||||
In vecvec_copy.cc:
dense1D<double> x(10,1); dense1D<double> y(10); double alpha = 4.0; mtl::copy(scaled(x, alpha), y); | ||||||
![]() | ||||||
Notes | ||||||
![]() | ||||||
See also | ||||||
Copyright ©
1998,1999 University of Notre Dame. All Rights Reserved.