当前位置: 首页>>代码示例>>C++>>正文


C++ out函数代码示例

本文整理汇总了C++中out函数的典型用法代码示例。如果您正苦于以下问题:C++ out函数的具体用法?C++ out怎么用?C++ out使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了out函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: settingsQss

void QtUiStyle::generateSettingsQss() const {
  QFile settingsQss(Quassel::configDirPath() + "settings.qss");
  if(!settingsQss.open(QFile::WriteOnly|QFile::Truncate)) {
    qWarning() << "Could not open" << settingsQss.fileName() << "for writing!";
    return;
  }
  QTextStream out(&settingsQss);

  out << "// Style settings made in Quassel's configuration dialog\n"
      << "// This file is automatically generated, do not edit\n";

  // ChatView
  ///////////
  QtUiStyleSettings fs("Fonts");
  if(fs.value("UseCustomChatViewFont").toBool())
    out << "\n// ChatView Font\n"
        << "ChatLine { " << fontDescription(fs.value("ChatView").value<QFont>()) << "; }\n";

  QtUiStyleSettings s("Colors");
  if(s.value("UseChatViewColors").toBool()) {
    out << "\n// Custom ChatView Colors\n"

        // markerline is special in that it always used to use a gradient, so we keep this behavior even with the new implementation
        << "Palette { marker-line: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 " << color("MarkerLine", s) << ", stop: 0.1 transparent); }\n"
        << "ChatView { background: " << color("ChatViewBackground", s) << "; }\n\n"
        << "ChatLine[label=\"highlight\"] {\n"
        << "  foreground: " << color("Highlight",s) << ";\n"
        << "  background: " << color("HighlightBackground", s) << ";\n"
        << "}\n\n"
        << "ChatLine::timestamp { foreground: " << color("Timestamp", s) << "; }\n\n"

        << msgTypeQss("plain", "ChannelMsg", s)
        << msgTypeQss("notice", "ServerMsg", s)
        << msgTypeQss("action", "ActionMsg", s)
        << msgTypeQss("nick", "CommandMsg", s)
        << msgTypeQss("mode", "CommandMsg", s)
        << msgTypeQss("join", "CommandMsg", s)
        << msgTypeQss("part", "CommandMsg", s)
        << msgTypeQss("quit", "CommandMsg", s)
        << msgTypeQss("kick", "CommandMsg", s)
        << msgTypeQss("kill", "CommandMsg", s)
        << msgTypeQss("server", "ServerMsg", s)
        << msgTypeQss("info", "ServerMsg", s)
        << msgTypeQss("error", "ErrorMsg", s)
        << msgTypeQss("daychange", "ServerMsg", s)
        << msgTypeQss("topic", "CommandMsg", s)
        << msgTypeQss("netsplit-join", "CommandMsg", s)
        << msgTypeQss("netsplit-quit", "CommandMsg", s)
        << "\n";
  }

  if(s.value("UseSenderColors").toBool()) {
    out << "\n// Sender Colors\n"
        << "ChatLine::sender#plain[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n\n";

    for(int i = 0; i < 16; i++)
      out << senderQss(i, s);
  }

  // ItemViews
  ////////////

  UiStyleSettings uiFonts("Fonts");
  if(uiFonts.value("UseCustomItemViewFont").toBool()) {
    QString fontDesc = fontDescription(uiFonts.value("ItemView").value<QFont>());
    out << "\n// ItemView Font\n"
        << "ChatListItem { " << fontDesc << "; }\n"
        << "NickListItem { " << fontDesc << "; }\n\n";
  }

  UiStyleSettings uiColors("Colors");
  if(uiColors.value("UseBufferViewColors").toBool()) {
    out << "\n// BufferView Colors\n"
        << "ChatListItem { foreground: " << color("DefaultBuffer", uiColors) << "; }\n"
        << chatListItemQss("inactive", "InactiveBuffer", uiColors)
        << chatListItemQss("channel-event", "ActiveBuffer", uiColors)
        << chatListItemQss("unread-message", "UnreadBuffer", uiColors)
        << chatListItemQss("highlighted", "HighlightedBuffer", uiColors);
  }

  if(uiColors.value("UseNickViewColors").toBool()) {
    out << "\n// NickView Colors\n"
        << "NickListItem[type=\"category\"] { foreground: " << color("DefaultBuffer", uiColors) << "; }\n"
        << "NickListItem[type=\"user\"] { foreground: " << color("OnlineNick", uiColors) << "; }\n"
        << "NickListItem[type=\"user\", state=\"away\"] { foreground: " << color("AwayNick", uiColors) << "; }\n";
  }

  settingsQss.close();
}
开发者ID:bawNg,项目名称:quassel,代码行数:89,代码来源:qtuistyle.cpp

示例2: register_language

int clobber_parse_optionst::doit()
{
  if(cmdline.isset("version"))
  {
    std::cout << CBMC_VERSION << std::endl;
    return 0;
  }

  register_language(new_ansi_c_language);
  register_language(new_cpp_language);

  //
  // command line options
  //

  optionst options;
  get_command_line_options(options);

  eval_verbosity();

  goto_functionst goto_functions;

  if(get_goto_program(options, goto_functions))
    return 6;
    
  label_properties(goto_functions);

  if(cmdline.isset("show-properties"))
  {
    const namespacet ns(symbol_table);
    show_properties(ns, get_ui(), goto_functions);
    return 0;
  }

  if(set_properties(goto_functions))
    return 7;
    
  // do instrumentation

  try
  {
    const namespacet ns(symbol_table);
    
    std::ofstream out("simulator.c");
    
    if(!out)
      throw std::string("failed to create file simulator.c");
    
    dump_c(goto_functions, true, ns, out);
    
    status() << "instrumentation complete; compile and execute simulator.c" << eom;
    
    return 0;
  }
  
  catch(const std::string error_msg)
  {
    error() << error_msg << messaget::eom;
    return 8;
  }

  catch(const char *error_msg)
  {
    error() << error_msg << messaget::eom;
    return 8;
  }

  #if 0                                         
  // let's log some more statistics
  debug() << "Memory consumption:" << messaget::endl;
  memory_info(debug());
  debug() << eom;
  #endif
}
开发者ID:Dthird,项目名称:CBMC,代码行数:74,代码来源:clobber_parse_options.cpp

示例3: plot_funz_ml

void plot_funz_ml(const char *out_path,const char *title,const char *xlab,const char *ylab,bvec &X,bvec &Y,bvec &par,double X_phys,double (*fun)(double,double,double,double,double,double),boot &chiral_extrap_cont)
{
  //setup the plot
  grace out(out_path);
  out.plot_size(800,600);
  out.plot_title(combine("Chiral extrapolation of %s",title).c_str());
  out.axis_label(xlab,ylab);
  
  if(fun!=NULL)
    {
      //plot the function with error
      int npoint=100;
      double X_pol[npoint];
      bvec Y_pol(npoint,nboot,njack);
      for(int ipoint=0;ipoint<npoint;ipoint++) X_pol[ipoint]=0.0599/(npoint-1)*ipoint+0.0001;
      for(int ib=0;ib<nbeta;ib++)
	{
	  bvec Y_pol(npoint,nboot,njack);
	  for(int ipoint=0;ipoint<npoint;ipoint++)
	    for(int iboot=plot_iboot=0;iboot<nboot+1;plot_iboot=iboot++)
	      Y_pol.data[ipoint].data[iboot]=fun(par[0][iboot],par[1][iboot],par[2][iboot],par[3][iboot],X_pol[ipoint],lat[ib][iboot]);
	  
	  out.set(1,set_fill_color[ib]);
	  out.polygon(X_pol,Y_pol);
	  out.new_set();
	  out.set(1,set_color[ib]);
	  out.set_line_size(2);
	  out.ave_line(X_pol,Y_pol);
	  out.new_set();
	}
      //plot continuum curve
      for(int ipoint=0;ipoint<npoint;ipoint++)
	for(int iboot=plot_iboot=0;iboot<nboot+1;plot_iboot=iboot++)
	  Y_pol.data[ipoint]=fun(par[0][iboot],par[1][iboot],par[2][iboot],par[3][iboot],X_pol[ipoint],0);
      //out.set(1,"magenta");
      //out.polygon(X_pol,Y_pol);
      //out.new_set();
      out.set(1,"magenta");
      out.set_line_size(3);
      out.ave_line(X_pol,Y_pol);
      out.new_set();
    }
  
  //plot the original data with error  
  for(int ib=0;ib<nbeta;ib++)
    {
      out.set(4,"none",set_symbol[ib],set_color[ib],"filled");
      out.set_legend(set_legend_fm[ib]);
      out.set_line_size(2);
      out.fout<<"@type xydy"<<endl;
      for(int iens=0;iens<nens;iens++) if(ibeta[iens]==ib) out.fout<<X[iens].med()<<" "<<Y.data[iens]<<endl;
      out.new_set();
    }
  
  //plot the extrapolated point with error
  out.set(4,"none","circle","indigo","filled");
  out.set_line_size(3);
  out.set_legend("Physical point");
  out.print_graph(X_phys,chiral_extrap_cont);
  out.new_set();
}
开发者ID:sunpho84,项目名称:sunpho,代码行数:61,代码来源:extr_adim.cpp

示例4: err_bmf

void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); }
开发者ID:kp-org,项目名称:eQmail,代码行数:1,代码来源:qmail-smtpd.c

示例5: out

void UnitTestOutputLog::testUnit()
{
  // Make cout and cerr available as log stream targets.
  stk::register_log_ostream(std::cout, "cout");
  stk::register_log_ostream(std::cerr, "cerr");

  // Test registration, binding, rebinding and unregistration
  {
    std::ostringstream log1;
    std::ostringstream log2;
    
    std::ostream out(std::cout.rdbuf());

    stk::register_ostream(out, "out");

    CPPUNIT_ASSERT(stk::is_registered_ostream("out"));
    
    stk::register_log_ostream(log1, "log1");
    stk::register_log_ostream(log2, "log2");

    stk::bind_output_streams("out>log1");

    out << "stk::bind_output_streams(\"out>log1\");" << std::endl;

    stk::bind_output_streams("out>+log2");
    out << "stk::bind_output_streams(\"out>+log2\");" << std::endl;
    
    stk::bind_output_streams("out>-log1");
    out << "stk::bind_output_streams(\"out>-log1\");" << std::endl;

    stk::bind_output_streams("out>-log2");
    out << "stk::bind_output_streams(\"out>-log2\");" << std::endl;

    std::ostringstream log1_result;
    log1_result << "stk::bind_output_streams(\"out>log1\");" << std::endl
                << "stk::bind_output_streams(\"out>+log2\");" << std::endl;
    
    std::ostringstream log2_result;
    log2_result << "stk::bind_output_streams(\"out>+log2\");" << std::endl
                << "stk::bind_output_streams(\"out>-log1\");" << std::endl;
    
    CPPUNIT_ASSERT_EQUAL(log1_result.str(), log1.str());
    CPPUNIT_ASSERT_EQUAL(log2_result.str(), log2.str());

    stk::unregister_log_ostream(log1);
    stk::unregister_log_ostream(log2);
    stk::unregister_ostream(out);

    CPPUNIT_ASSERT_EQUAL(out.rdbuf(), std::cout.rdbuf());
  }

  // Test logging to a file
  {
    std::ostream out(std::cout.rdbuf());

    stk::register_ostream(out, "out");

    stk::bind_output_streams("log=\"logfile\" out>log");

    CPPUNIT_ASSERT_EQUAL(std::string("logfile"), stk::get_log_path("log")); 
    
    out << "This is a test" << std::endl;

    stk::bind_output_streams("log=\"\"");
    
    stk::unregister_ostream(out);

    std::ostringstream log_result;
    log_result << "This is a test";
    
    std::ifstream log_stream("logfile");
    std::string log_string;
    getline(log_stream, log_string);
    CPPUNIT_ASSERT_EQUAL(log_result.str(), log_string);
  }

  // Test results of unregistration of an output stream bound as a log stream
  {
    std::ostringstream default_log;
    std::ostream out(default_log.rdbuf());
    std::ostream pout(std::cout.rdbuf());

    stk::register_ostream(out, "out");
    stk::register_ostream(pout, "pout");

    //  Constructing the log streams after the registered output stream is not exception safe.
    std::ostringstream log;
    stk::register_log_ostream(log, "log");

    // As a result, this try catch block must be represent to ensure the that unregistration
    // happens correctly.
    try {  
      stk::bind_output_streams("out>pout pout>log");

      out << "This is to out" << std::endl;
      pout << "This is to pout" << std::endl;

      std::ostringstream log_result;
      log_result << "This is to out" << std::endl
                 << "This is to pout" << std::endl;
//.........这里部分代码省略.........
开发者ID:haripandey,项目名称:trilinos,代码行数:101,代码来源:UnitTestOutputLog.cpp

示例6: die_control

void die_control() { logit("unable to read controls"); out("421 unable to read controls (#4.3.0)\r\n"); flush(); _exit(1); }
开发者ID:kp-org,项目名称:eQmail,代码行数:1,代码来源:qmail-smtpd.c

示例7: straynewline

void straynewline() { logit("bad newlines"); out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
开发者ID:kp-org,项目名称:eQmail,代码行数:1,代码来源:qmail-smtpd.c

示例8: main

int main() {
    //std::vector<int> items = {1,2,3,4,5,6,7,8,9,10};

    std::string filename("sampleEmbedding_200.txt");
    //std::string filename("iris.data");
    std::vector< std::vector<double> > items = load_data(filename);

    // generate similarity matrix
    unsigned int size = items.size();
    Eigen::MatrixXd m = Eigen::MatrixXd::Zero(size,size);
    std::cout << "------------" << std::endl;

    for (unsigned int i=0; i < size; i++) {
        for (unsigned int j=0; j < size; j++) {
            // generate similarity
            //int d = items[i] - items[j];
	    double d = eculidean_distance(items[i], items[j]);
            int similarity = exp(-d*d / 1);
            m(i,j) = similarity;
            m(j,i) = similarity;
        }
    }

    // the number of eigenvectors to consider. This should be near (but greater) than the number of clusters you expect. Fewer dimensions will speed up the clustering
    int numDims = size;

    // do eigenvalue decomposition
    SpectralClustering* c = new SpectralClustering(m, numDims);

    // whether to use auto-tuning spectral clustering or kmeans spectral clustering
    bool autotune = false;

    std::vector<std::vector<int> > clusters;
    if (autotune) {
        // auto-tuning clustering
        clusters = c->clusterRotate();
    } else {
        // how many clusters you want
        int numClusters = 10;
        clusters = c->clusterKmeans(numClusters);
    }

    // output clustered items
    // items are ordered according to distance from cluster centre
    for (unsigned int i=0; i < clusters.size(); i++) {
        std::cout << "Cluster " << i << ": " << "Item ";
        std::copy(clusters[i].begin(), clusters[i].end(), std::ostream_iterator<int>(std::cout, ", "));
        std::cout << std::endl;
    }
	std::map<int, int> sampleid_to_clusterid;
    for (unsigned int i = 0; i < clusters.size(); i++) {
    	for (unsigned int j = 0; j < clusters[i].size(); j++){
		sampleid_to_clusterid.insert(std::make_pair(clusters[i][j], i));
	}
    }
    
    std::string output_filename("sample_assignment.txt");

    std::ofstream out(output_filename.c_str(), std::ios::out);
    if(!out) {
    	std::cerr << "Can't open output file " << output_filename << std::endl;
    	return 0;
    }
    std::map<int, int>::iterator it;
    for(it = sampleid_to_clusterid.begin(); it != sampleid_to_clusterid.end(); it++) {
    	out << it->second << std::endl;
    }
    out.close();
   
}
开发者ID:EnjoyHacking,项目名称:stsc,代码行数:70,代码来源:example.cpp

示例9: switch

//Запуск программы юзера
void MainWindow::on_run_triggered()
{
    if (n) //Если вкадки открыты
    {
        QString format,compiler;
        switch (tabs[cur_tab]->getLang())
        {
        case CPP:
            format = "cpp";
            compiler = "g++ temp.cpp";
            break;
        case PAS:
            format = "pas";
            compiler = "fpc temp.pas";
            break;
        case APX:
            format = "apx";
            compiler = "apx temp.apx";
            break;
        }

        QString str = tabs[cur_tab]->toPlainText();

        //Запись текста таба во временный файл
        QFile("temp."+format).remove();
        std::ofstream out(std::string("temp."+format.toStdString()).c_str());
        out << str.toStdString();
        out << "\n";
        out.close();

        if (tabs[cur_tab]->getLang()==APX)
        {
            //Запуск интерпретатора (если апх)
            switchRun();
            cp->start(compiler);
            cp->waitForStarted();
        }
        else
        {
            //Компилируем
            comp_in_progress = true;
            cp->start(compiler);
            cp->waitForFinished();
            comp_in_progress = false;

            if (cp->exitCode())
                ui->textEdit->append(allErrors);
            allErrors = "";

            if (!cp->exitCode()) //Если успешно скомпилилось
            {
			#ifdef Q_OS_UNIX
                switchRun();
                cp->start(cur_lang==CPP?"./a.out":"./temp.out");
                cp->waitForStarted();
                QFile(cur_lang==CPP?"./a.out":"./temp.out").remove();//Для Linux
            #endif
            #ifdef Q_OS_WIN
                switchRun();
                cp->start(cur_lang==CPP?"a.exe":"temp.exe");
                cp->waitForStarted();
                QFile(cur_lang==CPP?"a.exe":"temp.exe").remove();//Для Windows
            #endif
            }
        }
    }
    else
        QMessageBox::warning(ui->tabWidget,"Error","Возможно вы не открыли/создали ни одного файла",QMessageBox::Yes,QMessageBox::Yes);
}
开发者ID:NOOBS-DevTeam,项目名称:Appendix,代码行数:70,代码来源:mainwindow.cpp

示例10: main

main () {
	
	int an,ad;
	int rm;
	char *p;
    int i,j,k,c;
	int hl,sz,lp,pl;
	
	//clock_t st,ed,*pt;
    
	fin  = fopen ("fracdec.in", "r");
	fout = fopen ("fracdec.out", "w");
	//fout = stdout;
	
    fscanf (fin, "%d %d", &an,&ad);
	//scanf ("%d %d", &an,&ad);
	
	sprintf(ret,"%d",an/ad);
	hl=strlen(ret);
	lp=pl=0;//big trouble without init
	if(an%ad==0){
		strcpy(ret+hl,".0");
	}else{
		ret[hl]='.';
		p=ret+hl+1;
		for(i=0;i<mxn-hl-10;i++){
			rm=an%ad;
			if(!ql[rm])ql[rm]=i+1;
			else{
				lp=ql[rm]-1;
				pl=i-lp;
				*p='\0';
				break;
			}
			rm*=10;
			*p++=rm/ad+'0';
			an=rm%ad;
			if(an==0){
				*p='\0';break;
			}
		}
	}
	
	if(pl){
		*p='\0';
		p=ret+hl+1;
		i=lp;k=pl;
#if 0 //tle
	if(i==mxn-hl-10){
		*p='\0';
		p=ret+hl+1;
		sz=mxn-hl-10;
		for(k=1;k<ad&&k<sz/2;k++){
			for(i=0;i<k;i++){
				j=i+k;
				while(j<sz-k){
					if(strncmp(p+i,p+j,k)!=0)break;
					j+=k;
				}
				if(j>=sz-k)break;
			}
			if(i<k)break;
		}
#endif
		printf("%d %d\n",i,k);
		p[i+k+1]=')';
		p[i+k+2]='\0';
		for(j=i+k;j>i;j--){
			p[j]=p[j-1];
		}
		p[i]='(';
    }
	
	out();
    exit (0);
}
开发者ID:hitme,项目名称:USACO,代码行数:76,代码来源:task41-fracdec.c

示例11: out

void	CHD61102::save_internal(QFile *file){
    QDataStream out(file);

    out.writeRawData("HD61102STA", 10);					//header
    out.writeRawData((char*)&info,sizeof(info));		//reg
}
开发者ID:TheProjecter,项目名称:pockemul,代码行数:6,代码来源:hd61102.cpp

示例12: out

pdsp::Patchable& ofxPDSPMonoFader::out_signal() {
    return out("signal");
}
开发者ID:npisanti,项目名称:ofxPDSP,代码行数:3,代码来源:ofxPDSPMonoFader.cpp

示例13: main

int main(int argc, char *argv[])
{
    QString title;
    title = title + "********************************************************************* \n";
    title = title + " * Create from XML                                                   * \n";
    title = title + " * This tool create a SQL DDL script file from a XML schema file     * \n";
    title = title + " * created by ODKToMySQL.                                            * \n";
    title = title + " *                                                                   * \n";
    title = title + " * This tool is usefull when dealing with multiple versions of an    * \n";
    title = title + " * ODK survey that were combined into a common XML schema using      * \n";
    title = title + " * compareCreateXML.                                                 * \n";
    title = title + " ********************************************************************* \n";

    TCLAP::CmdLine cmd(title.toUtf8().constData(), ' ', "2.0");

    TCLAP::ValueArg<std::string> inputArg("i","input","Input create XML file",true,"","string");
    TCLAP::ValueArg<std::string> outputArg("o","output","Output SQL file",false,"./create.sql","string");

    for (int i = 1; i < argc; i++)
    {
        command = command + argv[i] + " ";
    }

    cmd.add(inputArg);
    cmd.add(outputArg);

    //Parsing the command lines
    cmd.parse( argc, argv );

    //Getting the variables from the command
    QString input = QString::fromUtf8(inputArg.getValue().c_str());
    QString output = QString::fromUtf8(outputArg.getValue().c_str());
    idx = 0;

    if (input != output)
    {
        if (QFile::exists(input))
        {
            //Openning and parsing input file A
            QDomDocument docA("input");
            QFile fileA(input);
            if (!fileA.open(QIODevice::ReadOnly))
            {
                log("Cannot open input file");
                return 1;
            }
            if (!docA.setContent(&fileA))
            {
                log("Cannot parse input file");
                fileA.close();
                return 1;
            }
            fileA.close();

            QDomElement rootA = docA.documentElement();

            if (rootA.tagName() == "XMLSchemaStructure")
            {
                QFile file(output);
                if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
                {
                    log("Cannot create output file");
                    return 1;
                }

                QDateTime date;
                date = QDateTime::currentDateTime();

                QTextStream out(&file);

                out << "-- Code generated by createFromXML" << "\n";
                out << "-- " + command << "\n";
                out << "-- Created: " + date.toString("ddd MMMM d yyyy h:m:s ap")  << "\n";
                out << "-- by: createFromXML Version 1.0" << "\n";
                out << "-- WARNING! All changes made in this file might be lost when running createFromXML again" << "\n\n";

                QDomNode lkpTables = docA.documentElement().firstChild();
                QDomNode tables = docA.documentElement().firstChild().nextSibling();
                if (!lkpTables.isNull())
                {
                    procLKPTables(lkpTables.firstChild(),out);
                }
                if (!tables.isNull())
                {
                    procTables(tables.firstChild(),out);
                }
            }
            else
            {
                log("Input document is not a XML create file");
                return 1;
            }
        }
        else
        {
            log("Input file does not exists");
            return 1;
        }
    }
    else
//.........这里部分代码省略.........
开发者ID:ilri,项目名称:odktools,代码行数:101,代码来源:main.cpp

示例14: getOption

void SdpSolverInternal::init() {
  // Call the init method of the base class
  FunctionInternal::init();

  calc_p_ = getOption("calc_p");
  calc_dual_ = getOption("calc_dual");
  print_problem_ = getOption("print_problem");

  // Find aggregate sparsity pattern
  Sparsity aggregate = input(SDP_SOLVER_G).sparsity();
  for (int i=0;i<n_;++i) {
    aggregate = aggregate + input(SDP_SOLVER_F)(ALL, Slice(i*m_, (i+1)*m_)).sparsity();
  }

  // Detect block diagonal structure in this sparsity pattern
  std::vector<int> p;
  std::vector<int> r;
  nb_ = aggregate.stronglyConnectedComponents(p, r);
  block_boundaries_.resize(nb_+1);
  std::copy(r.begin(), r.begin()+nb_+1, block_boundaries_.begin());

  block_sizes_.resize(nb_);
  for (int i=0;i<nb_;++i) {
    block_sizes_[i]=r[i+1]-r[i];
  }

  // Make a mapping function from dense blocks to inversely-permuted block diagonal P
  std::vector< SX > full_blocks;
  for (int i=0;i<nb_;++i) {
    full_blocks.push_back(SX::sym("block", block_sizes_[i], block_sizes_[i]));
  }

  Pmapper_ = SXFunction(full_blocks, blkdiag(full_blocks)(lookupvector(p, p.size()),
                                                         lookupvector(p, p.size())));
  Pmapper_.init();

  if (nb_>0) {
    // Make a mapping function from (G, F) -> (G[p, p]_j, F_i[p, p]j)
    SX G = SX::sym("G", input(SDP_SOLVER_G).sparsity());
    SX F = SX::sym("F", input(SDP_SOLVER_F).sparsity());

    std::vector<SX> in;
    in.push_back(G);
    in.push_back(F);
    std::vector<SX> out((n_+1)*nb_);
    for (int j=0;j<nb_;++j) {
      out[j] = G(p, p)(Slice(r[j], r[j+1]), Slice(r[j], r[j+1]));
    }
    for (int i=0;i<n_;++i) {
      SX Fi = F(ALL, Slice(i*m_, (i+1)*m_))(p, p);
      for (int j=0;j<nb_;++j) {
        out[(i+1)*nb_+j] = Fi(Slice(r[j], r[j+1]), Slice(r[j], r[j+1]));
      }
    }
    mapping_ = SXFunction(in, out);
    mapping_.init();
  }

  // Output arguments
  setNumOutputs(SDP_SOLVER_NUM_OUT);
  output(SDP_SOLVER_X) = DMatrix::zeros(n_, 1);
  output(SDP_SOLVER_P) = calc_p_? DMatrix(Pmapper_.output().sparsity(), 0) : DMatrix();
  output(SDP_SOLVER_DUAL) = calc_dual_? DMatrix(Pmapper_.output().sparsity(), 0) : DMatrix();
  output(SDP_SOLVER_COST) = 0.0;
  output(SDP_SOLVER_DUAL_COST) = 0.0;
  output(SDP_SOLVER_LAM_X) = DMatrix::zeros(n_, 1);
  output(SDP_SOLVER_LAM_A) = DMatrix::zeros(nc_, 1);

}
开发者ID:tmmsartor,项目名称:casadi,代码行数:69,代码来源:sdp_solver_internal.cpp

示例15: die_alarm

void die_alarm() { logit("timeout"); out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); }
开发者ID:kp-org,项目名称:eQmail,代码行数:1,代码来源:qmail-smtpd.c


注:本文中的out函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。