xwxt

C++ Function Reference

1 Signature

Eigen::MatrixXd BigDataStatMeth::xwxt(const Eigen::MatrixXd &X, const Eigen::MatrixXd &w)

2 Description

Compute weighted cross-product XwX’.

3 Parameters

  • X (const Eigen::MatrixXd &): Input matrix
  • w (const Eigen::MatrixXd &): Weight matrix

4 Returns

Weighted cross-product XwX’

5 Details

Computes the weighted cross-product of a matrix with its transpose, where w is a diagonal weight matrix.

6 Source Code

File: inst/include/memAlgebra/memOptimizedProducts.hppLines 212-218

inline Eigen::MatrixXd xwxt(const Eigen::MatrixXd& X, const Eigen::MatrixXd& w) 
{
    const int n(X.rows());
    Eigen::MatrixXd XwXt(Eigen::MatrixXd(n, n).setZero().
                             selfadjointView<Eigen::Lower>().rankUpdate(X * w.array().sqrt().matrix().asDiagonal()));
    return (XwXt);
}

7 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = xwxt(...);