Help with arrays

I came across some C++ code that I wanted to use in my Python program, the conversion was fairly straightforward until the following:

void ComputeFeedForwardSignals(double* MAT_INOUT,double* V_IN,double* V_OUT, double* V_BIAS,int size1,int size2,int layer)
{
int row,col;
for(row=0;row < size2; row++)
{
V_OUT[row]=0.0;
for(col=0;col<size1;col++)V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)*V_IN[col]);
V_OUT[row]+=V_BIAS[row];
if(layer==0) V_OUT[row] = logistic(V_OUT[row]);
if(layer==1) V_OUT[row] = logistic(V_OUT[row]);
}
}

Mostly, it's just the line:
V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)*V_IN[col]);

What exactly is this line doing? MAT_INOUT is an array[20][16].
What is the '*' doing there all by itself at the begining?

Any help or even a link to any helpful info would be appreciated. I tried searching, but most likely using the wrong search terms.

Thanks
Those variables are pointers something native in C++ but not Python.
1
2
3
4
double* MAT_INOUT
double* V_IN
double* V_OUT
double* V_BIAS


*(MAT_INOUT+(row*size1)+col) is a pointer to a place in memory. I suggest reading:
http://www.cplusplus.com/doc/tutorial/pointers/
Last edited on
Ahhh! Thanks much, I think I understand now.

Years of experience googling for answers, this was actually the first time I've broken down and actually asked for help. Your reply was quick and informative! Thanks again.
You're welcome. Thats why we are here. :)
Topic archived. No new replies allowed.