• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ field类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: arma_extra_debug_sigprint

inline
void
subview_field<oT>::operator= (const field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  subview_field<oT>& t = *this;
  
  arma_debug_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols) || (t.n_slices != x.n_slices), "incompatible field dimensions");
  
  if(t.n_slices == 1)
    {
    for(uword col=0; col < t.n_cols; ++col)
    for(uword row=0; row < t.n_rows; ++row)
      {
      t.at(row,col) = x.at(row,col);
      }
    }
  else
    {
    for(uword slice=0; slice < t.n_slices; ++slice)
    for(uword col=0;   col   < t.n_cols;   ++col  )
    for(uword row=0;   row   < t.n_rows;   ++row  )
      {
      t.at(row,col,slice) = x.at(row,col,slice);
      }
    }
  }
开发者ID:2003pro,项目名称:armadillo,代码行数:28,代码来源:subview_field_meat.hpp


示例2: printFieldName

void oarchive_json::printFieldName(const field& att)
{
	if ( !this->_compact)
		this->_data << this->_tab << "\"" << att.name() << "\": ";
    else
        this->_data << "\"" << att.name() << "\":";
}
开发者ID:jmichael218,项目名称:laurena,代码行数:7,代码来源:oarchive_json.cpp


示例3: log_longF_svft

arma::vec log_longF_svft(const field<vec>& y, const field<vec>& eta,
                         const CharacterVector& fams, const CharacterVector& links,
                         const List& sigmas, const field<uvec>& id, const int& n) {
    int n_outcomes = y.size();
    vec out(n, fill::zeros);
    for (int i = 0; i < n_outcomes; ++i) {
        uvec id_i = id.at(i);
        vec y_i = y.at(i);
        vec eta_i = eta.at(i);
        if (fams[i] == "gaussian") {
            double sigma_i = as<double>(sigmas[i]);
            vec log_dens = - 0.5 * pow((y_i - eta_i) / sigma_i, 2);
            out += rowsum_svft(log_dens, id_i);
        } else if (fams[i] == "binomial") {
            if (links[i] == "logit") {
                vec pr = exp(eta_i) / (1 + exp(eta_i));
                vec log_dens = y_i % log(pr) + (1 - y_i) % log(1 - pr);
                out += rowsum_svft(log_dens, id_i);
            } else if (links[i] == "probit") {
                vec pr = Vpnorm_svft(eta_i);
                vec log_dens = y_i % log(pr) + (1 - y_i) % log(1 - pr);
                out += rowsum_svft(log_dens, id_i);
            } else if (links[i] == "cloglog") {
                vec pr = - exp(- exp(eta_i)) + 1;
                vec log_dens = y_i % log(pr) + (1 - y_i) % log(1 - pr);
                out += rowsum_svft(log_dens, id_i);
            }
        } else if (fams[i] == "poisson") {
            vec mu = exp(eta_i);
            vec log_dens = y_i % log(mu) - mu;
            out += rowsum_svft(log_dens, id_i);
        }
    }
    return(out);
}
开发者ID:cran,项目名称:JMbayes,代码行数:35,代码来源:survfitJM_mvJMbayes.cpp


示例4: DrawGraph

void draw_game::draw_Field(int x, int y, const field& object) const
{
	typedef enum GameObject::field::ERASE_CHK FLAG;
	auto field_size = object.get_size();
	x += offset.x;
	y += offset.y;
	//背景描画
	//DrawBox(x - frame_tickness, y - frame_tickness, x + (frame_tickness + block_size_.x) * field_size.x, y + (frame_tickness + block_size_.y) * field_size.y, GetColor(50, 50, 150), true);
	DrawGraph(x - frame_tickness, y - frame_tickness, *res[RES::FIELD], true);
	for (int i = 0; i < field_size.y; ++i)
	{
		for (int j = 0; j < field_size.x; ++j)
		{
			switch (object.get_flag(j, i))
			{
			case FLAG::WALLCONNECT:
			{
				util::scoped_dx_blendmode d(DX_BLENDMODE_ADD, 100);
				DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 255, 255), true
					);
			}
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), true);
				/*DxLib::SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
				DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 0, 255), true
					);*/
				break;
			case FLAG::ERASING:
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), true);
				if (object.get_block_const(j, i).get_block_type() != GameObject::WALL)
				{
					util::scoped_dx_blendmode d(DX_BLENDMODE_ALPHA, 255 - object.get_block_const(j, i).get_eraseframe() / 2);
					DrawBox(
					x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness),
					x + (j + 1) * (block_size_.x + frame_tickness) - frame_tickness, y + (i + 1) * (block_size_.y + frame_tickness) - frame_tickness,
					GetColor(255, 255, 0), true
					);
				}
				break;
			
			default:
				draw_Block(x + j * (block_size_.x + frame_tickness), y + i * (block_size_.y + frame_tickness), object.get_block_const(j, i), false);
			
				break;
			}
		}
	}
	//スコアの描画
	DrawFormatStringToHandle
		(x + ((block_size_.x + frame_tickness) * field_size.x) / 2,
		y + (block_size_.y + frame_tickness) * field_size.y + 5,
		GetColor(0, 0, 0), *res[FONT], "%d", object.get_score()
		);
}
开发者ID:happou31,项目名称:puzzle_game,代码行数:59,代码来源:draw_game.cpp


示例5:

inline
void
field_aux::reset_objects(field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  x.delete_objects();
  x.create_objects();
  }
开发者ID:iirob,项目名称:wire,代码行数:9,代码来源:field_meat.hpp


示例6: _add_field

	//must be called for all fields in derived when derived object instantiated
	void _add_field(field & F, const bool check_unique)
	{
		std::pair<std::map<boost::uint64_t, field *>::iterator, bool >
			p = Field.insert(std::make_pair(F.ID(), &F));
		if(check_unique && !p.second){
			LOG << "non-unique field ID " << F.ID();
			exit(1);
		}
	}
开发者ID:sbunce,项目名称:p2p,代码行数:10,代码来源:message.hpp


示例7: lin_predF_svft

arma::field<arma::vec> lin_predF_svft(const field<vec>& Xbetas, const field<mat>& Z,
                                      const mat& b, const field<uvec>& RE_inds,
                                      const field<uvec>& id) {
    signed int n_field = Xbetas.size();
    field<vec> out(n_field);
    for (int i = 0; i < n_field; ++i) {
        mat bb = b.cols(RE_inds.at(i));
        vec Zb = sum(Z.at(i) % bb.rows(id.at(i)), 1);
        out.at(i) = Xbetas.at(i) + Zb;
    }
    return(out);
}
开发者ID:cran,项目名称:JMbayes,代码行数:12,代码来源:survfitJM_mvJMbayes.cpp


示例8: GetColor

void draw_game::draw_Flags(int x, int y, const field& object) const
{
	auto field_size = object.get_size();
	typedef enum GameObject::field::ERASE_CHK FLAG;
	x += offset.x;
	y += offset.y;
	for (int i = 0; i < field_size.y; ++i)
	{
		for (int j = 0; j < field_size.x; ++j)
		{
			int flag = object.get_flag(j, i);
			std::string str;
			int color = 0;
			int color2 = object.connectnum[i * field_size.x + j] != 0 ? GetColor(255, 0, 0) : GetColor(255, 255, 255);
			switch (flag)
			{
			case FLAG::ERASE:
				str = "Er";
				color = GetColor(255, 0, 0);
				break;
			case FLAG::ERASING:
				str = "Eg";
				color = GetColor(255, 0, 0);
				break;
			case FLAG::WALLCONNECT:
				str = "Wc";
				color = GetColor(0, 255, 255);
				break;
			case FLAG::WALL_COOL_DOWN:
				str = "Cd";
				color = GetColor(255, 0, 255);
				break;
			default:
				str = "No";
				break;
			}
			if (object.get_block_const(j, i).is_new())
			{
				str = "Nw";
			}
			DrawString(3 + x + j * (block_size + frame_tickness), y + i * (block_size + frame_tickness), str.c_str(), color);
			DrawFormatString(3 + x + j * (block_size + frame_tickness), 20 + y + i * (block_size + frame_tickness), GetColor(255, 0, 255), "%d", object.connectnum[i * field_size.x + j]);
			DrawFormatString(3 + x + j * (block_size + frame_tickness), 40 + y + i * (block_size + frame_tickness), GetColor(255, 0, 255), "%d", object.get_block_const(j, i).get_eraseframe());

			//(j * (block_size_.x + 5), i * (block_size_.y + 5), object.get_block(j, i));
		}
	}
}
开发者ID:happou31,项目名称:puzzle_game,代码行数:48,代码来源:draw_game.cpp


示例9: force

    gsl::vector force(gsl::vector &position, gsl::vector &momentum, double time, int charge)
    {
        //values
        double momentum_squared=momentum.sum_of_squares();
        double momentum_magnitude=sqrt(momentum_squared);
        double G=gamma(momentum_squared);
        double inverse_gamma=1.0/G;

        //electric field
        gsl::vector force=charge*E_field->get(position, time);

        //magnetic field
        gsl::vector B=charge*B_field->get(position, time);
        force[0]+=inverse_gamma*(momentum[1]*B[2]-momentum[2]*B[1]);
        force[1]+=inverse_gamma*(momentum[2]*B[0]-momentum[0]*B[2]);
        force[2]+=inverse_gamma*(momentum[0]*B[1]-momentum[1]*B[0]);

        //ionization friction
        double friction=-1;
        if(charge==-1)
        {
            if(remove_moller==0 or remove_moller==1) //if not removing moller losses, or constant min_energy
            {
                friction=electron_table.electron_lookup(momentum_squared);
            }
            else if(remove_moller==2) //variable min energy
            {
                friction=electron_table.electron_lookup_variable_RML(momentum_squared, min_energy);
            }
        }
        else
        {
            throw gen_exception("positrons not implemented");
            ////positrons not implemented
            //friction=ionization.positron_lookup(momentum_squared);
        }

        //friction*=0.2;

        if(friction>0) //don't want weird stuff
        {
            force[0]-=friction*momentum[0]/momentum_magnitude;
            force[1]-=friction*momentum[1]/momentum_magnitude;
            force[2]-=friction*momentum[2]/momentum_magnitude;
        }

        return force;
    }
开发者ID:Bhare8972,项目名称:RFD_modelling,代码行数:48,代码来源:apply_force.hpp


示例10: readBridgeHeaderVector

void readBridgeHeaderVector(Bottle &rf, string name, field &groups, int size)
{
    groups.clear();
    if ( rf.check( name.c_str() ) )
    {
        Bottle &grp = rf.findGroup(name.c_str());
        for ( int i = 0; i < size; i++)
        {
            groups.push_back({grp.get(1+i).asString().c_str(),""});
        }
    }
    else
    {
        cout << "Could not find parameters for " << name << ". "
            << "Setting everything to null by default" << endl;
    }
}
开发者ID:wrousseau,项目名称:yarp-to-ros-bridge,代码行数:17,代码来源:bridgeHeader.cpp


示例11: assert

 //! Read value of a class field
 void iarchive_xml::readField (const field& f, const std::string& fieldName, any& object)
 {
const descriptor& fd = f.desc();
token t;
any a;

    // READ ATTRIBUTES
    this->readAttributes(object);

    // End of section
    t = std::move(this->read_token(XML::TOKEN_SLASH_SUPERIOR, XML::TOKEN_SUPERIOR));

    if (t._token_id == XML::TOKEN_SLASH_SUPERIOR)
        return;

    // read type format
    if (this->read_custom_field_format(f, object))
    {
        this->readEndOfField(f, fieldName);
        return; 
    }



    if (fd.has(descriptor::Flags::FIELDS))
    {
        assert(false);
    }
    else
    {
        std::string content = this->_tokenizer.readUntil("<", false);
        this->readEndOfField(f, fieldName);
        f.set(object, content);
        return;

    }
    // normal execution
 }
开发者ID:jmichael218,项目名称:laurena,代码行数:39,代码来源:xml_iarchive.cpp


示例12: arma_extra_debug_sigprint

inline
void
arma_ostream::print(std::ostream& o, const field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  const arma_ostream_state stream_state(o);
  
  const std::streamsize cell_width = o.width();
  
  const uword x_n_rows = x.n_rows;
  const uword x_n_cols = x.n_cols;
  
  if(x.is_empty() == false)
    {
    for(uword col=0; col<x_n_cols; ++col)
      {
      o << "[field column " << col << ']' << '\n'; 
      
      for(uword row=0; row<x_n_rows; ++row)
        {
        o.width(cell_width);
        o << x.at(row,col) << '\n';
        }
      
      o << '\n';
      }
    }
  else
    {
    o << "[field size: " << x_n_rows << 'x' << x_n_cols <<  "]\n";
    }
  
  o.flush();
  stream_state.restore(o);
  }
开发者ID:DASLaboratories,项目名称:Armadillo,代码行数:36,代码来源:arma_ostream_meat.hpp


示例13: arma_extra_debug_sigprint

inline
void
subview_field<oT>::operator= (const field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  subview_field<oT>& t = *this;
  
  arma_debug_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols), "incompatible field dimensions");
  
  for(u32 col=0; col<t.n_cols; ++col)
    {
    for(u32 row=0; row<t.n_rows; ++row)
      {
      t.at(row,col) = x.at(row,col);
      }
    }
  }
开发者ID:avinashsastry,项目名称:trimarkov_HMM,代码行数:18,代码来源:subview_field_meat.hpp


示例14: arma_extra_debug_sigprint

inline
void
field<oT>::init(const field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  if(this != &x)
    {
    init(x.n_rows, x.n_cols);
    
    field& t = *this;
    
    for(uword col=0; col<x.n_cols; ++col)
    for(uword row=0; row<x.n_rows; ++row)
      {
      t.at(row,col) = x.at(row,col);
      }
    }
  
  }
开发者ID:iirob,项目名称:wire,代码行数:20,代码来源:field_meat.hpp


示例15: arma_extra_debug_sigprint

inline
void
field<oT>::init(const field<oT>& x)
  {
  arma_extra_debug_sigprint();
  
  if(this != &x)
    {
    const uword x_n_rows = x.n_rows;
    const uword x_n_cols = x.n_cols;
    
    init(x_n_rows, x_n_cols);
    
    field& t = *this;
    
    for(uword ucol=0; ucol < x_n_cols; ++ucol)
    for(uword urow=0; urow < x_n_rows; ++urow)
      {
      t.at(urow,ucol) = x.at(urow,ucol);
      }
    }
  
  }
开发者ID:daniela-pop,项目名称:UTCN-PRS-Laboratory,代码行数:23,代码来源:field_meat.hpp


示例16: switch

bool snake::tick(field &field_){
    lastMove_ = direction_;
    std::pair<int, int> p = blocks_.front();
    switch (direction_) {
    case LEFT:
    p.first--;
        break;
    case UP:
    p.second--;
        break;
    case RIGHT:
    p.first++;
        break;
    case DOWN:
    p.second++;
        break;
    }
    if(p.first<0 || p.first >= field::WIDTH ||
       p.second<0 || p.second >= field::HEIGHT)
        return false;
    if (field_.block(p.first, p.second) == 
      field::SNAKE_BLOCK)
        return false;
    blocks_.push_front(p);
  if (field_.block(p.first, p.second) != 
      field::FRUIT)
  {
    field_.setBlock(field::SNAKE_BLOCK, p.first, p.second);
    std::pair<int, int> p = blocks_.back();
    field_.setBlock(field::EMPTY, p.first, p.second);
    blocks_.pop_back();
  }
  else
  {
    field_.setBlock(field::SNAKE_BLOCK, p.first, p.second);
    field_.newFruit();
  }
  if (blocks_.size() >= field::WIDTH * field::HEIGHT - 1)
    return false;
  return true; 
}
开发者ID:GarryDvaraza,项目名称:snake,代码行数:41,代码来源:snake.cpp


示例17: equal

inline bool operator==(const field<Columns, Rows>& lhs,
                       const field<Columns, Rows>& rhs) {
    return equal(lhs.begin(), lhs.end(), rhs.begin());
}
开发者ID:sushi1986,项目名称:MAS,代码行数:4,代码来源:field.hpp


示例18: lin_pred_matF_svft

arma::mat lin_pred_matF_svft(const field<vec>& Xbetas, const field<mat>& Z,
                             const mat& b, const field<mat>& U,
                             const field<uvec>& RE_inds, const field<uvec>& id,
                             const field<uvec>& col_inds, const uvec& row_inds,
                             const int& nrows, const int& ncols,
                             const CharacterVector& trans_Funs) {
    int n_field = Xbetas.size();
    mat out = mat(nrows, ncols, fill::zeros);
    for (int i = 0; i < n_field; ++i) {
        mat bb = b.cols(RE_inds.at(i));
        vec Zb = sum(Z.at(i) % bb.rows(id.at(i)), 1);
        if (trans_Funs[i] == "identity") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % (Xbetas.at(i) + Zb);
        } else if (trans_Funs[i] == "expit") {
            vec exp_eta = exp(Xbetas.at(i) + Zb);
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % (exp_eta / (1 + exp_eta));
        } else if (trans_Funs[i] == "exp") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % exp(Xbetas.at(i) + Zb);
        } else if (trans_Funs[i] == "log") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % log(Xbetas.at(i) + Zb);
        } else if (trans_Funs[i] == "log2") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % log2(Xbetas.at(i) + Zb);
        } else if (trans_Funs[i] == "log10") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % log10(Xbetas.at(i) + Zb);
        } else if (trans_Funs[i] == "sqrt") {
            out.submat(row_inds, col_inds.at(i)) = U.at(i).each_col() % sqrt(Xbetas.at(i) + Zb);
        }
    }
    return(out);
}
开发者ID:cran,项目名称:JMbayes,代码行数:30,代码来源:survfitJM_mvJMbayes.cpp


示例19:

bool operator<(const field &lhs, const field &rhs)
{
    return lhs.id() < rhs.id();
}
开发者ID:ognz,项目名称:sloth-fuzzer,代码行数:4,代码来源:field.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ file类代码示例发布时间:2022-05-31
下一篇:
C++ festring类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap