您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ temp函数代码示例

51自学网 2021-06-03 08:43:41
  C++
这篇教程C++ temp函数代码示例写得很实用,希望能帮到您。

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

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

示例1: temp

 sorted_unique_rmat_iterator operator++(int) {   sorted_unique_rmat_iterator temp(*this);   ++(*this);   return temp; }
开发者ID:Alexander--,项目名称:Wesnoth-1.8-for-Android,代码行数:6,


示例2: switch

voidvec4_tes_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr){   const struct brw_tes_prog_data *tes_prog_data =      (const struct brw_tes_prog_data *) prog_data;   switch (instr->intrinsic) {   case nir_intrinsic_load_tess_coord:      /* gl_TessCoord is part of the payload in g1 channels 0-2 and 4-6. */      emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),               src_reg(brw_vec8_grf(1, 0))));      break;   case nir_intrinsic_load_tess_level_outer:      if (tes_prog_data->domain == BRW_TESS_DOMAIN_ISOLINE) {         emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),                  swizzle(src_reg(ATTR, 1, glsl_type::vec4_type),                          BRW_SWIZZLE_ZWZW)));      } else {         emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),                  swizzle(src_reg(ATTR, 1, glsl_type::vec4_type),                          BRW_SWIZZLE_WZYX)));      }      break;   case nir_intrinsic_load_tess_level_inner:      if (tes_prog_data->domain == BRW_TESS_DOMAIN_QUAD) {         emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),                  swizzle(src_reg(ATTR, 0, glsl_type::vec4_type),                          BRW_SWIZZLE_WZYX)));      } else {         emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),                  src_reg(ATTR, 1, glsl_type::float_type)));      }      break;   case nir_intrinsic_load_primitive_id:      emit(TES_OPCODE_GET_PRIMITIVE_ID,           get_nir_dest(instr->dest, BRW_REGISTER_TYPE_UD));      break;   case nir_intrinsic_load_input:   case nir_intrinsic_load_per_vertex_input: {      src_reg indirect_offset = get_indirect_offset(instr);      unsigned imm_offset = instr->const_index[0];      src_reg header = input_read_header;      bool is_64bit = nir_dest_bit_size(instr->dest) == 64;      unsigned first_component = nir_intrinsic_component(instr);      if (is_64bit)         first_component /= 2;      if (indirect_offset.file != BAD_FILE) {         header = src_reg(this, glsl_type::uvec4_type);         emit(TES_OPCODE_ADD_INDIRECT_URB_OFFSET, dst_reg(header),              input_read_header, indirect_offset);      } else {         /* Arbitrarily only push up to 24 vec4 slots worth of data,          * which is 12 registers (since each holds 2 vec4 slots).          */         const unsigned max_push_slots = 24;         if (imm_offset < max_push_slots) {            const glsl_type *src_glsl_type =               is_64bit ? glsl_type::dvec4_type : glsl_type::ivec4_type;            src_reg src = src_reg(ATTR, imm_offset, src_glsl_type);            src.swizzle = BRW_SWZ_COMP_INPUT(first_component);            const brw_reg_type dst_reg_type =               is_64bit ? BRW_REGISTER_TYPE_DF : BRW_REGISTER_TYPE_D;            emit(MOV(get_nir_dest(instr->dest, dst_reg_type), src));            prog_data->urb_read_length =               MAX2(prog_data->urb_read_length,                    DIV_ROUND_UP(imm_offset + (is_64bit ? 2 : 1), 2));            break;         }      }      if (!is_64bit) {         dst_reg temp(this, glsl_type::ivec4_type);         vec4_instruction *read =            emit(VEC4_OPCODE_URB_READ, temp, src_reg(header));         read->offset = imm_offset;         read->urb_write_flags = BRW_URB_WRITE_PER_SLOT_OFFSET;         src_reg src = src_reg(temp);         src.swizzle = BRW_SWZ_COMP_INPUT(first_component);         /* Copy to target.  We might end up with some funky writemasks landing          * in here, but we really don't want them in the above pseudo-ops.          */         dst_reg dst = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);         dst.writemask = brw_writemask_for_size(instr->num_components);         emit(MOV(dst, src));      } else {         /* For 64-bit we need to load twice as many 32-bit components, and for          * dvec3/4 we need to emit 2 URB Read messages          */         dst_reg temp(this, glsl_type::dvec4_type);         dst_reg temp_d = retype(temp, BRW_REGISTER_TYPE_D);         vec4_instruction *read =            emit(VEC4_OPCODE_URB_READ, temp_d, src_reg(header));         read->offset = imm_offset;//.........这里部分代码省略.........
开发者ID:elgambitero,项目名称:Mesa-3D,代码行数:101,


示例3: temp

ParamValue& ParamValue::operator=( const ParamValue &other ){    ParamValue temp( other );    swap( temp );    return *this;}
开发者ID:cardsystem,项目名称:CardPrinter,代码行数:6,


示例4: gmx_traj

int gmx_traj(int argc, char *argv[]){    const char     *desc[] = {        "[THISMODULE] plots coordinates, velocities, forces and/or the box.",        "With [TT]-com[tt] the coordinates, velocities and forces are",        "calculated for the center of mass of each group.",        "When [TT]-mol[tt] is set, the numbers in the index file are",        "interpreted as molecule numbers and the same procedure as with",        "[TT]-com[tt] is used for each molecule.[PAR]",        "Option [TT]-ot[tt] plots the temperature of each group,",        "provided velocities are present in the trajectory file.",        "No corrections are made for constrained degrees of freedom!",        "This implies [TT]-com[tt].[PAR]",        "Options [TT]-ekt[tt] and [TT]-ekr[tt] plot the translational and",        "rotational kinetic energy of each group,",        "provided velocities are present in the trajectory file.",        "This implies [TT]-com[tt].[PAR]",        "Options [TT]-cv[tt] and [TT]-cf[tt] write the average velocities",        "and average forces as temperature factors to a [TT].pdb[tt] file with",        "the average coordinates or the coordinates at [TT]-ctime[tt].",        "The temperature factors are scaled such that the maximum is 10.",        "The scaling can be changed with the option [TT]-scale[tt].",        "To get the velocities or forces of one",        "frame set both [TT]-b[tt] and [TT]-e[tt] to the time of",        "desired frame. When averaging over frames you might need to use",        "the [TT]-nojump[tt] option to obtain the correct average coordinates.",        "If you select either of these option the average force and velocity",        "for each atom are written to an [TT].xvg[tt] file as well",        "(specified with [TT]-av[tt] or [TT]-af[tt]).[PAR]",        "Option [TT]-vd[tt] computes a velocity distribution, i.e. the",        "norm of the vector is plotted. In addition in the same graph",        "the kinetic energy distribution is given."    };    static gmx_bool bMol    = FALSE, bCom = FALSE, bPBC = TRUE, bNoJump = FALSE;    static gmx_bool bX      = TRUE, bY = TRUE, bZ = TRUE, bNorm = FALSE, bFP = FALSE;    static int      ngroups = 1;    static real     ctime   = -1, scale = 0, binwidth = 1;    t_pargs         pa[]    = {        { "-com", FALSE, etBOOL, {&bCom},          "Plot data for the com of each group" },        { "-pbc", FALSE, etBOOL, {&bPBC},          "Make molecules whole for COM" },        { "-mol", FALSE, etBOOL, {&bMol},          "Index contains molecule numbers iso atom numbers" },        { "-nojump", FALSE, etBOOL, {&bNoJump},          "Remove jumps of atoms across the box" },        { "-x", FALSE, etBOOL, {&bX},          "Plot X-component" },        { "-y", FALSE, etBOOL, {&bY},          "Plot Y-component" },        { "-z", FALSE, etBOOL, {&bZ},          "Plot Z-component" },        { "-ng",       FALSE, etINT, {&ngroups},          "Number of groups to consider" },        { "-len", FALSE, etBOOL, {&bNorm},          "Plot vector length" },        { "-fp", FALSE, etBOOL, {&bFP},          "Full precision output" },        { "-bin", FALSE, etREAL, {&binwidth},          "Binwidth for velocity histogram (nm/ps)" },        { "-ctime", FALSE, etREAL, {&ctime},          "Use frame at this time for x in [TT]-cv[tt] and [TT]-cf[tt] instead of the average x" },        { "-scale", FALSE, etREAL, {&scale},          "Scale factor for [TT].pdb[tt] output, 0 is autoscale" }    };    FILE           *outx   = NULL, *outv = NULL, *outf = NULL, *outb = NULL, *outt = NULL;    FILE           *outekt = NULL, *outekr = NULL;    t_topology      top;    int             ePBC;    real           *mass, time;    char            title[STRLEN];    const char     *indexfn;    t_trxframe      fr, frout;    int             flags, nvhisto = 0, *vhisto = NULL;    rvec           *xtop, *xp = NULL;    rvec           *sumx = NULL, *sumv = NULL, *sumf = NULL;    matrix          topbox;    t_trxstatus    *status;    t_trxstatus    *status_out = NULL;    gmx_rmpbc_t     gpbc       = NULL;    int             i, j, n;    int             nr_xfr, nr_vfr, nr_ffr;    char          **grpname;    int            *isize0, *isize;    atom_id       **index0, **index;    atom_id        *atndx;    t_block        *mols;    gmx_bool        bTop, bOX, bOXT, bOV, bOF, bOB, bOT, bEKT, bEKR, bCV, bCF;    gmx_bool        bDim[4], bDum[4], bVD;    char           *sffmt, sffmt6[1024];    const char     *box_leg[6] = { "XX", "YY", "ZZ", "YX", "ZX", "ZY" };    output_env_t    oenv;    t_filenm        fnm[] = {        { efTRX, "-f", NULL, ffREAD },        { efTPS, NULL, NULL, ffREAD },        { efNDX, NULL, NULL, ffOPTRD },        { efXVG, "-ox", "coord.xvg", ffOPTWR },        { efTRX, "-oxt", "coord.xtc", ffOPTWR },        { efXVG, "-ov", "veloc.xvg", ffOPTWR },//.........这里部分代码省略.........
开发者ID:exianshine,项目名称:gromacs,代码行数:101,


示例5: WStringToString

				static std::string WStringToString(std::wstring &s)				{					std::string temp(s.length(), ' ');					std::copy(s.begin(), s.end(), temp.begin());					return temp; 				}
开发者ID:SmartActiveNode2,项目名称:san2,代码行数:6,


示例6: SerializeField

void SerializeField(google::protobuf::Message *message, const Reflection *r, const FieldDescriptor *field, Handle<Value> val) {	const EnumValueDescriptor *enumValue = NULL;	bool repeated = field->is_repeated();	if (*val != NULL) {		if (field->is_optional() && (val->IsNull() || val->IsUndefined()))			return;		switch (field->cpp_type()) {			case FieldDescriptor::CPPTYPE_INT32: {				if (repeated)					r->AddInt32(message, field, val->Int32Value());				else					r->SetInt32(message, field, val->Int32Value());				break;			}			case FieldDescriptor::CPPTYPE_INT64:				if (repeated)					if (preserve_int64 && val->IsArray()) {						Handle<Object> n64_array = val->ToObject();						uint64 n64;						uint32 hi = n64_array->Get(0)->Uint32Value(), lo = n64_array->Get(1)->Uint32Value();						n64 = ((uint64)hi << 32) + (uint64)lo;						r->AddInt64(message, field, n64);					} else if (preserve_int64 && val->IsString()) {						String::Utf8Value temp(val->ToString());						std::string value = std::string(*temp);						r->AddInt64(message, field, std::stoll(value, nullptr, 10));					} else						r->AddInt64(message, field, val->NumberValue());				else					if (preserve_int64 && val->IsArray()) {						Handle<Object> n64_array = val->ToObject();						uint64 n64;						uint32 hi = n64_array->Get(0)->Uint32Value(), lo = n64_array->Get(1)->Uint32Value();						n64 = ((uint64)hi << 32) + (uint64)lo;						r->SetInt64(message, field, n64);					} else if (preserve_int64 && val->IsString()) {						String::Utf8Value temp(val->ToString());						std::string value = std::string(*temp);						r->SetInt64(message, field, std::stoll(value, nullptr, 10));					} else						r->SetInt64(message, field, val->NumberValue());				break;			case FieldDescriptor::CPPTYPE_UINT32:				if (repeated)					r->AddUInt32(message, field, val->Uint32Value());				else					r->SetUInt32(message, field, val->Uint32Value());				break;			case FieldDescriptor::CPPTYPE_UINT64:				if (repeated)					if (preserve_int64 && val->IsArray()) {						Handle<Object> n64_array = val->ToObject();						uint64 n64;						uint32 hi = n64_array->Get(0)->Uint32Value(), lo = n64_array->Get(1)->Uint32Value();						n64 = ((uint64)hi << 32) + (uint64)lo;						r->AddUInt64(message, field, n64);					} else if (preserve_int64 && val->IsString()) {						String::Utf8Value temp(val->ToString());						std::string value = std::string(*temp);						r->AddUInt64(message, field, std::stoull(value, nullptr, 10));					} else						r->AddUInt64(message, field, val->NumberValue());				else					if (preserve_int64 && val->IsArray()) {						Handle<Object> n64_array = val->ToObject();						uint64 n64;						uint32 hi = n64_array->Get(0)->Uint32Value(), lo = n64_array->Get(1)->Uint32Value();						n64 = ((uint64)hi << 32) + (uint64)lo;						r->SetUInt64(message, field, n64);					} else if (preserve_int64 && val->IsString()) {						String::Utf8Value temp(val->ToString());						std::string value = std::string(*temp);						r->SetUInt64(message, field, std::stoull(value, nullptr, 10));					} else {						r->SetUInt64(message, field, val->NumberValue());					}				break;			case FieldDescriptor::CPPTYPE_DOUBLE:				if (repeated)					r->AddDouble(message, field, val->NumberValue());				else					r->SetDouble(message, field, val->NumberValue());				break;			case FieldDescriptor::CPPTYPE_FLOAT:				if (repeated)					r->AddFloat(message, field, val->NumberValue());				else					r->SetFloat(message, field, val->NumberValue());				break;			case FieldDescriptor::CPPTYPE_BOOL:				if (repeated)					r->AddBool(message, field, val->BooleanValue());				else					r->SetBool(message, field, val->BooleanValue());				break;			case FieldDescriptor::CPPTYPE_ENUM:				// TODO: possible memory leak?				enumValue =//.........这里部分代码省略.........
开发者ID:bgdavidx,项目名称:node-protobuf,代码行数:101,


示例7: temp

 scalable_rmat_iterator operator++(int) {     scalable_rmat_iterator temp(*this);     ++(*this);     return temp; }
开发者ID:JupiterSmalltalk,项目名称:openqwaq,代码行数:6,


示例8: temp

ReflectedObject::ReflectedObject( const char* upperTexture, GLint reflectedText )    :reflectedTexture( reflectedText ){    string temp( upperTexture );    tFile = temp;}
开发者ID:aru,项目名称:superhappyrocket,代码行数:6,


示例9: computeInitialDelta

void SecondOrderTrustRegion::doOptimize(OptimizationProblemSecond& problem) {#ifdef NICE_USELIB_LINAL  bool previousStepSuccessful = true;  double previousError = problem.objective();  problem.computeGradientAndHessian();  double delta = computeInitialDelta(problem.gradientCached(), problem.hessianCached());  double normOldPosition = 0.0;    // iterate  for (int iteration = 0; iteration < maxIterations; iteration++) {//     Log::debug() << "iteration, objective: " << iteration << ", "//                   << problem.objective() << std::endl;        if (previousStepSuccessful && iteration > 0) {      problem.computeGradientAndHessian();    }      // gradient-norm stopping condition    if (problem.gradientNormCached() < epsilonG) {      Log::debug() << "SecondOrderTrustRegion stopped: gradientNorm "                   << iteration << std::endl;      break;    }        LinAlVector gradient(problem.gradientCached().linalCol());    LinAlVector negativeGradient(gradient);    negativeGradient.multiply(-1.0);    double lambda;    int lambdaMinIndex = -1;    // FIXME will this copy the matrix? no copy needed here!    LinAlMatrix hessian(problem.hessianCached().linal());    LinAlMatrix l(hessian);    try {      //l.CHdecompose(); // FIXME      choleskyDecompose(hessian, l);            lambda = 0.0;    } catch (...) { //(LinAl::BLException& e) { // FIXME      const LinAlVector& eigenValuesHessian = LinAl::eigensym(hessian);      // find smallest eigenvalue      lambda = std::numeric_limits<double>::infinity();      for (unsigned int i = 0; i < problem.dimension(); i++) {        const double eigenValue = eigenValuesHessian(i);        if (eigenValue < lambda) {          lambda = eigenValue;          lambdaMinIndex = i;        }      }      const double originalLambda = lambda;      lambda = -lambda * (1.0 + epsilonLambda);            l = hessian;      for (unsigned int i = 0; i < problem.dimension(); i++) {        l(i, i) += lambda;      }      try {        //l.CHdecompose(); // FIXME        LinAlMatrix temp(l);        choleskyDecompose(temp, l);      } catch (...) { // LinAl::BLException& e) { // FIXME        /*         * Cholesky factorization failed, which should theortically not be         * possible (can still happen due to numeric problems,         * also note that there seems to be a bug in CHdecompose()).         * Try a really great lambda as last attempt.         */        //         lambda = -originalLambda * (1.0 + epsilonLambda * 100.0)//                  + 2.0 * epsilonM;        lambda = fabs(originalLambda) * (1.0 + epsilonLambda * 1E5)                 + 1E3 * epsilonM;//        lambda = fabs(originalLambda);// * 15.0;        l = hessian;        for (unsigned int i = 0; i < problem.dimension(); i++) {          l(i, i) += lambda;        }        try {          //l.CHdecompose(); // FIXME          LinAlMatrix temp(l);          choleskyDecompose(temp, l);        } catch (...) { // (LinAl::BLException& e) { // FIXME          // Cholesky factorization failed again, give up.          l = hessian;          for (unsigned int i = 0; i < problem.dimension(); i++) {            l(i, i) += lambda;          }          const LinAlVector& eigenValuesL = LinAl::eigensym(l);                              Log::detail()               << "l.CHdecompose: exception" << std::endl              //<< e.what() << std::endl // FIXME               << "lambda=" << lambda << std::endl               << "l" << std::endl << l               << "hessian" << std::endl << hessian               << "gradient" << std::endl << gradient               << "eigenvalues hessian" << std::endl << eigenValuesHessian               << "eigenvalues l" << std::endl << eigenValuesL               << std::endl;//.........这里部分代码省略.........
开发者ID:K4stor,项目名称:nice-core,代码行数:101,


示例10: time

AlignmentDB::AlignmentDB(string fastaFileName, string s, int kmerSize, float gapOpen, float gapExtend, float match, float misMatch, int tid, bool writeShortcut){		//	This assumes that the template database is in fasta format, may	try {											//	need to alter this in the future?		m = MothurOut::getInstance();        current = CurrentFile::getInstance();		longest = 0;		method = s;		bool needToGenerate = true;		threadID = tid;		Utils util;                long start = time(NULL);        m->mothurOut("/nReading in the " + fastaFileName + " template sequences.../t");	cout.flush();        //bool aligned = false;        int tempLength = 0;                ifstream fastaFile;        util.openInputFile(fastaFileName, fastaFile);                while (!fastaFile.eof()) {            Sequence temp(fastaFile);  util.gobble(fastaFile);                        if (m->getControl_pressed()) {  templateSequences.clear(); break;  }                        if (temp.getName() != "") {                templateSequences.push_back(temp);                                //save longest base                if (temp.getUnaligned().length() >= longest)  { longest = ((int)temp.getUnaligned().length()+1); }                                if (tempLength != 0) {                    if (tempLength != temp.getAligned().length()) { m->mothurOut("[ERROR]: template is not aligned, aborting./n"); m->setControl_pressed(true); }                }else { tempLength = (int)temp.getAligned().length(); }            }        }        fastaFile.close();                numSeqs = (int)templateSequences.size();        //all of this is elsewhere already!                m->mothurOut("DONE./n");        cout.flush();        m->mothurOut("It took " + toString(time(NULL) - start) + " to read  " + toString(templateSequences.size()) + " sequences./n");   				//in case you delete the seqs and then ask for them		emptySequence = Sequence();		emptySequence.setName("no_match");		emptySequence.setUnaligned("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");		emptySequence.setAligned("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");						string kmerDBName;		if(method == "kmer")			{				search = new KmerDB(fastaFileName, kmerSize);			            kmerDBName = fastaFileName.substr(0,fastaFileName.find_last_of(".")+1) + char('0'+ kmerSize) + "mer";                        ifstream kmerFileTest(kmerDBName.c_str());				            if(kmerFileTest){                string line = util.getline(kmerFileTest);                bool GoodFile = util.checkReleaseVersion(line, current->getVersion());  kmerFileTest.close();                int shortcutTimeStamp = util.getTimeStamp(kmerDBName);                int referenceTimeStamp = util.getTimeStamp(fastaFileName);                                //if the shortcut file is older then the reference file, remake shortcut file                if (shortcutTimeStamp < referenceTimeStamp) {  GoodFile = false;  }                                if (GoodFile) {  needToGenerate = false;	}            }					}		else if(method == "suffix")		{	search = new SuffixDB(numSeqs);								}		else if(method == "blast")		{	search = new BlastDB(fastaFileName.substr(0,fastaFileName.find_last_of(".")+1), gapOpen, gapExtend, match, misMatch, "", threadID);	}		else {			method = "kmer";			m->mothurOut(method + " is not a valid search option. I will run the command using kmer, ksize=8./n");			search = new KmerDB(fastaFileName, 8);		}				if (!m->getControl_pressed()) {			if (needToGenerate) {				//add sequences to search 				for (int i = 0; i < templateSequences.size(); i++) {					search->addSequence(templateSequences[i]);										if (m->getControl_pressed()) {  templateSequences.clear(); break;  }				}								if (m->getControl_pressed()) {  templateSequences.clear();  }				                if ((method != "kmer") || ((method == "kmer") && (writeShortcut))) { search->generateDB(); }                			}else if ((method == "kmer") && (!needToGenerate)) {				ifstream kmerFileTest(kmerDBName.c_str());				search->readKmerDB(kmerFileTest);				}					search->setNumSeqs(numSeqs);		}//.........这里部分代码省略.........
开发者ID:mothur,项目名称:mothur,代码行数:101,


示例11: temp

 TestCase& TestCase::operator = ( TestCase const& other ) {     TestCase temp( other );     swap( temp );     return *this; }
开发者ID:Kegley,项目名称:COP3530Proj2,代码行数:5,


示例12: temp

	void MatrixStack::MultMatrix(const Matrix4Df& matrixRHS)	{		Matrix4Df temp(matrixRHS * m_stack.top());		PopMatrix();		m_stack.push(temp);	}
开发者ID:TrevinLiberty,项目名称:CaptainLucha,代码行数:6,


示例13: temp

 inline Derived operator--(int) {   Derived temp(*this);   --_id;   return temp; }
开发者ID:Corralx,项目名称:leviathan,代码行数:6,


示例14: temp

Vector4D<double> Vector4D<double>::Normalized(){	Vector4D<double> temp(*this);	temp.Normalize();	return temp;}
开发者ID:mindmastre,项目名称:DX11-Framework,代码行数:6,


示例15: TypeManager_FindType

//------------------------------------------------------------VIREO_EXPORT TypeRef TypeManager_FindType(TypeManagerRef typeManager, const char* typeName){    SubString temp(typeName);    return typeManager->FindType(&temp);}
开发者ID:ni,项目名称:VireoSDK,代码行数:6,


示例16: diagonal_

    SymmetricSchurDecomposition::SymmetricSchurDecomposition(const Matrix & s)    : diagonal_(s.rows()), eigenVectors_(s.rows(), s.columns(), 0.0) {        QL_REQUIRE(s.rows() > 0 && s.columns() > 0, "null matrix given");        QL_REQUIRE(s.rows()==s.columns(), "input matrix must be square");        Size size = s.rows();        for (Size q=0; q<size; q++) {            diagonal_[q] = s[q][q];            eigenVectors_[q][q] = 1.0;        }        Matrix ss = s;        std::vector<Real> tmpDiag(diagonal_.begin(), diagonal_.end());        std::vector<Real> tmpAccumulate(size, 0.0);        Real threshold, epsPrec = 1e-15;        bool keeplooping = true;        Size maxIterations = 100, ite = 1;        do {            //main loop            Real sum = 0;            for (Size a=0; a<size-1; a++) {                for (Size b=a+1; b<size; b++) {                    sum += std::fabs(ss[a][b]);                }            }            if (sum==0) {                keeplooping = false;            } else {                /* To speed up computation a threshold is introduced to                   make sure it is worthy to perform the Jacobi rotation                */                if (ite<5) threshold = 0.2*sum/(size*size);                else       threshold = 0.0;                Size j, k, l;                for (j=0; j<size-1; j++) {                    for (k=j+1; k<size; k++) {                        Real sine, rho, cosin, heig, tang, beta;                        Real smll = std::fabs(ss[j][k]);                        if(ite> 5 &&                           smll<epsPrec*std::fabs(diagonal_[j]) &&                           smll<epsPrec*std::fabs(diagonal_[k])) {                                ss[j][k] = 0;                        } else if (std::fabs(ss[j][k])>threshold) {                            heig = diagonal_[k]-diagonal_[j];                            if (smll<epsPrec*std::fabs(heig)) {                                tang = ss[j][k]/heig;                            } else {                                beta = 0.5*heig/ss[j][k];                                tang = 1.0/(std::fabs(beta)+                                    std::sqrt(1+beta*beta));                                if (beta<0)                                    tang = -tang;                            }                            cosin = 1/std::sqrt(1+tang*tang);                            sine = tang*cosin;                            rho = sine/(1+cosin);                            heig = tang*ss[j][k];                            tmpAccumulate[j] -= heig;                            tmpAccumulate[k] += heig;                            diagonal_[j] -= heig;                            diagonal_[k] += heig;                            ss[j][k] = 0.0;                            for (l=0; l+1<=j; l++)                                jacobiRotate_(ss, rho, sine, l, j, l, k);                            for (l=j+1; l<=k-1; l++)                                jacobiRotate_(ss, rho, sine, j, l, l, k);                            for (l=k+1; l<size; l++)                                jacobiRotate_(ss, rho, sine, j, l, k, l);                            for (l=0;   l<size; l++)                                jacobiRotate_(eigenVectors_,                                                  rho, sine, l, j, l, k);                        }                    }                }                for (k=0; k<size; k++) {                    tmpDiag[k] += tmpAccumulate[k];                    diagonal_[k] = tmpDiag[k];                    tmpAccumulate[k] = 0.0;                }            }        } while (++ite<=maxIterations && keeplooping);        QL_ENSURE(ite<=maxIterations,                  "Too many iterations (" << maxIterations << ") reached");        // sort (eigenvalues, eigenvectors)        std::vector<std::pair<Real, std::vector<Real> > > temp(size);        std::vector<Real> eigenVector(size);        Size row, col;        for (col=0; col<size; col++) {            std::copy(eigenVectors_.column_begin(col),                      eigenVectors_.column_end(col), eigenVector.begin());            temp[col] = std::make_pair(diagonal_[col], eigenVector);        }        std::sort(temp.begin(), temp.end(),            std::greater<std::pair<Real, std::vector<Real> > >());//.........这里部分代码省略.........
开发者ID:androidYibo,项目名称:documents,代码行数:101,


示例17: main

int main(int narg,char **arg){  init_latpars();    //read ensemble list, meson masses and meson name  FILE *an_input_file=open_file("analysis_pars","r");  char meson_name[1024];  read_formatted_from_file_expecting((char*)&include_a4,an_input_file,"%d","include_a4");  read_formatted_from_file_expecting((char*)&include_380,an_input_file,"%d","include_380");  read_formatted_from_file_expecting((char*)&include_ml_term,an_input_file,"%d","include_ml_term");  read_formatted_from_file_expecting((char*)&nens,an_input_file,"%d","nens");  read_formatted_from_file_expecting(meson_name,an_input_file,"%s","meson_name");  lmass=new double[nens];  ibeta=new int[nens];  F=bvec(nens,nboot,njack);  ofstream bare_data_table("bare_data_table");  for(int iens=0;iens<nens;iens++)    {      char path[1024];      read_formatted_from_file((char*)&(ibeta[iens]),an_input_file,"%d","ibeta");      read_formatted_from_file((char*)&(lmass[iens]),an_input_file,"%lg","lmass");      read_formatted_from_file(path,an_input_file,"%s","path");            jack temp(njack);      temp.load(combine("../%s/%s",path,meson_name).c_str());      //write the bare data table      bare_data_table<<path<<" "<<smart_print(temp)<<endl;            //load iboot      int iboot_jack[100];      load_iboot(iboot_jack,path);            boot_from_jack(F.data[iens],temp,iboot_jack);    }  fclose(an_input_file);    //define ml and ref ml  ml=bvec(nens,nboot,njack);  for(int iens=0;iens<nens;iens++)    {            int b=ibeta[iens],r=ref_ml_beta[b];      //define ml      cout<<iens<<" "<<b<<" "<<lmass[iens]<<endl;      ml[iens]=lmass[iens]/lat[b]/Zp[b];      //set the lighter mass      if(r==-1||fabs(ml[r].med()-0.050)>fabs(ml[iens].med()-0.050)) ref_ml_beta[b]=iens;    }  cout<<"---"<<endl;  for(int ib=0;ib<nbeta;ib++) if(ref_ml_beta[ib]!=-1) cout<<"Ref "<<ib<<" = "<<ref_ml_beta[ib]<<", "<<ml[ref_ml_beta[ib]]<<" MeV"<<endl;  cout<<"---"<<endl;  //perform the fit  boot A(nboot,njack),B(nboot,njack),C(nboot,njack),D(nboot,njack);  fit(A,B,C,D,ml,F);    //chiral extrapolation  bvec F_chir(nbeta,nboot,njack);  boot F_chir_cont(nboot,njack);  bvec F_estr_ml(nbeta,nboot,njack);  for(int iboot=0;iboot<nboot+1;iboot++)    {      F_chir_cont.data[iboot]=fun_fit_F(A[iboot],B[iboot],C[iboot],D[iboot],ml_phys[iboot],0);      for(int ib=0;ib<nbeta;ib++)	{	  int r=ref_ml_beta[ib];	  F_chir[ib].data[iboot]=fun_fit_F(A[iboot],B[iboot],C[iboot],D[iboot],ml_phys[iboot],lat[ib][iboot]);	  if(r!=-1)	    F_estr_ml.data[ib].data[iboot]=F[r][iboot]*fun_fit_F(A[nboot],B[nboot],C[nboot],D[nboot],ml_phys[nboot],0)/fun_fit_F(A[nboot],B[nboot],C[nboot],D[nboot],ml[r][nboot],0);	}    }    //chiral and continuum  cout<<"F = "<<F_chir_cont<<endl;  cout<<endl;    par_res_fit_F=bvec(4,nboot,njack);    par_res_fit_F.data[0]=A;  par_res_fit_F.data[1]=B;  par_res_fit_F.data[2]=C;  par_res_fit_F.data[3]=D;    const char tag_ml[1024]="m//sl//N//SMS,2GeV//N (GeV)";  const char tag_a2[1024]="a//S2//N (fm)";  double lat_med_fm[4]={lat[0].med()*hc,lat[1].med()*hc,lat[2].med()*hc,lat[3].med()*hc};    plot_funz_ml("F_funz_ml.xmg",meson_name,tag_ml,meson_name,ml,F,par_res_fit_F,ml_phys.med(),fun_fit_F,F_chir_cont);  plot_funz_a2("F_funz_a2.xmg",meson_name,tag_a2,meson_name,lat_med_fm,F_estr_ml,par_res_fit_F,fun_fit_F,F_chir_cont);  F_chir_cont.write_to_binfile("results");    return 0;}
开发者ID:sunpho84,项目名称:sunpho,代码行数:95,


示例18: swap

	void swap(T& a, T& b)	{		T temp(a);		a = b;		b = temp;	}
开发者ID:huganle,项目名称:code,代码行数:6,


示例19: temp

Rational  Rational::operator --(int i){    Rational temp(*this);    this->operator--();    return temp;}
开发者ID:pacs-course,项目名称:pacs,代码行数:6,


示例20: temp

void GradeBook::addCourse(int CRN){Course temp(CRN);list.insert(temp);} // addCourse()
开发者ID:bmbentson,项目名称:ecs60,代码行数:6,


示例21: fp

string fp(double value) {  string temp;  temp.reserve(fp(0, value));  fp(temp(), value);  return temp;}
开发者ID:and0p,项目名称:bnes-libretro,代码行数:6,


示例22: temp

vector<int> LefseCommand::runWilcoxon(vector<SharedRAbundVector*>& lookup, DesignMap& designMap, vector<int> bins) {    try {        vector<int> significantOtuLabels;        //if it exists and meets the following requirements run Wilcoxon        /*         1. Subclass members all belong to same main class         2. Number of groups in each subclass is the same         3. anything else??                  */        vector<string> subclasses;        map<string, string> subclass2Class;        map<string, int> subclassCounts;        map<string, vector<int> > subClass2GroupIndex; //maps subclass name to vector of indexes in lookup from that subclass. old -> 1,2,3 means groups in location 1,2,3 of lookup are from old.  Saves time below.        bool error = false;        for (int j = 0; j < lookup.size(); j++) {            string group = lookup[j]->getGroup();            string treatment = designMap.get(group, mclass); //get value for this group in this category            string thisSub = designMap.get(group, subclass);            map<string, string>::iterator it = subclass2Class.find(thisSub);            if (it == subclass2Class.end()) {                subclass2Class[thisSub] = treatment;                subclassCounts[thisSub] = 1;                vector<int> temp; temp.push_back(j);                subClass2GroupIndex[thisSub] = temp;            }            else {                subclassCounts[thisSub]++;                subClass2GroupIndex[thisSub].push_back(j);                if (it->second != treatment) {                    error = true;                    m->mothurOut("[ERROR]: subclass " + thisSub + " has members in " + it->second + " and " + treatment + ". Subclass members must be from the same class. Ignoring wilcoxon./n");                }            }        }                if (error) { return significantOtuLabels; }        else { //check counts to make sure subclasses are the same size            set<int> counts;            for (map<string, int>::iterator it = subclassCounts.begin(); it != subclassCounts.end(); it++) { counts.insert(it->second); }            if (counts.size() > 1) { m->mothurOut("[ERROR]: subclasses must be the same size. Ignoring wilcoxon./n");                return significantOtuLabels;  }        }                int numBins = lookup[0]->getNumBins();        vector<compGroup> comp;        //find comparisons and fill comp        map<string, int>::iterator itB;        for(map<string, int>::iterator it=subclassCounts.begin();it!=subclassCounts.end();it++){            itB = it;itB++;            for(itB;itB!=subclassCounts.end();itB++){                compGroup temp(it->first,itB->first);                comp.push_back(temp);            }			        }        int numComp = comp.size();        if (numComp < 2) {  m->mothurOut("[ERROR]: Need at least 2 subclasses, Ignoring Wilcoxon./n");            return significantOtuLabels;  }                map<string, string> variables;        variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile));        variables["[distance]"] = lookup[0]->getLabel();        string outputFileName = getOutputFileName("wilcoxon",variables);                ofstream out;        m->openOutputFile(outputFileName, out);        outputNames.push_back(outputFileName); outputTypes["wilcoxon"].push_back(outputFileName);        out << "OTULabel/tComparision/tWilcoxon/tPvalue/n";                LinearAlgebra linear;        for (int i = 0; i < numBins; i++) {            if (m->control_pressed) { break; }                        if (m->inUsersGroups(i, bins)) { //flagged in Kruskal Wallis                                bool sig = false;                //for each subclass comparision                for (int j = 0; j < numComp; j++) {                    //fill x and y with this comparisons data                    vector<double> x; vector<double> y;                                        //fill x and y                    vector<int> xIndexes = subClass2GroupIndex[comp[j].group1]; //indexes in lookup for this subclass                    for (int k = 0; k < xIndexes.size(); k++) { x.push_back(lookup[xIndexes[k]]->getAbundance(i)); }                                        vector<int> yIndexes = subClass2GroupIndex[comp[j].group2]; //indexes in lookup for this subclass                    for (int k = 0; k < yIndexes.size(); k++) { y.push_back(lookup[yIndexes[k]]->getAbundance(i)); }                                        double pValue = 0.0;                    double H = linear.calcWilcoxon(x, y, pValue);                                //output H and signifigance                    out << m->currentBinLabels[i] << '/t' << comp[j].getCombo() << '/t' << H << '/t' << pValue << endl;                                        //set sig - not sure how yet                }                if (sig) {  significantOtuLabels.push_back(i);  }            }        }//.........这里部分代码省略.........
开发者ID:azmfaridee,项目名称:mothur,代码行数:101,


示例23: CV_Assert

double cv::kmeans( InputArray _data, int K,                   InputOutputArray _bestLabels,                   TermCriteria criteria, int attempts,                   int flags, OutputArray _centers ){    const int SPP_TRIALS = 3;    Mat data0 = _data.getMat();    bool isrow = data0.rows == 1;    int N = isrow ? data0.cols : data0.rows;    int dims = (isrow ? 1 : data0.cols)*data0.channels();    int type = data0.depth();    attempts = std::max(attempts, 1);    CV_Assert( data0.dims <= 2 && type == CV_32F && K > 0 );    CV_Assert( N >= K );    Mat data(N, dims, CV_32F, data0.ptr(), isrow ? dims * sizeof(float) : static_cast<size_t>(data0.step));    _bestLabels.create(N, 1, CV_32S, -1, true);    Mat _labels, best_labels = _bestLabels.getMat();    if( flags & CV_KMEANS_USE_INITIAL_LABELS )    {        CV_Assert( (best_labels.cols == 1 || best_labels.rows == 1) &&                   best_labels.cols*best_labels.rows == N &&                   best_labels.type() == CV_32S &&                   best_labels.isContinuous());        best_labels.copyTo(_labels);    }    else    {        if( !((best_labels.cols == 1 || best_labels.rows == 1) &&                best_labels.cols*best_labels.rows == N &&                best_labels.type() == CV_32S &&                best_labels.isContinuous()))            best_labels.create(N, 1, CV_32S);        _labels.create(best_labels.size(), best_labels.type());    }    int* labels = _labels.ptr<int>();    Mat centers(K, dims, type), old_centers(K, dims, type), temp(1, dims, type);    std::vector<int> counters(K);    std::vector<Vec2f> _box(dims);    Vec2f* box = &_box[0];    double best_compactness = DBL_MAX, compactness = 0;    RNG& rng = theRNG();    int a, iter, i, j, k;    if( criteria.type & TermCriteria::EPS )        criteria.epsilon = std::max(criteria.epsilon, 0.);    else        criteria.epsilon = FLT_EPSILON;    criteria.epsilon *= criteria.epsilon;    if( criteria.type & TermCriteria::COUNT )        criteria.maxCount = std::min(std::max(criteria.maxCount, 2), 100);    else        criteria.maxCount = 100;    if( K == 1 )    {        attempts = 1;        criteria.maxCount = 2;    }    const float* sample = data.ptr<float>(0);    for( j = 0; j < dims; j++ )        box[j] = Vec2f(sample[j], sample[j]);    for( i = 1; i < N; i++ )    {        sample = data.ptr<float>(i);        for( j = 0; j < dims; j++ )        {            float v = sample[j];            box[j][0] = std::min(box[j][0], v);            box[j][1] = std::max(box[j][1], v);        }    }    for( a = 0; a < attempts; a++ )    {        double max_center_shift = DBL_MAX;        for( iter = 0;; )        {            swap(centers, old_centers);            if( iter == 0 && (a > 0 || !(flags & KMEANS_USE_INITIAL_LABELS)) )            {                if( flags & KMEANS_PP_CENTERS )                    generateCentersPP(data, centers, K, rng, SPP_TRIALS);                else                {                    for( k = 0; k < K; k++ )                        generateRandomCenter(_box, centers.ptr<float>(k), rng);                }            }            else            {                if( iter == 0 && a == 0 && (flags & KMEANS_USE_INITIAL_LABELS) )//.........这里部分代码省略.........
开发者ID:410pfeliciano,项目名称:opencv,代码行数:101,



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


C++ temp2函数代码示例
C++ tell_player函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。