Skip to content

Commit a2be7c5

Browse files
[NDMatrix] Added Comments to NDMatrixProxy
Added comments based on Vaughn's suggestions.
1 parent 569873f commit a2be7c5

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

libs/libvtrutil/src/vtr_ndmatrix.h

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class NdMatrixProxy {
3030
* @brief Construct a matrix proxy object
3131
*
3232
* @param dim_sizes: Array of dimension sizes
33-
* @param idim: The dimension associated with this proxy
3433
* @param dim_stride: The stride of this dimension (i.e. how many element in memory between indicies of this dimension)
35-
* @param start: Pointer to the start of the sub-matrix this proxy represents
34+
* @param offset: The offset from the start that this sub-matrix starts at.
35+
* @param start: Pointer to the start of the base NDMatrix of this proxy
3636
*/
3737
NdMatrixProxy(const size_t* dim_sizes, const size_t* dim_strides, size_t offset, const std::unique_ptr<T[]>& start)
3838
: dim_sizes_(dim_sizes)
@@ -62,9 +62,21 @@ class NdMatrixProxy {
6262
}
6363

6464
private:
65+
/// @brief The sizes of each dimension of this proxy. This is an array of
66+
/// length N.
6567
const size_t* dim_sizes_;
68+
69+
/// @brief The stride of each dimension of this proxy. This is an array of
70+
/// length N.
6671
const size_t* dim_strides_;
72+
73+
/// @brief The offset from the base NDMatrix object that this sub-matrix
74+
/// starts at.
6775
size_t offset_;
76+
77+
/// @brief The pointer to the start of the base NDMatrix data. Since the
78+
/// base NDMatrix object owns the memory, we hold onto a reference
79+
/// to its unique pointer. This is safer than passing a bare pointer.
6880
const std::unique_ptr<T[]>& start_;
6981
};
7082

@@ -77,7 +89,8 @@ class NdMatrixProxy<T, 1> {
7789
*
7890
* @param dim_sizes: Array of dimension sizes
7991
* @param dim_stride: The stride of this dimension (i.e. how many element in memory between indicies of this dimension)
80-
* @param start: Pointer to the start of the sub-matrix this proxy represents
92+
* @param offset: The offset from the start that this sub-matrix starts at.
93+
* @param start: Pointer to the start of the base NDMatrix of this proxy
8194
*/
8295
NdMatrixProxy(const size_t* dim_sizes, const size_t* dim_stride, size_t offset, const std::unique_ptr<T[]>& start)
8396
: dim_sizes_(dim_sizes)
@@ -122,9 +135,21 @@ class NdMatrixProxy<T, 1> {
122135
}
123136

124137
private:
138+
/// @brief The sizes of each dimension of this proxy. This is an array of
139+
/// length N.
125140
const size_t* dim_sizes_;
141+
142+
/// @brief The stride of each dimension of this proxy. This is an array of
143+
/// length N.
126144
const size_t* dim_strides_;
145+
146+
/// @brief The offset from the base NDMatrix object that this sub-matrix
147+
/// starts at.
127148
size_t offset_;
149+
150+
/// @brief The pointer to the start of the base NDMatrix data. Since the
151+
/// base NDMatrix object owns the memory, we hold onto a reference
152+
/// to its unique pointer. This is safer than passing a bare pointer.
128153
const std::unique_ptr<T[]>& start_;
129154
};
130155

0 commit comments

Comments
 (0)