Skip to content

Commit c01f60b

Browse files
committed
Remove unused MemoryTaskSOT::S (stored in svd)
1 parent 2d50269 commit c01f60b

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

include/sot/core/memory-task-sot.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ namespace dynamicgraph {
4747
dg::Matrix JK; //(nJ,mJ);
4848

4949
dg::Matrix U,V;
50-
dg::Vector S;
5150

5251
typedef Eigen::JacobiSVD<dg::Matrix> SVD_t;
5352
SVD_t svd;

src/sot/memory-task-sot.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ initMemory( const unsigned int nJ,const unsigned int mJ,const unsigned int ffsiz
6565
JK.resize( nJ,mJ );
6666
U.resize( nJ,nJ );
6767
V.resize( mJ,mJ );
68-
S.resize( std::min( nJ,mJ ) );
6968

7069
svd = SVD_t (nJ, mJ, Eigen::ComputeThinU | Eigen::ComputeThinV);
7170

@@ -79,7 +78,6 @@ initMemory( const unsigned int nJ,const unsigned int mJ,const unsigned int ffsiz
7978
JK.setZero();
8079
U.setZero();
8180
V.setZero();
82-
S.setZero();
8381
} else {
8482
Eigen::pseudoInverse(Jt,Jp);
8583
}

src/sot/sot.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,22 +532,19 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
532532
sotDEBUG(2) <<"Recompute inverse."<<endl;
533533

534534
/* --- FIRST ALLOCS --- */
535-
dynamicgraph::Vector &S = mem->S;
536-
537535
sotDEBUG(1) << "Size = "
538-
<< S.size() + mem->Jff.cols()*mem->Jff.rows()
536+
<< std::min(nJ, mJ) + mem->Jff.cols()*mem->Jff.rows()
539537
+ mem->Jact.cols()*mem->Jact.rows() << std::endl;
540538

541539
sotDEBUG(1) << std::endl;
542-
S.resize( std::min(nJ,mJ) );
543540
sotDEBUG(1) << "nJ=" << nJ << " " << "Jac.cols()=" << Jac.cols()
544541
<<" "<< "mJ=" << mJ<<std::endl;
545542
mem->Jff.resize( nJ,Jac.cols()-mJ ); // number dofs, number constraints
546543
sotDEBUG(1) << std::endl;
547544
mem->Jact.resize( nJ,mJ );
548545
sotDEBUG(1) << std::endl;
549546
sotDEBUG(1) << "Size = "
550-
<< S.size() + mem->Jff.cols()*mem->Jff.rows()
547+
<< std::min(nJ, mJ) + mem->Jff.cols()*mem->Jff.rows()
551548
+ mem->Jact.cols()*mem->Jact.rows() << std::endl;
552549

553550
/***/sotCOUNTER(1,2); // first allocs
@@ -568,9 +565,6 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
568565
svd.compute (Jt);
569566
Eigen::dampedInverse (svd, Jp, th);
570567
V.noalias() = svd.matrixV();
571-
// TODO I think variable S could be removed as it is not used when
572-
// not recomputing the pseudo inverse.
573-
S.noalias() = svd.singularValues();
574568
/***/sotCOUNTER(5,6); // PINV
575569
sotDEBUG(2) << "V after dampedInverse." << V <<endl;
576570
/* --- RANK --- */
@@ -589,7 +583,7 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
589583
sotDEBUG(15) << "e"<<iterTask<<" = "<<err<<endl;
590584
sotDEBUG(45) << "JJp"<<iterTask<<" = "<< JK*Jp <<endl;
591585
//sotDEBUG(45) << "U"<<iterTask<<" = "<< U<<endl;
592-
sotDEBUG(45) << "S"<<iterTask<<" = "<< S<<endl;
586+
sotDEBUG(45) << "S"<<iterTask<<" = "<< svd.singularValues()<<endl;
593587
sotDEBUG(45) << "V"<<iterTask<<" = "<< V<<endl;
594588
sotDEBUG(45) << "U"<<iterTask<<" = "<< svd.matrixU()<<endl;
595589

0 commit comments

Comments
 (0)