Skip to content

Commit ed450ba

Browse files
committed
Minor optimization of Sot::computeControlLaw
1 parent 222ceef commit ed450ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sot/sot.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void computeJacobianActivated( Task* taskSpec,
383383
for( int i=0;i<Jt.cols();++i )
384384
{
385385
if(! controlSelec(i) )
386-
{for( int j=0;j<Jt.rows();++j ) { Jt(j,i)=0.; }}
386+
{ Jt.col (i).setZero(); }
387387
}
388388
}
389389
else
@@ -557,7 +557,7 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
557557
/***/sotCOUNTER(2,3); // compute JK
558558

559559
/* --- COMPUTE Jt --- */
560-
if( 0<iterTask ) Jt = JK*Proj; else { Jt = JK; }
560+
if( 0<iterTask ) Jt.noalias() = JK*Proj; else { Jt = JK; }
561561
/***/sotCOUNTER(3,4); // compute Jt
562562

563563
/* --- COMPUTE S --- */
@@ -619,8 +619,8 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
619619
/* --- COMPUTE QDOT AND P --- */
620620
/*DEBUG: normally, the first iter (ie the test below)
621621
* is the same than the other, starting with control_0 = q0SIN. */
622-
if( iterTask==0 ) control += Jp*err; else
623-
control += Jp*(err - JK*control);
622+
if( iterTask==0 ) control.noalias() += Jp*err;
623+
else control += Jp*(err - JK*control);
624624
/***/sotCOUNTER(7,8); // QDOT
625625

626626
/* --- OPTIMAL FORM: To debug. --- */

0 commit comments

Comments
 (0)