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/doublematrix.h
[mareframe] / trunk / gadget / doublematrix.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/doublematrix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

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

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

Powered By FusionForge