Exemple #1
0
  typename std::enable_if<is_blas_lapack_type<typename VTX::value_type>::value && have_same_value_type<VTX, VTY, MT>::value>::type
  ger(typename VTX::value_type alpha, VTX const &X, VTY const &Y, MT &A) {
    static_assert(is_amv_value_or_view_class<MT>::value, "ger : A must be a matrix or a matrix_view");
    if ((first_dim(A) != Y.size()) || (second_dim(A) != X.size()))
      TRIQS_RUNTIME_ERROR << "Dimension mismatch in ger : A : " << get_shape(A()) << " while X : " << get_shape(X()) << " and Y : " << get_shape(Y());
    const_qcache<VTX> Cx(X); // mettre la condition a la main
    const_qcache<VTY> Cy(Y); // mettre la condition a la main
    reflexive_qcache<MT> Ca(A);
    if (Ca().memory_layout_is_c()) // tA += alpha y tx
      f77::ger(get_n_rows(Ca()), get_n_cols(Ca()), alpha, Cy().data_start(), Cy().stride(), Cx().data_start(), Cx().stride(), Ca().data_start(),
               get_ld(Ca()));
    else
      f77::ger(get_n_rows(Ca()), get_n_cols(Ca()), alpha, Cx().data_start(), Cx().stride(), Cy().data_start(), Cy().stride(), Ca().data_start(),
               get_ld(Ca()));

    /* std::cerr << " Meme labout  C"<< Ca().memory_layout_is_c()  << "  "<<A.memory_layout_is_c()<<std::endl ;
   std::cerr<< " has_contiguous_data(A) : "<< has_contiguous_data(A) << std::endl;
   std::cerr<< Ca()<< std::endl;
   std::cerr<< Ca()(0,0) <<  "  "<< Ca()(1,0) <<  "  "<< Ca()(0,1) <<  "  "<< Ca()(1,1) <<  "  "<< std::endl;
   std::cerr<< Ca().data_start()[0]<< "  "<< Ca().data_start()[1]<< "  "<< Ca().data_start()[2]<< "  " << Ca().data_start()[3]<< "  "<<std::endl;

   std::cerr<< A<< std::endl;
   std::cerr<< A(0,0) <<  "  "<< A(1,0) <<  "  "<< A(0,1) <<  "  "<< A(1,1) <<  "  "<< std::endl;
   std::cerr<< A.data_start()[0]<< "  "<< A.data_start()[1]<< "  "<< A.data_start()[2]<< "  " << A.data_start()[3]<< "  "<<std::endl;
*/
  }
Exemple #2
0
inline void RocketGeometry::Display()
{
   double v = 30;
   double t = 273.15 + 20;
   double rho = 1.225;
   double r = Reynolds(rho, v, ltr, t);
   double a = 0.01;
   double m = Mach(v, t);
   double cf = ViscousDrag(r);
   double xcp = Xcp(a);
   double cn = Cn(a, r, m);
   double ca = Ca(a, r, m, cn);

   std::cout << "Rocket Geometry: "
      << "\n\nPlanform Areas"
      << "\n - ApN: " << ApN()
      << "\n - ApB: " << ApB()
      << "\n - ApT: " << ApT()
      << "\n - ApF: " << ApF()
      << "\n - Afe: " << Afe()
      << "\n - Afp: " << Afp()
      << "\n\nStability Derivatives"
      << "\n - CnaN: " << NCnaN()
      << "\n - CnaB: " << NCnaB()
      << "\n - CnaT: " << NCnaT()
      << "\n - CnaF: " << NCnaF()
      << "\n\nNorm Force CP"
      << "\n - NcpN: " << NXcpN()
      << "\n - NcpB: " << NXcpB()
      << "\n - NcpT: " << NXcpT()
      << "\n - NcpF: " << NXcpF()
      << "\n\nLift Force CP"
      << "\n - LcpN: " << LXcpN()
      << "\n - LcpB: " << LXcpB()
      << "\n - LcpT: " << LXcpT()
      << "\n - LcpF: " << LXcpF()
      << "\n\nDrag Force"
      << "\n - DragB: " << DragBody(cf)
      << "\n - DragA: " << DragBase(DragBody(cf))
      << "\n - DragF: " << DragFin(cf)
      << "\n - DragI: " << DragInterference(cf)
      << "\n - DragBA: " << DragAlphaBody(a)
      << "\n - DragFA: " << DragAlphaFin(a)
      << "\n\nResults"
      << "\n - Cn: " << cn
      << "\n - Ca: " << ca
      << "\n - Xcp: " << xcp
      << std::endl;
}
bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const
{
  bool result = false;
  bool hasPriority = Priority < 0 || Priority > this->Priority();
  bool needsDetachReceivers = false;

  if (ProvidesSource(Channel->Source()) && ProvidesCa(Channel)) {
     result = hasPriority;
     if (Priority >= 0 && Receiving(true)) {
        if (dvbTuner->IsTunedTo(Channel)) {
           if (Channel->Vpid() && !HasPid(Channel->Vpid()) || Channel->Apid(0) && !HasPid(Channel->Apid(0))) {
#ifdef DO_MULTIPLE_RECORDINGS
#ifndef DO_MULTIPLE_CA_CHANNELS
              if (Ca() >= CA_ENCRYPTED_MIN || Channel->Ca() >= CA_ENCRYPTED_MIN)
                 needsDetachReceivers = Ca() != Channel->Ca();
              else
#endif
              if (!IsPrimaryDevice())
                 result = true;
#ifdef DO_REC_AND_PLAY_ON_PRIMARY_DEVICE
              else
                 result = Priority >= Setup.PrimaryLimit;
#endif
#endif
              }
           else
              result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
           }
        else
           needsDetachReceivers = true;
        }
     }
  if (NeedsDetachReceivers)
     *NeedsDetachReceivers = needsDetachReceivers;
  return result;
}
void getData(const char* nom_fichier,IloEnv env,instance_Cplex& instance) {

  int& n(instance.n);
  int& m(instance.m);
  DataMatrix& Ha(instance.Ha);
  DataMatrix& Ca(instance.Ca);
  DataMatrix& Hp(instance.Hp); 
  DataMatrix& Cp(instance.Cp);

  char char1;
	double tmp;
	
	ifstream fichier(nom_fichier);
	if(fichier) {
		//pour n
		fichier >> char1 >> char1 >> n >> char1;
		cout <<"n="<< n<<"\n";
		//pour m
		fichier >> char1 >> char1 >> m >>char1;
		cout <<"m="<< m<<"\n";
		 
		//pour Ba, si existe!
		double Ba=0;
		fichier >> char1 ;
		if(char1=='B'){//then Ba est définie, et Bp aussi
		  fichier >> char1 >> char1>>Ba >>char1;
		  cout <<"Ba="<< Ba<<"\n";
		  
		  double Bp=0;
		  //pour Bp
		  fichier >> char1 >> char1 >>char1 >> Bp >>char1;
		
		  
		// Ha
		fichier >> char1 >> char1 >> char1 >> char1; // lit H a = [       
		}
		else if(char1=='H'){	fichier >> char1 >> char1 >> char1; // le 'H' a été lu, on lit " a = ["