divideDiagonals

C++ Function Reference

1 Signature

void BigDataStatMeth::DiagonalOps::divideDiagonals(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 processing
  • threads (Rcpp::Nullable< int >): Number of threads for parallel processing

4 Details

Performs optimized diagonal division C_diag = A_diag / B_diag. Same optimization strategy as addDiagonals but for element-wise division. Division by zero follows IEEE 754 standard (results in infinity).

5 Call Graph

Function dependencies

6 Source Code

File: inst/include/hdf5Utilities/hdf5DiagonalMethods.hppLines 509-528

inline void divideDiagonals(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_divide_hdf5(dsA, dsB, targetDataset, bparal, threads);
                } else if (isVectorA && isVectorB && target == "new") {
                    Rcpp_vector_divide_hdf5(dsA, dsB, dsResult, bparal, threads);
                } else {
                    performMatrixDiagonalOperation(dsA, dsB, dsResult, 3, target, bparal, threads);
                }
            } catch(std::exception& ex) {
                Rf_error("Error in divideDiagonals: %s", ex.what());
            }
        }

7 Usage Example

#include "BigDataStatMeth.hpp"

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