Revision 1343 trunk/src/linad99/fvar_m22.cpp
fvar_m22.cpp (revision 1343)  

18  18 
* \param 
19  19 
*/ 
20  20 
dvar_vector operator*(const dvar_matrix& m, const dvar_vector& x) 
21 
{


22 
RETURN_ARRAYS_INCREMENT();


21 
{ 

22 
RETURN_ARRAYS_INCREMENT(); 

23  23  
24 
if (x.indexmin() != m.colmin()  x.indexmax() != m.colmax())


25 
{


24 
if (x.indexmin() != m.colmin()  x.indexmax() != m.colmax()) 

25 
{ 

26  26 
cerr << " Incompatible array bounds in dvar_vector operator*(const dvar_matrix& m, const dvar_vector& x)\n"; 
27  27 
ad_exit(21); 
28 
}


28 
} 

29  29  
30 
kkludge_object kkk; 

31 
dvar_vector tmp(m.rowmin(),m.rowmax(),kkk); 

32 
double sum; 

33  
34 
for (int i=m.rowmin(); i<=m.rowmax(); i++) 

35 
{ 

36 
sum=0.0; 

37 
for (int j=x.indexmin(); j<=x.indexmax(); j++) 

38 
{ 

30 
kkludge_object kkk; 

31 
dvar_vector tmp(m.rowmin(),m.rowmax(),kkk); 

32 
for (int i=m.rowmin(); i<=m.rowmax(); i++) 

33 
{ 

34 
double sum = 0.0; 

35 
for (int j=x.indexmin(); j<=x.indexmax(); j++) 

36 
{ 

39  37 
//sum+=m[i][j]*x[j]; 
40  38 
sum+=(m.elem(i)).elem_value(j)*x.elem_value(j); 
41 
}


42 
tmp.elem_value(i)=sum;


43 
}


39 
} 

40 
tmp.elem_value(i)=sum; 

41 
} 

44  42 
save_identifier_string("PLACE4"); 
45  43 
x.save_dvar_vector_value(); 
46  44 
x.save_dvar_vector_position(); 
...  ...  
52  50 
save_identifier_string("PLACE1"); 
53  51 
gradient_structure::GRAD_STACK1> 
54  52 
set_gradient_stack(dmdv_prod); 
55 
RETURN_ARRAYS_DECREMENT();


56 
return(tmp);


57 
}


53 
RETURN_ARRAYS_DECREMENT(); 

54 
return(tmp); 

55 
} 

58  56  
59  57 
/** 
60  58 
* Description not yet available. 
...  ...  
78  76 
dfm.initialize(); 
79  77 
dfx.initialize(); 
80  78  
81 
double dfsum; 

82 
for (int i=m.rowmax(); i>=m.rowmin(); i) 

83 
{ 

84 
// tmp.elem_value(i)=sum; 

85 
dfsum=dftmp.elem(i); 

86 
for (int j=x.indexmax(); j>=x.indexmin(); j) 

87 
{ 

88 
//sum+=(m.elem(i)).elem_value(j)*x.elem_value(j); 

89 
dfm.elem(i,j)+=dfsum*x.elem(j); 

90 
dfx.elem(j)+=dfsum*m.elem(i,j); 

91 
} 

92 
//sum=0.0; 

93 
dfsum=0.0; 

94 
} 

95 
dfx.save_dvector_derivatives(x_pos); 

96 
dfm.save_dmatrix_derivatives(m_pos); 

79 
for (int i=m.rowmax(); i>=m.rowmin(); i) 

80 
{ 

81 
//tmp.elem_value(i)=sum; 

82 
double dfsum=dftmp.elem(i); 

83 
for (int j=x.indexmax(); j>=x.indexmin(); j) 

84 
{ 

85 
//sum+=(m.elem(i)).elem_value(j)*x.elem_value(j); 

86 
dfm.elem(i,j)+=dfsum*x.elem(j); 

87 
dfx.elem(j)+=dfsum*m.elem(i,j); 

88 
} 

89 
//sum=0.0; 

90 
dfsum=0.0; 

91 
} 

92 
dfx.save_dvector_derivatives(x_pos); 

93 
dfm.save_dmatrix_derivatives(m_pos); 

97  94 
} 
98  95  
99  96 
/** 
Also available in: Unified diff