xtwx
C++ Function Reference
1 Signature
Eigen::MatrixXd BigDataStatMeth::xtwx(const Eigen::MatrixXd &X, const Eigen::MatrixXd &w)2 Description
Compute transposed weighted cross-product X’wX.
3 Parameters
X(const Eigen::MatrixXd &): Input matrixw(const Eigen::MatrixXd &): Weight matrix
4 Returns
Transposed weighted cross-product X’wX
5 Details
Computes the transposed weighted cross-product of a matrix, where w is a diagonal weight matrix.
6 Source Code
NoteImplementation
File: inst/include/memAlgebra/memOptimizedProducts.hpp • Lines 222-228
inline Eigen::MatrixXd xtwx(const Eigen::MatrixXd& X, const Eigen::MatrixXd& w)
{
const int n(X.cols());
Eigen::MatrixXd XtwX(Eigen::MatrixXd(n, n).setZero().
selfadjointView<Eigen::Lower>().rankUpdate(X.adjoint() * w.array().sqrt().matrix().asDiagonal()));
return (XtwX);
}7 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = xtwx(...);