示例#1
0
void
RecordablesMap< iaf_cond_exp >::create()
{
  // use standard names whereever you can for consistency!
  insert_(
    names::V_m, &iaf_cond_exp::get_y_elem_< iaf_cond_exp::State_::V_M > );
  insert_(
    names::g_ex, &iaf_cond_exp::get_y_elem_< iaf_cond_exp::State_::G_EXC > );
  insert_(
    names::g_in, &iaf_cond_exp::get_y_elem_< iaf_cond_exp::State_::G_INH > );
}
示例#2
0
void
RecordablesMap< aeif_psc_alpha >::create()
{
  // use standard names whereever you can for consistency!
  insert_(
    names::V_m, &aeif_psc_alpha::get_y_elem_< aeif_psc_alpha::State_::V_M > );
  insert_( names::I_syn_ex,
    &aeif_psc_alpha::get_y_elem_< aeif_psc_alpha::State_::I_EXC > );
  insert_( names::I_syn_in,
    &aeif_psc_alpha::get_y_elem_< aeif_psc_alpha::State_::I_INH > );
  insert_(
    names::w, &aeif_psc_alpha::get_y_elem_< aeif_psc_alpha::State_::W > );
}
void
RecordablesMap< aeif_cond_alpha_RK5 >::create()
{
  // use standard names whereever you can for consistency!
  insert_( names::V_m,
    &aeif_cond_alpha_RK5::get_y_elem_< aeif_cond_alpha_RK5::State_::V_M > );
  insert_( names::g_ex,
    &aeif_cond_alpha_RK5::get_y_elem_< aeif_cond_alpha_RK5::State_::G_EXC > );
  insert_( names::g_in,
    &aeif_cond_alpha_RK5::get_y_elem_< aeif_cond_alpha_RK5::State_::G_INH > );
  insert_( names::w,
    &aeif_cond_alpha_RK5::get_y_elem_< aeif_cond_alpha_RK5::State_::W > );
}
  void RecordablesMap<mynest::iaf_4_cond_exp>::create()
  {
    // use standard names whereever you can for consistency!
    insert_(names::V_m, 
	    &mynest::iaf_4_cond_exp::get_y_elem_<mynest::iaf_4_cond_exp::State_::V_M>);
    insert_("g_syn_1", 
	    &mynest::iaf_4_cond_exp::get_y_elem_<mynest::iaf_4_cond_exp::State_::G_SYN_1>);
    insert_("g_syn_2", 
	    &mynest::iaf_4_cond_exp::get_y_elem_<mynest::iaf_4_cond_exp::State_::G_SYN_2>);
    insert_("g_syn_3", 
	    &mynest::iaf_4_cond_exp::get_y_elem_<mynest::iaf_4_cond_exp::State_::G_SYN_3>);
    insert_("g_syn_4", 
	    &mynest::iaf_4_cond_exp::get_y_elem_<mynest::iaf_4_cond_exp::State_::G_SYN_4>);
  }
示例#5
0
CString::size_type
CString::insert(bool b,
                size_type index,
                bool displayText,
                CString::size_type minWidth,
                bool leftJustify,
                size_type count)
{
  char temp[5*count]; // max str size will be "false"
  int numDigits = 0;

  for(int i = 0; i < count; i++)
  {
    if(displayText)
    {
      numDigits += sprintf(temp + numDigits, (b ? "true" : "false"));
    }
    else
    {
      temp[numDigits++] = (b ? '1' : '0');
    }
  }

  return insert_(temp, index, numDigits, minWidth, leftJustify);
}
示例#6
0
bool
split_node_(quadtree_t *tree, node_t *node){
  node_t *nw;
  node_t *ne;
  node_t *sw;
  node_t *se;

  double x  = node->bounds->nw->x;
  double y  = node->bounds->nw->y;
  double hw = node->bounds->width / 2;
  double hh = node->bounds->height / 2;

                             //minx, miny,       maxx,       maxy
  if(!(nw = node_with_bounds(x,      y - hh,     x + hw,     y))) return 0;
  if(!(ne = node_with_bounds(x + hw, y - hh,     x + hw * 2, y))) return 0;
  if(!(sw = node_with_bounds(x,      y - hh * 2, x + hw,     y - hh))) return 0;
  if(!(se = node_with_bounds(x + hw, y - hh * 2, x + hw * 2, y - hh))) return 0;

  node->nw = nw;
  node->ne = ne;
  node->sw = sw;
  node->se = se;

  point_t *old = node->point;
  node->point  = NULL;

  return insert_(tree, node, old, false);
}
示例#7
0
 list_inserter& range( SinglePassIterator first, 
                       SinglePassIterator last )
 {
     for( ; first != last; ++first )
         insert_( *first );
     return *this;
 }
示例#8
0
 basic_node_ptr<element> child_node_list::insert_element(iterator pos,
                                                         const std::string& qname)
 {
     detail::check_qname(qname);
     xmlNode* px = insert_(pos, create_element_(qname));
     return basic_node_ptr<element>( static_cast<element*>(px->_private) );
 }
示例#9
0
 list_inserter& repeat( std::size_t sz, T r )
 {
     std::size_t i = 0;
     while( i++ != sz )
         insert_( r );
     return *this;
 }
示例#10
0
 list_inserter& repeat_fun( std::size_t sz, Nullary_function fun )
 {
     std::size_t i = 0;
     while( i++ != sz )
         insert_( fun() );
     return *this;
 }
示例#11
0
 basic_node_ptr<instruction> child_node_list::insert_instruction(iterator pos,
                                                                 const std::string& target,
                                                                 const std::string& value)
 {
     xmlNode* px = insert_(pos, create_instruction_(target, value));
     return basic_node_ptr<instruction>( static_cast<instruction*>(px->_private) );
 }
示例#12
0
 basic_node_ptr<element> child_node_list::push_front_element(const std::string& name,
                                                             basic_xmlns_ptr<const xmlns> ns)
 {
     detail::check_local_part(name);
     xmlNode* px = insert_(begin(), create_element_(name, ns));
     return basic_node_ptr<element>( static_cast<element*>(px->_private) );
 }
示例#13
0
void buildsimpletree(tree *t)
{ /* make and initialize a three-species tree */
  inittip(enterorder[0], t);
  inittip(enterorder[1], t);
  hookup(t->nodep[enterorder[0] - 1], t->nodep[enterorder[1] - 1]);
  buildnewtip(enterorder[2], t, nextsp);
  insert_(t->nodep[enterorder[2] - 1]->back, t->nodep[enterorder[0] - 1]);
}  /* buildsimpletree */
示例#14
0
 basic_node_ptr<element> child_node_list::push_front_element(const std::string& qname,
                                                             const std::string& uri)
 {
     detail::check_qname(qname);
     detail::check_uri(uri);
     xmlNode* px = insert_(begin(), create_element_(qname, uri));
     return basic_node_ptr<element>( static_cast<element*>(px->_private) );
 }
示例#15
0
 void child_node_list::insert_adopt(iterator pos, iterator first, iterator last)
 {
     for (iterator i = first; i != last; )
     {
         xmlNode* px = insert_(pos, (i++)->raw());
         pos = iterator( static_cast<child_node*>(px->_private) );
         ++pos;
     }
 }
示例#16
0
void Parameters::addSymbol(QString key, QString description, QwtSymbol::Style value)
{
	checkExists_(key, false);

	Data_ data(key);
	data.type = Symbol;
	data.v_symbol = value;
	data.description = description;
	insert_(data);
}
示例#17
0
 void child_node_list::insert_clone(iterator pos, const_iterator first, const_iterator last)
 {
     for (const_iterator i = first; i != last; ++i)
     {
         xmlNode* px = i->clone_raw(true);  // recursive clone: never returns null.
         px = insert_(pos, px);
         pos = iterator( static_cast<child_node*>(px->_private) );
         ++pos;
     }
 }
示例#18
0
文件: fitch.c 项目: raeece/svamp
void buildsimpletree(tree *t, long nextsp)
{
  /* make and initialize a three-species tree */
  curtree.start=curtree.nodep[enterorder[0] - 1]; 
  setuptipf(enterorder[0], t);
  setuptipf(enterorder[1], t);
  hookup(t->nodep[enterorder[0] - 1], t->nodep[enterorder[1] - 1]);
  buildnewtip(enterorder[2], t, nextsp);
  insert_(t->nodep[enterorder[2] - 1]->back, t->nodep[enterorder[0] - 1],
          false);
}  /* buildsimpletree */
示例#19
0
void Parameters::addColor(QString key, QString description, QColor value)
{
	checkKey_(key);
	checkExists_(key, false);

	Data_ data(key);
	data.type = Color;
	data.v_variant = value;
	data.description = description;
	insert_(data);
}
示例#20
0
/** @brief insert
  *
  */
CString::size_type
CString::insert(const char ch,
                CString::size_type index,
                CString::size_type minWidth,
                bool leftJustify,
                CString::size_type count)
{
  char temp[count];
  memset(temp, ch, count);

  return insert_(temp, index, count, minWidth, leftJustify);
}
示例#21
0
/*
 * insert_ - insert node recursively.
 * 
 * if node is not right position, goto subtree and call recursively.
 *
 * if it is right position, set left, right, level and return.
 *
 */
FREE insert_(void* X, FREE T)
{
	if(!address_tree)
	{
		left(X) = NULL;
		right(X) = NULL;
		parent(X) = NULL;
		level(X) = 1;
		address_tree = X;
		return X;
	}
	if(!T)
	{
		left(X) = NULL;
		right(X) = NULL;
		level(X) = 1;
		return X;
	}
	else if (FSIZE(X) < FSIZE(T) || ((FSIZE(X) == FSIZE(T)) && X < T))
	{
		if(!left(T))
		{
			parent(X) = T;
		}
		left(T) = insert_(X,left(T));
	}
	else
	{
		if(!right(T))
		{
			parent(X) = T;
		}
		right(T) = insert_(X, right(T));

	}

	T = skew(T);
	T = split(T);
	return T;
}
void
RecordablesMap< hh_psc_alpha_gap >::create()
{
  // use standard names whereever you can for consistency!
  insert_( names::V_m, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::V_M > );
  insert_( names::I_ex, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::I_EXC > );
  insert_( names::I_in, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::I_INH > );
  insert_( names::Act_m, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::HH_M > );
  insert_( names::Act_h, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::HH_H > );
  insert_( names::Inact_n, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::HH_N > );
  insert_( names::Inact_p, &hh_psc_alpha_gap::get_y_elem_< hh_psc_alpha_gap::State_::HH_P > );
}
示例#23
0
void addtraverse(node *p, node *q, boolean contin)
{ /* traverse through a tree, finding best place to add p */
  insert_(p, q);
  numtrees++;
  if (evaluate(&curtree) > bestree.likelihood) {
    copy_(&curtree, &bestree);
    addwhere = q;
  }
  copy_(&priortree, &curtree);
  if (!q->tip && contin) {
    addtraverse(p, q->next->back, contin);
    addtraverse(p, q->next->next->back, contin);
  }
}  /* addtraverse */
	SparseMatrix NeighborhoodBuilder::build(DenseMatrix mat) const
	{
		/*
		 * This matrix contains the k_ best neighbors for every vertex.
		 * The candidates are sorted in ascending order.
		 *
		 * The matrix is updated for entry as correlations are computed.
		 * This allows us to cut the computation time in half!
		 *
		 * We allocate twice the (worst-case) storage needed, as we have
		 * to symmetrize the matrix afterwards. Alternatively we could
		 * resize later, which might lead to a full copy.
		 */
		std::vector<T> entries(2 * k_ * mat.rows());

		std::vector<DenseMatrix::value_type> sd(mat.rows());

		DenseMatrix::Vector mu = mat.matrix().rowwise().mean();

		for(unsigned int i = 0; i < mat.rows(); ++i) {
			mat.row(i) = mat.row(i).array() - mu[i];
			sd[i] = mat.row(i).norm();
		}

		for(unsigned int i = 0; i < mat.rows(); ++i) {
			for(unsigned int j = i + 1; j < mat.rows(); ++j) {
				double cov = mat.row(i).dot(mat.row(j));
				cov = fabs(cov) / (sd[i] * sd[j]);

				// Insert into the entries vector
				insert_(T(i, j, cov), entries.begin() + i * k_);
				insert_(T(i, j, cov), entries.begin() + j * k_);
			}
		}

		return buildMatrix_(entries, mat);
	}
示例#25
0
void Parameters::addInt(QString key, QString description, int value, int min, int max)
{
	checkKey_(key);
	checkExists_(key, false);

	Data_ data(key);
	data.type = Int;
	data.v_variant = value;
	data.description = description;
	if (min!=-std::numeric_limits<int>::max() || max!=std::numeric_limits<int>::max())
	{
		data.restriction = QPoint(min, max);
	}
	insert_(data);
}
示例#26
0
void Parameters::addChar(QString key, QString description, QChar value, QStringList valid)
{
	checkKey_(key);
	checkExists_(key, false);

	Data_ data(key);
	data.type = Char;
	data.v_variant = value;
	data.description = description;
	if (!valid.empty())
	{
		data.restriction = valid;
	}
	insert_(data);
}
示例#27
0
void Parameters::addDouble(QString key, QString description, double value, double min, double max)
{
	checkKey_(key);
	checkExists_(key, false);

	Data_ data(key);
	data.type = Double;
	data.v_variant = value;
	data.description = description;
	if (min!=-std::numeric_limits<double>::max() || max!=std::numeric_limits<double>::max())
	{
		data.restriction = QPointF(min, max);
	}
	insert_(data);
}
示例#28
0
void addtraverse(node *p, node *q, boolean contin, long *numtrees,
			boolean *succeeded)
{
 /* traverse through a tree, finding best place to add p */
  insert_(p, q, true);
  (*numtrees)++;
  if (evaluate(&curtree) > bestree.likelihood){
    copy_(&curtree, &bestree);
    (*succeeded)=true;
  }
  copy_(&priortree, &curtree);
  if (!q->tip && contin) {
    addtraverse(p, q->next->back, contin,numtrees,succeeded);
    addtraverse(p, q->next->next->back, contin,numtrees,succeeded);
  }
}  /* addtraverse */
void
RecordablesMap< hh_cond_exp_traub >::create()
{
  // use standard names whereever you can for consistency!
  insert_( names::V_m, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::V_M > );
  insert_( names::g_ex, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::G_EXC > );
  insert_( names::g_in, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::G_INH > );
  insert_( names::Act_m, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::HH_M > );
  insert_( names::Act_h, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::HH_H > );
  insert_( names::Inact_n, &hh_cond_exp_traub::get_y_elem_< hh_cond_exp_traub::State_::HH_N > );
}
示例#30
0
CString::size_type
CString::insert(long num,
                CString::size_type index,
                CString::size_type minWidth,
                bool leftJustify,
                CString::size_type count)
{
  char temp[20*count]; // a max long wont be more than 20 digits
  int numDigits = 0;

  for(int i = 0; i < count; i++)
  {
    numDigits += sprintf(temp + numDigits, "%ld", num);
  }

  return insert_(temp, index, numDigits, minWidth, leftJustify);
}