| 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-04-09 17:59:00 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.3 1998/03/14 00:04:47 tveldhui
|
|---|
| 28 | * 0.2-alpha-05
|
|---|
| 29 | *
|
|---|
| 30 | * Revision 1.2 1997/01/24 14:42:00 tveldhui
|
|---|
| 31 | * Periodic RCS update
|
|---|
| 32 | *
|
|---|
| 33 | * Revision 1.1 1997/01/13 22:19:58 tveldhui
|
|---|
| 34 | * Periodic RCS update
|
|---|
| 35 | *
|
|---|
| 36 | *
|
|---|
| 37 | */
|
|---|
| 38 |
|
|---|
| 39 | #ifndef BZ_MATREF_H
|
|---|
| 40 | #define BZ_MATREF_H
|
|---|
| 41 |
|
|---|
| 42 | #ifndef BZ_MATEXPR_H
|
|---|
| 43 | #error <blitz/matref.h> must be included via <blitz/matexpr.h>
|
|---|
| 44 | #endif // BZ_MATEXPR_H
|
|---|
| 45 |
|
|---|
| 46 | BZ_NAMESPACE(blitz)
|
|---|
| 47 |
|
|---|
| 48 | template<class P_numtype, class P_structure>
|
|---|
| 49 | class _bz_MatrixRef {
|
|---|
| 50 |
|
|---|
| 51 | public:
|
|---|
| 52 | typedef P_numtype T_numtype;
|
|---|
| 53 |
|
|---|
| 54 | _bz_MatrixRef(const Matrix<P_numtype, P_structure>& m)
|
|---|
| 55 | : matrix_(&m)
|
|---|
| 56 | { }
|
|---|
| 57 |
|
|---|
| 58 | T_numtype operator()(unsigned i, unsigned j) const
|
|---|
| 59 | { return (*matrix_)(i,j); }
|
|---|
| 60 |
|
|---|
| 61 | unsigned rows(unsigned) const
|
|---|
| 62 | { return matrix_->rows(); }
|
|---|
| 63 |
|
|---|
| 64 | unsigned cols(unsigned) const
|
|---|
| 65 | { return matrix_->cols(); }
|
|---|
| 66 |
|
|---|
| 67 | private:
|
|---|
| 68 | _bz_MatrixRef() { }
|
|---|
| 69 |
|
|---|
| 70 | const Matrix<P_numtype, P_structure>* matrix_;
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|
| 73 | BZ_NAMESPACE_END
|
|---|
| 74 |
|
|---|
| 75 | #endif // BZ_MATREF_H
|
|---|