Comments (8)
Hi Florian,
Thank you very much for taking a look. I just committed the changes. I suspect the error is due to the behavior of "XPtr", since there are some key words "PreserveStorage", "standard_delete_finalizer", etc.
__Z11get_elem_bmIdEdN4Rcpp4XPtrI9BigMatrixNS0_15PreserveStorageEXadL_ZNS0_25standard_delete_finalizerIS2_EEvPT_EEEEddii
from biglasso.
You don't have any R/RcppExports.R and src/RcppExports.cpp?
It seems you're making your package "the old way". How do you compile and install your package?
from biglasso.
No, I don't. I used to have RcppExports.cpp, but later combined them into .cpp files. RcppExports.R file just include wrapper R functions for .Call(). The previous version (before adding templates) works well. So I am not sure whether having those RcppExports files make a difference.
I compile and install the package using R CMD commands.
from biglasso.
I've tried to pass the accessor with the pointer as argument as it is done there.
You can compare the codes there.
But it doesn't seem to change a thing.
One thing I don't understand is why your utilities.cpp
has
// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
while it seems to be modified by hand.
Moreover, I'm currently on Windows, which doesn't help with the debugging.
from biglasso.
Thanks for giving a try! I just did exactly the same thing, and failed too.
I think the return type of functions like cd_gaussian_fit_cpp()
should be Rcpp::List
, not SEXP
. So I changed that, but didn't help.
I also followed the link you pointed out but NOT passing matrix accessor as an argument, instead calling function like BigColSums(xpMat) and it WORKED! (See code below, that code works!!!!!!!)
So really confused about where the bug is!!!!!!!!!
// Logic for BigColSums.
template <typename T>
vector<int> BigColSums2(XPtr<BigMatrix> pMat) {
// Create the vector we'll store the column sums in.
MatrixAccessor<T> mat(*pMat);
vector<int> colSums(pMat->ncol());
for (size_t i=0; i < pMat->ncol(); i++) {
for (size_t j=0; j < pMat->ncol(); j++) {
colSums[i] += mat[i][j];
}
}
return colSums;
}
// Dispatch function for BigColSums
//
// [[Rcpp::export]]
NumericVector BigColSums(SEXP pBigMat) {
// First we have to tell Rcpp what class to use for big.matrix objects.
// This object stores the attributes of the big.matrix object passed to it
// by R.
XPtr<BigMatrix> xpMat(pBigMat);
// To access values in the big.matrix, we need to create a MatrixAccessor
// object of the appropriate type. Note that in every case we are still
// returning a NumericVector: this is because big.matrix objects only store
// numeric values in R, even if their type is set to 'char'. The types
// simply correspond to the number of bytes used for each element.
switch(xpMat->matrix_type()) {
case 1:
return Rcpp::wrap(BigColSums2<char>(xpMat));
case 2:
return Rcpp::wrap(BigColSums2<short>(xpMat));
case 4:
return Rcpp::wrap(BigColSums2<int>(xpMat));
case 8:
return Rcpp::wrap(BigColSums2<double>(xpMat));
// case 1:
// return BigColSums<char>(xpMat);
// case 2:
// return BigColSums<short>(xpMat);
// case 4:
// return BigColSums<int>(xpMat);
// case 8:
// return BigColSums<double>(xpMat);
default:
// This case should never be encountered unless the implementation of
// big.matrix changes, but is necessary to implement shut up compiler
// warnings.
throw Rcpp::exception("unknown type detected for big.matrix object!");
}
}
from biglasso.
BTW, I removed the header lines in utilities.cpp
as you pointed out. Sorry for the confusion. As you know, this file was previously automatically generated, but later I decided not to have RcppExports and just made manually changes in this file.
from biglasso.
Last guess for me.
Do the functions in utilities.cpp
need dispatchers too?
from biglasso.
I don't think so. See here https://github.com/aloysius-lim/bigrf/blob/master/src/growtree.cpp
from biglasso.
Related Issues (20)
- Automatically detect and cast variables to expected type(s) HOT 4
- standardize = FALSE ?
- predict.cv.biglasso - address 0x2b2da5f69ae0, cause 'memory not mapped' HOT 2
- Dealing with Extremely large datasets (750 GB) HOT 6
- Bug in cv.biglasso() triggered by edge case HOT 1
- Split available cores in cv.biglasso() HOT 1
- Rigorous LASSO and causal inference HOT 1
- Disabling intercept HOT 1
- Warning: stack imbalance
- Error R_Reprotect: only x protected items, can't reprotect index y HOT 3
- row.idx doesn't work ?
- Default CV error contradictory documentation HOT 1
- Installation error on CRAN HOT 3
- Cross validation tests failing HOT 3
- Removed from CRAN HOT 1
- Update benchmarks
- .
- data storage mode affects model fit -- why??
- are NCV penalties working correctly? HOT 2
- bug in setupX? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biglasso.