source: XMLIO_V2/external/include/blitz/matref.h @ 73

Last change on this file since 73 was 73, checked in by ymipsl, 14 years ago
  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/***************************************************************************
2 * blitz/matref.h      Declaration of the _bz_MatrixRef<P_numtype, P_structure>
3 *                     class.
4 *
5 * $Id: matref.h,v 1.4 2003/12/11 03:44:22 julianc Exp $
6 *
7 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
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-dev@oonumerics.org
20 * Bugs:                 blitz-bugs@oonumerics.org
21 *
22 * For more information, please see the Blitz++ Home Page:
23 *    http://oonumerics.org/blitz/
24 *
25 ***************************************************************************/
26
27#ifndef BZ_MATREF_H
28#define BZ_MATREF_H
29
30#ifndef BZ_MATEXPR_H
31 #error <blitz/matref.h> must be included via <blitz/matexpr.h>
32#endif // BZ_MATEXPR_H
33
34BZ_NAMESPACE(blitz)
35
36template<typename P_numtype, typename P_structure>
37class _bz_MatrixRef {
38
39public:
40    typedef P_numtype T_numtype;
41
42    _bz_MatrixRef(const Matrix<P_numtype, P_structure>& m)
43        : matrix_(&m)
44    { }
45
46    T_numtype operator()(unsigned i, unsigned j) const
47    { return (*matrix_)(i,j); }
48
49    unsigned rows(unsigned) const
50    { return matrix_->rows(); }
51
52    unsigned cols(unsigned) const
53    { return matrix_->cols(); }
54
55private:
56    _bz_MatrixRef() { } 
57
58    const Matrix<P_numtype, P_structure>* matrix_;
59};
60
61BZ_NAMESPACE_END
62
63#endif // BZ_MATREF_H
Note: See TracBrowser for help on using the repository browser.