Rcpp_matrixVectorPow_byRow

C++ Function Reference

1 Signature

Eigen::MatrixXd BigDataStatMeth::Rcpp_matrixVectorPow_byRow(Eigen::MatrixXd X, Eigen::VectorXd v)

2 Description

Matrix-vector power by rows.

3 Parameters

  • X (Eigen::MatrixXd): Input matrix
  • v (Eigen::VectorXd): Input vector

4 Returns

Result of row-wise power

5 Details

Divides each row of a matrix by a vector element-wise.

6 Caller Graph

Function dependencies

7 Source Code

File: inst/include/hdf5Algebra/vectormatrix.hppLines 105-112

inline Eigen::MatrixXd Rcpp_matrixVectorPow_byRow(Eigen::MatrixXd X, Eigen::VectorXd v) {
    for (int col = 0; col < X.cols(); ++col) {
        X.col(col) = X.col(col).array().unaryExpr(
            [&v, col](double x) { return std::pow(x, v(col)); }
        );
    }
    return(X);
}

8 Usage Example

#include "BigDataStatMeth.hpp"

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