COMBINATORIAL_BLAS  1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MMmul.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* Sequential and Parallel Sparse Matrix Multiplication Library */
3 /* version 2.3 --------------------------------------------------/
4 /* date: 01/18/2009 ---------------------------------------------/
5 /* author: Aydin Buluc (aydin@cs.ucsb.edu) ----------------------/
6 /* description: Helper class in order to get rid of copying */
7 /* and temporaries during the A += B*C call */
8 /* ack: This technique is described in Stroustrup, */
9 /* The C++ Programming Language, 3rd Edition, */
10 /* Section 22.4.7 [Temporaries, Copying and Loops] */
11 /****************************************************************/
12 
13 
14 #ifndef _MM_MUL_H
15 #define _MM_MUL_H
16 
17 template <class BT>
18 struct MMmul
19 {
20  const BT & sm1;
21  const BT & sm2;
22 
23  // Constructor
24  MMmul(const BT & smm1, const BT & smm2): sm1(smm1), sm2(smm2) { }
25 
26  // No need for operator BT() because we have the corresponding copy constructor
27  // and assignment operators to evaluate and return result !
28 
29 };
30 
31 template <typename BT>
32 inline MMmul< BT > operator* (const BT & smm1, const BT & smm2)
33 {
34  return MMmul< BT >(smm1,smm2);
35 }
36 
37 #endif
38