Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BandedMatrix.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010, The Barbarian Group
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
6  the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and
9  the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
11  the following disclaimer in the documentation and/or other materials provided with the distribution.
12 
13  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
14  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
15  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
16  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
17  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20  POSSIBILITY OF SUCH DAMAGE.
21 */
22 
23 /*
24  Geometric Tools, LLC
25  Portions Copyright (c) 1998-2010
26  Distributed under the Boost Software License, Version 1.0.
27  http://www.boost.org/LICENSE_1_0.txt
28  http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
29 */
30 
31 #pragma once
32 
33 namespace cinder {
34 
35 template<typename T>
36 class BandedMatrix {
37  public:
38  BandedMatrix( int iSize, int iLBands, int iUBands );
39  BandedMatrix( const BandedMatrix& rkM );
40  ~BandedMatrix();
41 
42  BandedMatrix& operator=( const BandedMatrix &rkM );
43 
44  int getSize() const;
45  int getLBands() const;
46  int getUBands() const;
47 
48  T* getDBand();
49  const T* getDBand() const;
50 
51  int getLBandMax( int i ) const; // LBand(i): 0 <= index < LBandMax
52  T* getLBand( int i );
53  const T* getLBand( int i ) const;
54 
55  int getUBandMax( int i ) const; // UBand(i): 0 <= index < UBandMax
56  T* getUBand( int i );
57  const T* getUBand( int i ) const;
58 
59  T& operator()( int iRow, int iCol );
60  T operator()( int iRow, int iCol ) const;
61 
62  void setZero();
63  void setIdentity();
64 
65  private:
66  void allocate();
67  void deallocate();
68 
69  int m_iSize, m_iLBands, m_iUBands;
70  T* m_afDBand;
71  T** m_aafLBand;
72  T** m_aafUBand;
73 };
74 
77 
78 } // namespace cindernt
int getLBandMax(int i) const
Definition: BandedMatrix.cpp:122
T * getDBand()
Definition: BandedMatrix.cpp:110
Definition: BandedMatrix.h:36
int getUBands() const
Definition: BandedMatrix.cpp:104
T & operator()(int iRow, int iCol)
Definition: BandedMatrix.cpp:180
BandedMatrix(int iSize, int iLBands, int iUBands)
Definition: BandedMatrix.cpp:39
int getLBands() const
Definition: BandedMatrix.cpp:98
BandedMatrix< double > BandedMatrixd
Definition: BandedMatrix.h:76
BandedMatrix & operator=(const BandedMatrix &rkM)
Definition: BandedMatrix.cpp:66
~BandedMatrix()
Definition: BandedMatrix.cpp:60
int getSize() const
Definition: BandedMatrix.cpp:92
BandedMatrix< float > BandedMatrixf
Definition: BandedMatrix.h:75
void setZero()
Definition: BandedMatrix.cpp:239
void setIdentity()
Definition: BandedMatrix.cpp:258
T * getLBand(int i)
Definition: BandedMatrix.cpp:129
int getUBandMax(int i) const
Definition: BandedMatrix.cpp:151
T * getUBand(int i)
Definition: BandedMatrix.cpp:158