Oh sorry. No. of columns in b and size of a must always be same.
I have made an r code to show the output.
a = c(1, 2, 3)
b = matrix(1:30, nrow=10, ncol=3)
c = array(as.double(0), dim=c(10, 3, 10))
for(i in 1:10){
for(j in 1:3){
for(k in 1:i){
if(k==1) c[i, j, k] = b[i, j]
else
On Wed, Dec 14, 2016 at 1:24 AM Amina Shahzadi
wrote:
> Hello Avraham --Happy to see you
>
> My code is trying to produce a cube c which is going to be constructed by
> a vector a and matrix b.
> And the number of rows in b and size of a must be same.
>
> So we can assume that if a is a vector of
Moving the call outside the main loop would be effective for some
scenarios (i.e, the scenarios where the data objects do not contain
NaNs). However, once they do we still want to compute a distance based
on the values and "correct" for the NaNs in some way, so skipping the
entire object is not
Hello Avraham --Happy to see you
My code is trying to produce a cube c which is going to be constructed by a
vector a and matrix b.
And the number of rows in b and size of a must be same.
So we can assume that if a is a vector of size 3, Then b must be 2 x 3 or 3
X 3 etc.
Thank you Avraham for q
On Tue, Dec 13, 2016 at 9:51 PM, Amina Shahzadi
wrote:
> Hello Friends and Prof. Dirk
>
> I am pasting here a code which has a for loop depending on another for
> loop.
> I am getting zeros for cube c. I tried and searched a lot but did not get
> an example of this type. Would you please help in
Hello Friends and Prof. Dirk
I am pasting here a code which has a for loop depending on another for
loop.
I am getting zeros for cube c. I tried and searched a lot but did not get
an example of this type. Would you please help in this regard?
#include
using namespace Rcpp;
using namespace RcppA
Thank you Dirk for all the help, it is very much appreciated.
I have made the changes you recommend and pushed them onto the GitHub page
(https://github.com/KhagayN/SeqLibr). I realized that the bwa directory isn't
necessary because src/SeqLib/bwa is an entire copy of it. I changed the
PKG_CPP
Could the c++ slowdown be due to the fact that Rinternals.h defines ISNAN
differently for C and C++? For C it uses the compiler's isnan macro, for
C++ it calls the function R_isnancpp.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Dec 13, 2016 at 5:04 AM, Christian Gunning wrote:
> > |
Thanks for posting here, and showing complete references. Your earlier
StackOverflow questions went nowhere. Hopefully we can tackle this here.
On 12 December 2016 at 17:32, khagay nagdimov wrote:
| I am trying to create a package that uses Rcpp to translate code from SeqLib
(
| https://github
> |for (i = 0; i < numObjects; i++) {
> | for (j = 0; j < numCodes; j++) {
> |dist = 0;
> |for (k = 0; k < numVars; k++) {
> | if (!ISNAN(data[i * numVars + k])) {
> |tmp = data[i * numVars + k] - codes[j * numVars + k];
>
> Why not drop data and codes
I’d be interesting to see what this more C++idomatic version would perform
nanCount = std::count_if( x.begin(), x.end(), ISNAN ) ;
Because despite all the inlining efforts that has been put in the
implementation of NumericVector, its operator[] might not perform as well as
using [] on a double
Here is a further reduced example (see below). Now it is a function to
count NaNs in a vector, and it shows the same behaviour. Code is also
available at
https://github.com/jwkruisselbrink/rcpp-timings/tree/master/minimal.
Regarding your question:
| Why not drop data and codes and use sData1(
12 matches
Mail list logo