Example #1
0
//==============================================================================
void Function::evalGradient(const Eigen::VectorXd& _x,
                            Eigen::Map<Eigen::VectorXd> _grad)
{
  // TODO(MXG): This is for backwards compatibility
  Eigen::Map<const Eigen::VectorXd> temp(_x.data(), _x.size());
  evalGradient(temp, _grad);
}
void Texture2D::evalGradient(const Intersection &its, Spectrum *gradient) const {
	Point2 uv = Point2(its.uv.x * m_uvScale.x, its.uv.y * m_uvScale.y) + m_uvOffset;

	evalGradient(uv, gradient);

	gradient[0] *= m_uvScale.x;
	gradient[1] *= m_uvScale.y;
}
Example #3
0
void grassmannQ::set_particle(){
  arma::mat y_temp=arma::randn(n,p);
  arma::mat Q,R;
  arma::qr_econ(Q,R,y_temp);
  Y=Q;
  arma::mat velocity_temp=arma::randn(n,p);
  //psedo gradient as velocity;
  evalGradient(velocity_temp,"particleSwarm");
}
Example #4
0
void elliptope::set_particle(){
  Y=arma::randn(n,r);
  arma::colvec  normCol=arma::sum(Y%Y,1);
  normCol=arma::pow(normCol,-0.5);
  Y=(normCol*arma::mat(1,r,arma::fill::ones))%Y;
  //psuedo gradient as velocity;
   arma::mat velocity_temp=arma::randn(n,r);
  evalGradient(velocity_temp,"particleSwarm");
}
Example #5
0
void specialLinear::set_particle(){
  arma::mat y_temp=arma::randn(n,p);
  double determ=arma::det(y_temp);
  if(determ<0.0) y_temp.col(1)=-y_temp.col(1);
  Y=y_temp/(pow(determ,1.0/n));
  
  arma::mat velocity_temp=arma::randn(n,p);
  //psedo gradient as velocity;
  evalGradient(velocity_temp,"particleSwarm");
}
Example #6
0
//==============================================================================
void Function::evalGradient(const Eigen::VectorXd& _x,
                            Eigen::Map<Eigen::VectorXd> _grad)
{
  // TODO(MXG): This is for backwards compatibility. We suppress the
  // deprecated-warnings until then (see #544).
  Eigen::Map<const Eigen::VectorXd> temp(_x.data(), _x.size());

  DART_SUPPRESS_DEPRECATED_BEGIN
  evalGradient(temp, _grad);
  DART_SUPPRESS_DEPRECATED_END
}
Example #7
0
void oblique::set_particle(){
  arma::mat y_temp=arma::randn(n,p), temp, divisor=arma::eye(p,p);
  int k;
  for(k=0;k<p;k++){
    temp=y_temp.col(k);
    divisor(k,k)=arma::norm(temp,"fro");
  }  
  Y=y_temp*(divisor.i());
  arma::mat velocity_temp=arma::randn(n,p);
  //psedo gradient as velocity;
  evalGradient(velocity_temp,"particleSwarm");
}
Example #8
0
void fixRank::set_particle(){ 
  U=arma::randn(n,r);
  V=arma::randn(p,r);
  arma::mat Q,R;
  arma::qr_econ(Q,R,U);
  U=Q;
  arma::qr_econ(Q,R,V);
  V=Q;
  Sigma=arma::vec(r,arma::fill::ones);
  Y=U*arma::diagmat(Sigma)*V.t();
  //////////////////
  arma::mat velocity_temp=arma::randn(n,p);
  evalGradient(velocity_temp,"steepest");
}
Example #9
0
//==============================================================================
void Function::evalGradient(const Eigen::VectorXd& _x, Eigen::VectorXd& _grad)
{
  Eigen::Map<Eigen::VectorXd> tmpGrad(_grad.data(), _grad.size());
  evalGradient(_x, tmpGrad);
}
Example #10
0
//==============================================================================
void Function::evalGradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) const
{
  Eigen::Map<Eigen::VectorXd> tmpGrad(grad.data(), grad.size());
  evalGradient(x, tmpGrad);
}