Hello, Amina.
Firstly, why are you even passing in a if b contains the proper dimensions.
It's not like you are using a.
Secondly, and more importantly, once you provided the r code, you can see
that this is **EXACTLY** the problem you asked on September 26 of this
year, see
http://lists.r-forge.
Hi Amina,
Looks like you want us to do your homework, right? ;)
Pay attention to subscript translation from R to C:
c[i-1, j, k-1] * b[i, j]
vs
c(i-1, j, k) *b(i, j)
Can you see the difference?
Best,
Serguei.
Le 14/12/2016 à 07:46, Amina Shahzadi a écrit :
Oh sorry. No. of columns in b and
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
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