31using EigenMatrix = Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>;
33using ConstEigenMatrix = Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>;
38 :
ValArray<T>(numRows, numCols, numPages)
62 :
ValArray<T>(numRows, numCols, values)
76 const std::valarray<T>& values)
77 :
ValArray<T>(numRows, numCols, numPages, values)
85 std::valarray<T>&& values)
86 :
ValArray<T>(numRows, numCols, numPages,
std::move(values))
99 for (
size_t page = 0; page < res.m_numPages; ++page)
103 ConstEigenMatrix<T> lhsEigenMatrix(GetPagePtr(page), m_numRows, m_numCols);
105 EigenMatrix<T> resEigenMatrix(res.GetPagePtr(page), res.m_numRows, res.m_numCols);
106 resEigenMatrix = lhsEigenMatrix * rhsEigenMatrix;
110 size_t matrixOffset = page * m_numRows * m_numCols;
112 for (
size_t i = 0; i < res.m_numRows; ++i)
114 for (
size_t j = 0; j < res.m_numCols; ++j)
116 res(i, j, page) = (m_values[std::slice(matrixOffset + i, m_numCols, m_numRows)] *
137 for (
size_t page = 0; page < m_numPages; ++page)
141 ConstEigenMatrix<T> thisMatrix(GetPagePtr(page), m_numRows, m_numCols);
142 EigenMatrix<T> resEigenMatrix(res.GetPagePtr(page), res.m_numRows, res.m_numCols);
143 resEigenMatrix = thisMatrix.transpose();
147 size_t matrixIndex = page * m_numRows * m_numCols;
148 for (
size_t i = 0; i < m_numRows; ++i)
150 res.m_values[std::slice(matrixIndex + i * res.m_numRows, res.m_numRows, 1)] =
151 m_values[std::slice(matrixIndex + i, m_numCols, m_numRows)];
165 "The left and right MatrixArray should have only one page.");
167 "Left vector numCols and this MatrixArray numRows mismatch.");
169 "Right vector numRows and this MatrixArray numCols mismatch.");
179 for (
size_t page = 0; page < m_numPages; ++page)
183 ConstEigenMatrix<T> matrixEigen(GetPagePtr(page), m_numRows, m_numCols);
184 EigenMatrix<T> resEigenMap(res.GetPagePtr(page), res.m_numRows, res.m_numCols);
186 resEigenMap = lMatrixEigen * matrixEigen * rMatrixEigen;
190 size_t matrixOffset = page * m_numRows * m_numCols;
191 for (
size_t resRow = 0; resRow < res.m_numRows; ++resRow)
193 for (
size_t resCol = 0; resCol < res.m_numCols; ++resCol)
197 std::valarray<T> interRes(m_numCols);
198 for (
size_t thisCol = 0; thisCol < m_numCols; ++thisCol)
203 m_values[std::slice(matrixOffset + thisCol * m_numRows, m_numRows, 1)])
207 res(resRow, resCol, page) =
219template <
bool EnableBool,
typename>
225 for (
size_t index = 0; index < this->
GetSize(); ++index)
MatrixArray class inherits ValArray class and provides additional interfaces to ValArray which enable...
MatrixArray< T > HermitianTranspose() const
Function that performs the Hermitian transpose of this MatrixArray and returns a new matrix that is t...
MatrixArray< T > operator*(const T &rhs) const
Element-wise multiplication with a scalar value.
MatrixArray< T > Transpose() const
This operator interprets the 3D array as an array of matrices, and performs a linear algebra operatio...
MatrixArray< T > MultiplyByLeftAndRightMatrix(const MatrixArray< T > &lMatrix, const MatrixArray< T > &rMatrix) const
Multiply each matrix in the array by the left and the right matrix.
ValArray is a class to efficiently store 3D array.
T * GetPagePtr(size_t pageIndex)
Get a data pointer to a specific 2D array for use in linear algebra libraries.
size_t m_numCols
The size of the second dimension, i.e., the number of columns of each 2D array.
std::valarray< T > m_values
The data values.
size_t m_numRows
The size of the first dimension, i.e., the number of rows of each 2D array.
size_t m_numPages
The size of the third dimension, i.e., the number of 2D arrays.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr, bool isAmpdu)
Return the total size of the packet after WifiMacHeader and FCS trailer have been added.