ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/math/RectMatrix.hpp
(Generate patch)

Comparing:
trunk/OOPSE-3.0/src/math/RectMatrix.hpp (file contents), Revision 1630 by tim, Thu Oct 21 21:31:39 2004 UTC vs.
branches/new_design/OOPSE-3.0/src/math/RectMatrix.hpp (file contents), Revision 1816 by tim, Wed Dec 1 19:10:51 2004 UTC

# Line 63 | Line 63 | namespace oopse {
63                          data_[i][j] = s;
64              }
65  
66 +            RectMatrix(Real* array) {
67 +                for (unsigned int i = 0; i < Row; i++)
68 +                    for (unsigned int j = 0; j < Col; j++)
69 +                        data_[i][j] = array[i * Row + j];
70 +            }
71 +
72              /** copy constructor */
73              RectMatrix(const RectMatrix<Real, Row, Col>& m) {
74                  *this = m;
# Line 86 | Line 92 | namespace oopse {
92               * Return the reference of a single element of this matrix.
93               * @return the reference of a single element of this matrix
94               * @param i row index
95 <             * @param j colum index
95 >             * @param j Column index
96               */
97              Real& operator()(unsigned int i, unsigned int j) {
98                  //assert( i < Row && j < Col);
# Line 97 | Line 103 | namespace oopse {
103               * Return the value of a single element of this matrix.
104               * @return the value of a single element of this matrix
105               * @param i row index
106 <             * @param j colum index
106 >             * @param j Column index
107               */        
108              Real operator()(unsigned int i, unsigned int j) const  {
109                  
110                  return data_[i][j];  
111              }
112  
113 +            /**
114 +             * Copy the internal data to an array
115 +             * @param array the pointer of destination array
116 +             */
117 +            void getArray(Real* array) {
118 +                for (unsigned int i = 0; i < Row; i++) {
119 +                    for (unsigned int j = 0; j < Col; j++) {
120 +                        array[i * Row + j] = data_[i][j];
121 +                    }
122 +                }
123 +            }
124 +
125 +
126              /** Returns the pointer of internal array */
127              Real* getArrayPointer() {
128                  return &data_[0][0];
# Line 139 | Line 158 | namespace oopse {
158               * @return a column of  this matrix as a vector
159               * @param col the column index
160               */                
161 <            Vector<Real, Col> getColum(unsigned int col) {
161 >            Vector<Real, Col> getColumn(unsigned int col) {
162                  Vector<Real, Col> v;
163  
164                  for (unsigned int j = 0; j < Col; j++)
# Line 153 | Line 172 | namespace oopse {
172               * @param col the column index
173               * @param v the vector to be set
174               */                
175 <             void setColum(unsigned int col, const Vector<Real, Col>& v){
175 >             void setColumn(unsigned int col, const Vector<Real, Col>& v){
176  
177                  for (unsigned int j = 0; j < Col; j++)
178                      data_[j][col] = v[j];
# Line 172 | Line 191 | namespace oopse {
191              }
192  
193             /**
194 <             * swap two colums of this matrix
195 <             * @param i the first colum
196 <             * @param j the second colum
194 >             * swap two Columns of this matrix
195 >             * @param i the first Column
196 >             * @param j the second Column
197               */
198 <            void swapColum(unsigned int i, unsigned int j){
198 >            void swapColumn(unsigned int i, unsigned int j){
199                      assert(i < Col && j < Col);
200                      
201                      for (unsigned int k = 0; k < Row; k++)
# Line 346 | Line 365 | namespace oopse {
365              }
366  
367              /** Return the transpose of this matrix */
368 <            RectMatrix<Real,  Col, Row> transpose(){
368 >            RectMatrix<Real,  Col, Row> transpose() const{
369                  RectMatrix<Real,  Col, Row> result;
370                  
371                  for (unsigned int i = 0; i < Row; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines