powerDiagonals
C++ Function Reference
1 Signature
void BigDataStatMeth::DiagonalOps::powerDiagonals(BigDataStatMeth::hdf5Dataset *dsA, BigDataStatMeth::hdf5Dataset *dsB, BigDataStatMeth::hdf5Dataset *dsResult, std::string target="new", bool bparal=false, Rcpp::Nullable< int > threads=R_NilValue)2 Description
Divide diagonal elements from two matrices or vectors.
3 Parameters
dsA(BigDataStatMeth::hdf5Dataset *): First input dataset (dividend)dsB(BigDataStatMeth::hdf5Dataset *): Second input dataset (divisor)dsResult(BigDataStatMeth::hdf5Dataset *): Result dataset (will be created)target(std::string): Where to write result: “A”, “B”, or “new”bparal(bool): Whether to use parallel processingthreads(Rcpp::Nullable< int >): Number of threads for parallel processing
4 Details
Performs optimized diagonal power C_diag = A_diag ^ B_diag. Same optimization strategy as addDiagonals but for element-wise division.
5 Call Graph
6 Source Code
NoteImplementation
File: inst/include/hdf5Utilities/hdf5DiagonalMethods.hpp • Lines 545-564
inline void powerDiagonals(BigDataStatMeth::hdf5Dataset* dsA, BigDataStatMeth::hdf5Dataset* dsB,
BigDataStatMeth::hdf5Dataset* dsResult, std::string target = "new",
bool bparal = false, Rcpp::Nullable<int> threads = R_NilValue)
{
try {
bool isVectorA = isDiagonalVector(dsA);
bool isVectorB = isDiagonalVector(dsB);
if (isVectorA && isVectorB && (target == "A" || target == "B")) {
BigDataStatMeth::hdf5Dataset* targetDataset = (target == "A") ? dsA : dsB;
Rcpp_vector_power_hdf5(dsA, dsB, targetDataset, bparal, threads);
} else if (isVectorA && isVectorB && target == "new") {
Rcpp_vector_power_hdf5(dsA, dsB, dsResult, bparal, threads);
} else {
performMatrixDiagonalOperation(dsA, dsB, dsResult, 3, target, bparal, threads);
}
} catch(std::exception& ex) {
Rf_error("Error in powerDiagonals: %s", ex.what());
}
}7 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = powerDiagonals(...);