RcppTypifyNormalizeHdf5
C++ Function Reference
1 Signature
void BigDataStatMeth::RcppTypifyNormalizeHdf5(BigDataStatMeth::hdf5Dataset *dsA, bool bc, bool bs, bool bbyrows)2 Parameters
dsA(BigDataStatMeth::hdf5Dataset *)bc(bool)bs(bool)bbyrows(bool)
3 Call Graph
4 Source Code
NoteImplementation
File: inst/include/hdf5Algebra/matrixNormalization.hpp • Lines 490-566
inline void RcppTypifyNormalizeHdf5( BigDataStatMeth::hdf5Dataset* dsA,
bool bc, bool bs, bool bbyrows)
{
try{
// BigDataStatMeth::hdf5Dataset* dsmean = nullptr;
// BigDataStatMeth::hdf5Dataset* dssd = nullptr;
// BigDataStatMeth::hdf5Dataset* dsNormal = nullptr;
std::unique_ptr<BigDataStatMeth::hdf5Dataset> dsmean(nullptr);
std::unique_ptr<BigDataStatMeth::hdf5Dataset> dssd(nullptr);
std::unique_ptr<BigDataStatMeth::hdf5Dataset> dsNormal(nullptr);
Rcpp::Nullable<int> wsize = R_NilValue;
Eigen::MatrixXd datanormal;
hsize_t nrows, ncols;
std::string strgroupout;
bool corrected = true;
nrows = dsA->nrows();
ncols = dsA->ncols();
strgroupout = "NORMALIZED_T/" + dsA->getGroupName();
std::string strgroupout_ms = strgroupout + "/mean_sd";
std::string strdatasetmean = "mean." + dsA->getDatasetName();
std::string strdatasetsd = "sd." + dsA->getDatasetName();
// Define blocksize atending number of elements in rows and cols
if( bbyrows == false) {
datanormal = Eigen::MatrixXd::Zero(2,nrows);
get_HDF5_mean_sd_by_column( dsA, datanormal, true, true, wsize);
} else {
datanormal = Eigen::MatrixXd::Zero(2,ncols);
get_HDF5_mean_sd_by_row( dsA, datanormal, true, true, wsize);
}
// dsmean = new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout_ms, strdatasetmean, true);
dsmean.reset(new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout_ms, strdatasetmean, true));
dsmean->inheritCompressionLevel(dsA->getCompressionLevel());
dsmean->createDataset( datanormal.cols(), 1, "real");
dsmean->writeDataset( Rcpp::wrap(datanormal.row(0)) );
// delete dsmean; dsmean = nullptr;
// dssd = new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout_ms, strdatasetsd, true);
dssd.reset(new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout_ms, strdatasetsd, true));
dssd->inheritCompressionLevel(dsA->getCompressionLevel());
dssd->createDataset( datanormal.cols(), 1, "real");
dssd->writeDataset( Rcpp::wrap(datanormal.row(1)) );
// delete dssd; dssd = nullptr;
// dsNormal = new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout, dsA->getDatasetName(), true);
dsNormal.reset(new BigDataStatMeth::hdf5Dataset(dsA->getFullPath(), strgroupout, dsA->getDatasetName(), true));
dsNormal->inheritCompressionLevel(dsA->getCompressionLevel());
dsNormal->createDataset( dsA, "real");
if( dsA->getDatasetptr() != nullptr && dsNormal->getDatasetptr() != nullptr){
BigDataStatMeth::RcppNormalizeHdf5( dsA, dsNormal.get(), datanormal, wsize, bc, bs, bbyrows, corrected);
}
// delete dsNormal; dsNormal = nullptr;
} catch( H5::FileIException& error ) {
throw std::runtime_error("c++ exception RcppTypifyNormalizeHdf5 (File IException)");
} catch( H5::DataSetIException& error ) { // catch failure caused by the DataSet operations
throw std::runtime_error("c++ exception RcppTypifyNormalizeHdf5 (DataSet IException)");
} catch( H5::DataSpaceIException& error ) { // catch failure caused by the DataSpace operations
throw std::runtime_error("c++ exception RcppTypifyNormalizeHdf5 (DataSpace IException)");
} catch( H5::DataTypeIException& error ) { // catch failure caused by the DataSpace operations
throw std::runtime_error("c++ exception RcppTypifyNormalizeHdf5 (DataType IException)");
} catch(std::exception &ex) {
throw std::runtime_error(std::string("C++ exception RcppTypifyNormalizeHdf5: ") + ex.what());
} catch (...) {
throw std::runtime_error("C++ exception RcppTypifyNormalizeHdf5 (unknown reason)");
}
return void();
}5 Usage Example
#include "BigDataStatMeth.hpp"
// Example usage
auto result = RcppTypifyNormalizeHdf5(...);