Skip to content

Commit

Permalink
[NDMatrix] Added Comments to NDMatrixProxy
Browse files Browse the repository at this point in the history
Added comments based on Vaughn's suggestions.
  • Loading branch information
AlexandreSinger committed Nov 28, 2024
1 parent 569873f commit a2be7c5
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions libs/libvtrutil/src/vtr_ndmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class NdMatrixProxy {
* @brief Construct a matrix proxy object
*
* @param dim_sizes: Array of dimension sizes
* @param idim: The dimension associated with this proxy
* @param dim_stride: The stride of this dimension (i.e. how many element in memory between indicies of this dimension)
* @param start: Pointer to the start of the sub-matrix this proxy represents
* @param offset: The offset from the start that this sub-matrix starts at.
* @param start: Pointer to the start of the base NDMatrix of this proxy
*/
NdMatrixProxy(const size_t* dim_sizes, const size_t* dim_strides, size_t offset, const std::unique_ptr<T[]>& start)
: dim_sizes_(dim_sizes)
Expand Down Expand Up @@ -62,9 +62,21 @@ class NdMatrixProxy {
}

private:
/// @brief The sizes of each dimension of this proxy. This is an array of
/// length N.
const size_t* dim_sizes_;

/// @brief The stride of each dimension of this proxy. This is an array of
/// length N.
const size_t* dim_strides_;

/// @brief The offset from the base NDMatrix object that this sub-matrix
/// starts at.
size_t offset_;

/// @brief The pointer to the start of the base NDMatrix data. Since the
/// base NDMatrix object owns the memory, we hold onto a reference
/// to its unique pointer. This is safer than passing a bare pointer.
const std::unique_ptr<T[]>& start_;
};

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

private:
/// @brief The sizes of each dimension of this proxy. This is an array of
/// length N.
const size_t* dim_sizes_;

/// @brief The stride of each dimension of this proxy. This is an array of
/// length N.
const size_t* dim_strides_;

/// @brief The offset from the base NDMatrix object that this sub-matrix
/// starts at.
size_t offset_;

/// @brief The pointer to the start of the base NDMatrix data. Since the
/// base NDMatrix object owns the memory, we hold onto a reference
/// to its unique pointer. This is safer than passing a bare pointer.
const std::unique_ptr<T[]>& start_;
};

Expand Down

0 comments on commit a2be7c5

Please sign in to comment.