示例#1
0
/** default function to compute jacobianH
 *  \param double : current time
 *  \param index for jacobian (0: jacobian according to x, 1 according to lambda)
 */
void adjointInput::computeJachx(double t, SiconosVector& x, SiconosVector& lambda, SiconosVector& z, SimpleMatrix& C)
{

#ifdef SICONOS_DEBUG
  std::cout << "computeJachx " << " at " << " " << t << std::endl;
#endif

  SP::SiconosVector betatmp(new SiconosVector(2));
  beta(t, x, betatmp);

  SP::SiconosMatrix jacbetaXtmp(new SimpleMatrix(2, 2));

  JacobianXbeta(t, x, jacbetaXtmp);


  C(0, 0) = x(3);
  C(0, 1) = -x(2) ;
  C(0, 2) = (-x(1) + 1.0) ;
  C(0, 3) = x(0);
  C(1, 0) = 0.0;
  C(1, 1) = 0.0 ;
  C(1, 2) = 0.0 ;
  C(1, 3) = 0.0;



#ifdef SICONOS_DEBUG
  std::cout << "modif Jachx : \n";
  C.display();
#endif


}
示例#2
0
void adjointInput::computeJacglambda(double t, SiconosVector& x, SiconosVector& lambda, SiconosVector& z, SimpleMatrix& B)
{

  double *g = B.getArray();
#ifdef SICONOS_DEBUG
  std::cout << "computeJacglambda " << " at " << " " << t << std::endl;
#endif

  SP::SiconosVector K2P(new SiconosVector(2));
  SP::SiconosVector P(new SiconosVector(2));
  P->setValue(0, x(2));
  P->setValue(1, x(3));

  prod(*K2, *P, *K2P, true);

  SP::SiconosVector betatmp(new SiconosVector(2));
  beta(t, x, betatmp);

  g[0] = betatmp->getValue(0)  ;
  g[4] = 0.0;
  g[1] = betatmp->getValue(1)  ;
  g[5] = 0.0;
  g[2] = K2P->getValue(0)      ;
  g[6] = 0.0;
  g[3] = K2P->getValue(1)      ;
  g[7] = 0.0 ;



#ifdef SICONOS_DEBUG
  std::cout << "modif Jacglambda : \n";
  B.display();
#endif

}
示例#3
0
void adjointInput::computeJachlambda(double t, SiconosVector& x, SiconosVector& lambda, SiconosVector& z, SimpleMatrix& D)
{
#ifdef SICONOS_DEBUG
  std::cout << "computeJachlambda " << " at " << " " << t << std::endl;
#endif

  D(0, 0) = 0.0              ;
  D(0, 1) = 1.0 ;
  D(1, 0) = -1.0             ;
  D(1, 1) = 0.0 ;

#ifdef SICONOS_DEBUG
  std::cout << "modif Jachlambda : \n";
  D.display();
#endif

}
void NonlinearRelationWithSignInversed::computeJacglambda(double t, SiconosVector& lambda, SimpleMatrix& B)
{
  B.setValue(0, 0, 0);
  B.setValue(1, 0, -10.0 * (1 + lambda(3)));
  B.setValue(0, 1, -10.0 * (1 + lambda(2)));
  B.setValue(1, 1, 0);
  B.setValue(0, 2, 10.0 * (1 - lambda(1)));
  B.setValue(1, 2, 0);
  B.setValue(0, 3, 0);
  B.setValue(1, 3, 10.0 * (1 - lambda(0)));

#ifdef SICONOS_DEBUG
  std::cout << "NonlinearRelationWithSignInversed::computeJacgx " << " at " << " " << t << std::endl;
  B.display();
  std::cout << std::endl;
#endif

}
void NonlinearRelationWithSignInversed::computeJachx(double t, SiconosVector& x, SiconosVector& lambda, SimpleMatrix& C)
{
  C.setValue(0, 0, 1);
  C.setValue(0, 1, 0);
  C.setValue(1, 0, 0);
  C.setValue(1, 1, 1);
  C.setValue(2, 0, 1);
  C.setValue(2, 1, 0);
  C.setValue(3, 0, 0);
  C.setValue(3, 1, 1);

#ifdef SICONOS_DEBUG
  std::cout << "NonlinearRelationWithSignInversed::computeJachx computeJachx " << " at " << " " << t << ":" << std::endl;
  C.display();
  std::cout << std::endl;
#endif

}
示例#6
0
/** default function to compute jacobianG according to lambda
 *  \param double : current time
 *  \param index for jacobian: at the time only one possible jacobian => i = 0 is the default value .
 */
void adjointInput::computeJacgx(double t, SiconosVector& x, SiconosVector& lambda, SiconosVector& z, SimpleMatrix& K)
{

#ifdef SICONOS_DEBUG
  std::cout << "computeJacgx " << " at " << " " << t << std::endl;
#endif


  SP::SiconosMatrix jacbetaXtmp(new SimpleMatrix(2, 2));

  JacobianXbeta(t, x, jacbetaXtmp);

  K(0, 0) = jacbetaXtmp->getValue(0, 0) * (lambda(0) - 1.0) ;
  K(0, 1) = jacbetaXtmp->getValue(0, 1) * (lambda(0) - 1.0)  ;
  K(0, 2) = 0.0;
  K(0, 3) = 0.0;
  K(1, 0) = jacbetaXtmp->getValue(1, 0) * (lambda(0) - 1.0) ;
  K(1, 1) = jacbetaXtmp->getValue(1, 1) * (lambda(0) - 1.0)  ;
  K(1, 2) = 0.0  ;
  K(1, 3) = 0.0 ;
  K(2, 0) = 0.0;
  K(2, 1) = 0.0;
  K(2, 2) = K2->getValue(0, 0) * (lambda(0) - 1.0);
  K(2, 3) = K2->getValue(0, 1) * (lambda(0) - 1.0);
  K(3, 0) = 0.0;
  K(3, 1) = 0.0;
  K(3, 2) = K2->getValue(1, 0) * (lambda(0) - 1.0);
  K(3, 3) = K2->getValue(1, 1) * (lambda(0) - 1.0);

#ifdef SICONOS_DEBUG
  std::cout << "modif Jacgx : \n";
  K.display();
#endif


}