| 1 | /***************************************************************************
 | 
|---|
| 2 |  * blitz/matref.h      Declaration of the _bz_MatrixRef<P_numtype, P_structure>
 | 
|---|
| 3 |  *                     class.
 | 
|---|
| 4 |  *
 | 
|---|
| 5 |  * $Id: matref.h,v 1.1.1.1 1999-11-26 16:37:03 ansari Exp $
 | 
|---|
| 6 |  *
 | 
|---|
| 7 |  * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
 | 
|---|
| 8 |  *
 | 
|---|
| 9 |  * This program is free software; you can redistribute it and/or
 | 
|---|
| 10 |  * modify it under the terms of the GNU General Public License
 | 
|---|
| 11 |  * as published by the Free Software Foundation; either version 2
 | 
|---|
| 12 |  * of the License, or (at your option) any later version.
 | 
|---|
| 13 |  *
 | 
|---|
| 14 |  * This program is distributed in the hope that it will be useful,
 | 
|---|
| 15 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 16 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 17 |  * GNU General Public License for more details.
 | 
|---|
| 18 |  *
 | 
|---|
| 19 |  * Suggestions:          blitz-suggest@cybervision.com
 | 
|---|
| 20 |  * Bugs:                 blitz-bugs@cybervision.com
 | 
|---|
| 21 |  *
 | 
|---|
| 22 |  * For more information, please see the Blitz++ Home Page:
 | 
|---|
| 23 |  *    http://seurat.uwaterloo.ca/blitz/
 | 
|---|
| 24 |  *
 | 
|---|
| 25 |  ***************************************************************************
 | 
|---|
| 26 |  * $Log: not supported by cvs2svn $
 | 
|---|
| 27 |  * Revision 1.1.1.1  1999/04/09  17:59:00  ansari
 | 
|---|
| 28 |  * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99
 | 
|---|
| 29 |  *
 | 
|---|
| 30 |  * Revision 1.3  1998/03/14 00:04:47  tveldhui
 | 
|---|
| 31 |  * 0.2-alpha-05
 | 
|---|
| 32 |  *
 | 
|---|
| 33 |  * Revision 1.2  1997/01/24 14:42:00  tveldhui
 | 
|---|
| 34 |  * Periodic RCS update
 | 
|---|
| 35 |  *
 | 
|---|
| 36 |  * Revision 1.1  1997/01/13 22:19:58  tveldhui
 | 
|---|
| 37 |  * Periodic RCS update
 | 
|---|
| 38 |  *
 | 
|---|
| 39 |  *
 | 
|---|
| 40 |  */
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #ifndef BZ_MATREF_H
 | 
|---|
| 43 | #define BZ_MATREF_H
 | 
|---|
| 44 | 
 | 
|---|
| 45 | #ifndef BZ_MATEXPR_H
 | 
|---|
| 46 |  #error <blitz/matref.h> must be included via <blitz/matexpr.h>
 | 
|---|
| 47 | #endif // BZ_MATEXPR_H
 | 
|---|
| 48 | 
 | 
|---|
| 49 | BZ_NAMESPACE(blitz)
 | 
|---|
| 50 | 
 | 
|---|
| 51 | template<class P_numtype, class P_structure>
 | 
|---|
| 52 | class _bz_MatrixRef {
 | 
|---|
| 53 | 
 | 
|---|
| 54 | public:
 | 
|---|
| 55 |     typedef P_numtype T_numtype;
 | 
|---|
| 56 | 
 | 
|---|
| 57 |     _bz_MatrixRef(const Matrix<P_numtype, P_structure>& m)
 | 
|---|
| 58 |         : matrix_(&m)
 | 
|---|
| 59 |     { }
 | 
|---|
| 60 | 
 | 
|---|
| 61 |     T_numtype operator()(unsigned i, unsigned j) const
 | 
|---|
| 62 |     { return (*matrix_)(i,j); }
 | 
|---|
| 63 | 
 | 
|---|
| 64 |     unsigned rows(unsigned) const
 | 
|---|
| 65 |     { return matrix_->rows(); }
 | 
|---|
| 66 | 
 | 
|---|
| 67 |     unsigned cols(unsigned) const
 | 
|---|
| 68 |     { return matrix_->cols(); }
 | 
|---|
| 69 | 
 | 
|---|
| 70 | private:
 | 
|---|
| 71 |     _bz_MatrixRef() { } 
 | 
|---|
| 72 | 
 | 
|---|
| 73 |     const Matrix<P_numtype, P_structure>* matrix_;
 | 
|---|
| 74 | };
 | 
|---|
| 75 | 
 | 
|---|
| 76 | BZ_NAMESPACE_END
 | 
|---|
| 77 | 
 | 
|---|
| 78 | #endif // BZ_MATREF_H
 | 
|---|