Also note: you are doing things like:

Code:
double _Rp[9];
_Rp[9]=multiply_matrix_RP(Rp[0],Rp[1],Rp[2],Rp[3],Rp[4],Rp[5],Rp[6],Rp[7],Rp[8]);
But 9 is not a valid index for the _Rp array. The only valid indices are: 0,1,2,3,4,5,6,7,8