Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/matrix.h
[mareframe] / trunk / gadget / matrix.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/matrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (view) (download)

1 : ulcessvp 2 #ifndef matrix_h
2 :     #define matrix_h
3 :    
4 :     //#include "doublevector.h"
5 :     #include "intvector.h"
6 :     #include "doublematrix.h"
7 :    
8 :     /**
9 :     * \class Matrix
10 :     * \brief This class implements a Matrix
11 :     */
12 :     class Matrix {
13 :     public:
14 :     /**
15 :     * \brief This is the default DoubleMatrix constructor
16 :     */
17 :     Matrix() {
18 :     nrow = 0;
19 :     ncol = 0;
20 :     m = 0;
21 :     }
22 :     ;
23 :     /**
24 :     * \brief This is the DoubleMatrix constructor for a specified size
25 :     * \param nr is the size of the vector to be created
26 :     * \param nc is the length of each row to be created (ie. the size of the DoubleVector to be created for each row)
27 :     * \param initial is the initial value for all the entries of the vector
28 :     */
29 :     Matrix(int nr, int nc, double initial);
30 :     /**
31 :     * \brief This is the DoubleMatrix constructor that creates a copy of an existing DoubleMatrix
32 :     * \param initial is the DoubleMatrix to copy
33 :     */
34 :     //TODO OJO
35 :     //Matrix(const DoubleMatrix& initial);
36 :     /**
37 :     * \brief This is the DoubleMatrix destructor
38 :     * \note This will free all the memory allocated to all the elements of the vector
39 :     */
40 :     ~Matrix();
41 :     /**
42 :     * \brief This will return the number of columns in row i of the vector
43 :     * \param i is the row of the vector to have the number of columns counted
44 :     * \return the number of columns in row i of the vector
45 :     * \note This is the number of entries in the DoubleVector that is entry i of the DoubleMatrix
46 :     */
47 :     // int Ncol(int i = 0) const { return v[i]->Size(); };
48 :     /**
49 :     * \brief This will return the number of rows of the vector
50 :     * \return the number of rows of the vector
51 :     */
52 :     int Nrow() const {
53 :     return nrow;
54 :     }
55 :     ;
56 :     /**
57 :     * \brief This will return the value of an element of the vector
58 :     * \param pos is the element of the vector to be returned
59 :     * \return the value of the specified element
60 :     */
61 :    
62 :     int Ncol() const {
63 :     return ncol;
64 :     }
65 :     ;
66 :    
67 :     // double** GetMatrix () const { return m;};
68 :     double* operator [] (int i) { return m + (i*ncol); };
69 :    
70 :     const double* operator [] (int i) const { return m + (i*ncol); };
71 :     /**
72 :     * \brief This will return the value of an element of the vector
73 :     * \param pos is the element of the vector to be returned
74 :     * \return the value of the specified element
75 :     */
76 :     // const DoubleVector& operator [] (int pos) const { return *v[pos]; };
77 :     /**
78 :     * \brief This will add new entries to the vector
79 :     * \param add is the number of new entries to the vector
80 :     * \param length is the number of entries to the DoubleVector that is created
81 :     * \param value is the value that will be entered for the new entries
82 :     */
83 :     void AddRows(int add, int length, double value);
84 :     /**
85 :     * \brief This will delete an entry from the vector
86 :     * \param pos is the element of the vector to be deleted
87 :     * \note This will free the memory allocated to the deleted element of the vector
88 :     */
89 :     // void Delete(int pos);
90 :     /**
91 :     * \brief This will reset the vector
92 :     * \note This will delete every entry from the vector and set the number of rows to zero
93 :     */
94 :     void Reset();
95 : ulcessvp 5
96 :     //FIXME: doc
97 :     void Initialize(int nr, int nc, double initial);
98 : ulcessvp 2 /**
99 :     * \brief This function will set all of the entries of the vector to zero
100 :     */
101 :     void setToZero();
102 :     /**
103 :     * \brief This function will print the data stored in the vector
104 :     * \param outfile is the ofstream that all the model information gets sent to
105 :     */
106 :     void Print(ofstream& outfile) const;
107 :     /**
108 :     * \brief This operator will set the vector equal to an existing DoubleMatrix
109 :     * \param d is the DoubleMatrix to copy
110 :     */
111 :     // Matrix& operator = (const Matrix& d);
112 :     // double GetValue(int i, int j) const {
113 :     // return m[i * ncol + j];
114 :     // }
115 :     // ;
116 :     //
117 :     // void SetValue(int i, int j, double value) const {
118 :     // m[i * ncol + j] = value;
119 :     // }
120 :     // ;
121 :    
122 :     protected:
123 :     /**
124 :     * \brief This is number of rows of the vector
125 :     */
126 :     int nrow;
127 :     int ncol;
128 : ulcessvp 5
129 :     //FIXME: doc
130 : ulcessvp 2 /**
131 :     * \brief This is the vector of DoubleVector values
132 :     */
133 :     //DoubleVector** v;
134 :     //double** v;
135 :     double *m;
136 :     };
137 :    
138 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge