<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=344165414-01052005><FONT face=Arial color=#0000ff size=2>Cause 
different parameters might have different degrees of influence and the scales 
are used to dictate those degrees. So a large scale for a paramter will restrict 
influence of that parameter. See Page 268 of the SoftwareGuide2.0 at <A 
href="http://itk.org/HTML/Documentation.htm">http://itk.org/HTML/Documentation.htm</A></FONT></SPAN></DIV>
<DIV><SPAN class=344165414-01052005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN 
class=344165414-01052005><FONT><!--StartFragment --></FONT></SPAN><SPAN 
class=344165414-01052005><FONT face=Arial color=#0000ff 
size=2>Thanks</FONT></SPAN></DIV>
<DIV><SPAN class=344165414-01052005><FONT face=Arial color=#0000ff 
size=2>kk</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> 
  insight-users-bounces@itk.org [mailto:insight-users-bounces@itk.org]<B>On 
  Behalf Of </B>ׯÏź£(Xiahai Zhuang)<BR><B>Sent:</B> Sunday, May 01, 2005 5:00 
  AM<BR><B>To:</B> insight-users@itk.org<BR><B>Subject:</B> [Insight-users] 
  AdvanceOneStep in 
  ClassGradientDescentOptimizer(itkGradientDescentOptimizer.cpp)<BR><BR></FONT></DIV>
  <DIV>/**</DIV>
  <DIV>&nbsp;*&nbsp;Advance&nbsp;one&nbsp;Step&nbsp;following&nbsp;the&nbsp;gradient&nbsp;direction</DIV>
  <DIV>&nbsp;*/</DIV>
  <DIV>&nbsp;&nbsp;typedef&nbsp;Array&lt; double&gt; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ParametersType;</DIV>
  <DIV>&nbsp;ParametersType&nbsp;m_currentPosition;</DIV>
  <DIV>void</DIV>
  <DIV>GradientDescentOptimizer</DIV>
  <DIV>::AdvanceOneStep(&nbsp;void&nbsp;)</DIV>
  <DIV>{&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;itkDebugMacro("AdvanceOneStep");</DIV>
  <DIV>.....</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;ScalesType&nbsp;scales&nbsp;=&nbsp;this-&gt; 
  GetScales();</DIV>
  <DIV>...</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;DerivativeType&nbsp;transformedGradient(&nbsp;spaceDimension&nbsp;);&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;for(unsigned&nbsp;int&nbsp;j&nbsp;=&nbsp;0;&nbsp;j&nbsp;&lt; 
  &nbsp;spaceDimension;&nbsp;j++)</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;{</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;transformedGradient[j]&nbsp;=&nbsp;m_Gradient[j]&nbsp;/&nbsp;scales[j];&nbsp;//<FONT 
  style="BACKGROUND-COLOR: #ffff00" 
  color=#ff0000>??????????????????????&nbsp;why&nbsp;here&nbsp;takes&nbsp;a&nbsp;(/scales[j])</FONT></DIV>
  <DIV><FONT color=#ff0000>&nbsp;<FONT 
  color=#000000>&nbsp;&nbsp;&nbsp;}</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;//as&nbsp;in&nbsp;method&nbsp;m_CostFunction-&gt; 
  GetValueAndDerivative(this-&gt; GetCurrentPosition(),&nbsp;m_Value, 
  m_Gradient&nbsp;)m_Gradient&nbsp;derivative</FONT></DIV>
  <DIV><FONT 
  color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  // m_Gradient is the derivative of MutualInformation with respect to transform 
  parameters,</FONT></DIV>
  <DIV><FONT 
  color=#ff0000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  //&nbsp;why 
  transformedGradient[j]&nbsp;=&nbsp;m_Gradient[j]&nbsp;/&nbsp;scales[j];&nbsp;</FONT></DIV>
  <DIV>&nbsp;&nbsp;ParametersType&nbsp;newPosition(&nbsp;spaceDimension&nbsp;);</DIV>
  <DIV>&nbsp;&nbsp;for(unsigned&nbsp;int&nbsp;j&nbsp;=&nbsp;0;&nbsp;j&nbsp;&lt; 
  &nbsp;spaceDimension;&nbsp;j++)</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;{</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;newPosition[j]&nbsp;=&nbsp;currentPosition[j]&nbsp;+&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;direction&nbsp;*&nbsp;m_LearningRate&nbsp;*&nbsp;transformedGradient[j];</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;this-&gt; SetCurrentPosition(&nbsp;newPosition&nbsp;);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;this-&gt; InvokeEvent(&nbsp;IterationEvent()&nbsp;);</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>}</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ</DIV>
  <DIV>Àñ£¡</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡×¯Ïź£(Xiahai&nbsp;Zhuang)</DIV>
  <DIV>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡arhye@163.com</DIV>
  <DIV>¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2005-05-01</DIV>
  <DIV>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>