Exemple #1
0
    // static
    void QueryPlannerIXSelect::rateIndices(MatchExpression* node,
                                           string prefix,
                                           const vector<IndexEntry>& indices) {
        // Do not traverse tree beyond negation node
        MatchExpression::MatchType exprtype = node->matchType();
        if (exprtype == MatchExpression::NOT || exprtype == MatchExpression::NOR) {
            return;
        }

        // Every indexable node is tagged even when no compatible index is
        // available.
        if (Indexability::nodeCanUseIndexOnOwnField(node)) {
            string fullPath = prefix + node->path().toString();
            verify(NULL == node->getTag());
            RelevantTag* rt = new RelevantTag();
            node->setTag(rt);
            rt->path = fullPath;

            // TODO: This is slow, with all the string compares.
            for (size_t i = 0; i < indices.size(); ++i) {
                BSONObjIterator it(indices[i].keyPattern);
                BSONElement elt = it.next();
                if (elt.fieldName() == fullPath && compatible(elt, indices[i], node)) {
                    rt->first.push_back(i);
                }
                while (it.more()) {
                    elt = it.next();
                    if (elt.fieldName() == fullPath && compatible(elt, indices[i], node)) {
                        rt->notFirst.push_back(i);
                    }
                }
            }
        }
        else if (Indexability::arrayUsesIndexOnChildren(node)) {
            // See comment in getFields about all/elemMatch and paths.
            if (!node->path().empty()) {
                prefix += node->path().toString() + ".";
            }
            for (size_t i = 0; i < node->numChildren(); ++i) {
                rateIndices(node->getChild(i), prefix, indices);
            }
        }
        else if (node->isLogical()) {
            for (size_t i = 0; i < node->numChildren(); ++i) {
                rateIndices(node->getChild(i), prefix, indices);
            }
        }
    }
Exemple #2
0
int
CC_LockSet::change_mode_i (CC_LockModeEnum lm_held,
                          CC_LockModeEnum lm_new)
{
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mlock_, 1);
  // If the new mode is compatible with the modes we hold we change
  // the counts for the two locks. If not we must queue the new
  // request. We can decrement the count for the old mode without
  // signalling the semaphore because we know we only check modes
  // granted this far.

  lock_[lm_held]--;

  if (compatible (lm_new) == 1)
    {
      lock_[lm_new]++;
      this->dump ();
      return 0;
    }
  else
    {
      lock_[lm_held]++;
      lock_queue_.enqueue_tail (lm_new);
      this->dump ();
      return 1;
    }
}
Exemple #3
0
bool 
Units::can_convert (const symbol from, const symbol to,
                    const double value) const
{ 
  if (from == to)
    return true;

  // Defined?
  if (!has_unit(from) || !has_unit (to))
    {
      if (!allow_old ())
        return false;
      else
        return Oldunits::can_convert (from, to, value);
    }
  
  const Unit& from_unit = get_unit (from);
  const Unit& to_unit = get_unit (to);

  if (!compatible (from_unit, to_unit))
    return false;
  if (!from_unit.in_native  (value))
    return false;
  const double base = from_unit.to_base (value);
  // We don't have to worry about [cm] and [hPa] as all values are valid.
  return to_unit.in_base (base);
}
static bool splice_form_is_valid(GtBittab *SA_p, const ConsensusSA *csa)
{
  GtBittab *SA_p_complement; /* SA \ SA_p */
  unsigned long sa, sa_prime;
  bool incompatible_found, valid = true;

  SA_p_complement = gt_bittab_new(csa->number_of_sas);
  gt_bittab_complement(SA_p_complement, SA_p);

  for (sa_prime  = gt_bittab_get_first_bitnum(SA_p_complement);
       sa_prime != gt_bittab_get_last_bitnum(SA_p_complement);
       sa_prime  = gt_bittab_get_next_bitnum(SA_p_complement, sa_prime)) {
    incompatible_found = false;
    for (sa  = gt_bittab_get_first_bitnum(SA_p);
         sa != gt_bittab_get_last_bitnum(SA_p);
         sa  = gt_bittab_get_next_bitnum(SA_p, sa)) {
      if (!compatible(csa, sa, sa_prime)) {
        incompatible_found = true;
        break;
      }
    }
    if (!incompatible_found) { valid = false; break; }
  }
  gt_bittab_delete(SA_p_complement);
  return valid;
}
Exemple #5
0
void *compute_joint_sum(void *d) {

	row *r;
	size_t i, j, k;
	sum_data *data = d;

	for (i = data->a; i <= data->b; i++)
		for (j = 0; j < data->f2->r; j++)
			if (compatible(data->f1->rows[i], data->f2->rows[j], data->sh)) {

				r = malloc(sizeof(row));
				r->n = data->f3->n;
				r->m = data->f3->m;
				r->v = data->f1->rows[i]->v + data->f2->rows[j]->v;
				r->blocks = calloc(data->f3->m, sizeof(row_block));
				memcpy(r->blocks, data->f1->rows[i]->blocks, data->f1->m * sizeof(row_block));

				for (k = 0; k < data->f2->n; k++)
					if (GETBIT(data->f2->rows[j], k)) SETBIT(r, data->sh[k]);

				pthread_mutex_lock(data->m);
				data->f3->rows[data->f3->r] = r;
				data->f3->r++;
				pthread_mutex_unlock(data->m);
			}

	free(data);
	pthread_exit(NULL);
}
Exemple #6
0
/* subtree - construct tree for l - r */
static Tree subtree(int op, Tree l, Tree r) {
	long n;
	Type ty = inttype;

	if (isarith(l->type) && isarith(r->type)) {
		ty = binary(l->type, r->type);
		l = cast(l, ty);
		r = cast(r, ty);		
	} else if (isptr(l->type) && !isfunc(l->type->type) && isint(r->type)) {
		ty = unqual(l->type);
		n = unqual(ty->type)->size;
		if (n == 0)
			error("unknown size for type `%t'\n", ty->type);
		r = cast(r, promote(r->type));
		if (n > 1)
			r = multree(MUL, cnsttree(signedptr, n), r);
		if (isunsigned(r->type))
			r = cast(r, unsignedptr);
		else
			r = cast(r, signedptr);
		return simplify(SUB+P, ty, l, r);
	} else if (compatible(l->type, r->type)) {
		ty = unqual(l->type);
		n = unqual(ty->type)->size;
		if (n == 0)
			error("unknown size for type `%t'\n", ty->type);
		l = simplify(SUB+U, unsignedptr,
			cast(l, unsignedptr), cast(r, unsignedptr));
		return simplify(DIV+I, longtype,
			cast(l, longtype), cnsttree(longtype, n));
	} else
		typeerror(op, l, r);
	return simplify(op, ty, l, r);
}
Exemple #7
0
bool 
Units::can_convert (const symbol from, const symbol to) const
{
  if (from == to)
    return true;

  // Defined?
  if (!has_unit(from) || !has_unit (to))
    {
      if (!allow_old ())
        return false;
      else
        return Oldunits::can_convert (from, to);
    }
  
  const Unit& from_unit = get_unit (from);
  const Unit& to_unit = get_unit (to);

  if (compatible (from_unit, to_unit))
    return true;

  if (!allow_old ())
    return false;

  return Oldunits::can_convert (from, to);
}
Exemple #8
0
double
Units::unit_convert (const Unit& from, const Unit& to,
                     const double value)
{
  if (!compatible (from, to))
    throw std::string ("Cannot convert [") + from.native_name () 
      + "] with base [" + from.base_name () + "] to [" + to.native_name ()
      + "] with base [" + to.base_name () + "]";

  const double from_base = from.to_base (value);
  const double to_base = base_convert (from.base_name (),
                                       to.base_name (), 
                                       from_base);
  const double native = to.to_native (to_base);
  
#if 0
  std::ostringstream tmp;
  tmp << "Converting " << value << " [" << from.native_name () << "] to " << native 
      << " [" << to.native_name () << "] through " << from_base << " [" 
      << from.base_name () << "]";
  if (from.base_name () == to.base_name ())
    daisy_approximate (from_base, to_base);
  else
    tmp << " and " << to_base << " [" << to.base_name () << "]";
  Assertion::message (tmp.str ());
#endif

  return native;
}
Exemple #9
0
OMFile* OMFile::openNewModify(OMRawStorage* rawStorage,
                              const OMClassFactory* factory,
                              void* clientOnRestoreContext,
                              const OMByteOrder byteOrder,
                              OMStorable* clientRoot,
                              const OMStoredObjectEncoding& encoding,
                              OMDictionary* dictionary)
{
  TRACE("OMFile::openNewModify");

  PRECONDITION("Valid raw storage", rawStorage != 0);
  PRECONDITION("Compatible access mode", compatible(rawStorage, modifyMode));
  PRECONDITION("Creatable",
                       compatibleRawStorage(rawStorage, modifyMode, encoding));
  PRECONDITION("Valid class factory", factory != 0);
  PRECONDITION("Valid byte order",
                    ((byteOrder == littleEndian) || (byteOrder == bigEndian)));
  PRECONDITION("Valid client root", clientRoot != 0);
  PRECONDITION("Valid dictionary ", dictionary != 0);

  OMRootStorable* root = new OMRootStorable(clientRoot, dictionary);
  ASSERT("Valid heap pointer", root != 0);

  OMFile* newFile = new OMFile(rawStorage,
                               clientOnRestoreContext,
                               encoding,
                               modifyMode,
                               factory,
                               dictionary,
                               root,
                               byteOrder);
  ASSERT("Valid heap pointer", newFile != 0);
  return newFile;
}
void stableMarriage(int a[][N]){
	int free[2*N];
	memset(free, -1, sizeof(free));
	int freeMen = N;
	while(freeMen > 0){
		int idxM = -1, idxW = -1;
		// Get Man
		for(int i=0; i<N; i++){
			if(free[i] == -1){
				idxM = i;
				break;
			}
		}
		//Get Woman
		for(int i=0; i<N; i++){
			if(free[a[idxM][i]] == -1){
				idxW = a[idxM][i];
				break;
			}
			else {
				if(compatible(a, free, idxM, a[idxM][i])){
					int man = free[a[idxM][i]];
					idxW = a[idxM][i];
					free[man] = -1;
					freeMen++;
				}
			}
		}
		free[idxM] = idxW;
		free[idxW] = idxM;
		freeMen--;
	}
	for(int i=0; i<N; i++)
		cout<<i<<"-->"<<free[i]<<'\n';
}
Exemple #11
0
void HistoryChatView::initImpl(ChatView *view)
{
  view->addJS(LS("qrc:/js/History/days.js"));

  if (compatible(view->id())) {
    view->page()->mainFrame()->addToJavaScriptWindowObject(LS("HistoryView"), this);
    view->addJS(LS("qrc:/js/History/History.js"));
  }
}
Exemple #12
0
bool Type::may_be_compatible(const Type& type) const {
	if (compatible(type)) {
		return true;
	}
	// Example: Number.abs(number*) => we allow to call with a unknown pointer
	if (is_polymorphic() and type == Type::any()) {
		return true;
	}
	return false;
}
Exemple #13
0
 Vector<T> & Vector<T>::operator+= (const Vector<T> &vec)
     throw (VectorError)
 {
     unsigned i;
     compatible(vec);
     for (i = 0; i < dim; i ++) {
         vals[i] += vec[i];
     }
     return *this;
 }
Exemple #14
0
Derived& HistoBase<x_value_type, y_value_type, Derived>::operator/=(const HistoBase<x_value_type,y_value_type,ArbitraryDerived>& rhs)
{
  if (!compatible(rhs)) throw Exceptions::HistosNotCompatibleException("Two histograms must have the same x_values in order to divide them.");

  for (typename HistoBase<x_value_type,y_value_type,ArbitraryDerived>::const_iterator it = rhs.begin(); it != rhs.end(); it++)
  {
    static_cast<Derived*>(this)->operator[](it->first) /= it->second;
  }
  return *(static_cast<Derived*>(this));
}
Exemple #15
0
/*!
 * Запрос последних сообщений для всех открытых каналов.
 */
void HistoryChatView::ready()
{
  ChatClientLocker locker;

  foreach (ChatView *view, i()->views()) {
    const QByteArray &id = view->id();
    if (compatible(id) && sync(id, view->lastMessage())) {
      emit loading(SimpleID::encode(id));
    }
  }

  ClientFeeds::request(ChatClient::id(), FEED_METHOD_GET, MESSAGES_FEED_OFFLINE_REQ);
}
Exemple #16
0
    void Vector<T>::copy (const Vector<T> & src)
        throw (VectorError)
    {
        unsigned i;

        if (&src == this)
            return;

        compatible(src);
        for (i = 0; i < dim; i ++) {
            vals[i] = src[i];
        }
    }
static void compute_left_or_right(GtBittab **left_or_right,
                                  const ConsensusSA *csa,
                                  bool (*cmp_func) (const ConsensusSA *csa,
                                                    unsigned long sa_1,
                                                    unsigned long sa_2))
{
  unsigned long sa, sa_1;
  gt_assert(csa && left_or_right && *left_or_right);
  for (sa = 0; sa < csa->number_of_sas; sa++) {
    for (sa_1 = 0; sa_1 < csa->number_of_sas; sa_1++) {
      if (cmp_func(csa, sa, sa_1) && compatible(csa, sa, sa_1))
        gt_bittab_set_bit(left_or_right[sa], sa_1);
    }
  }
}
Exemple #18
0
void *compute_arg_max(void *d) {

	arg_data *data = d;
	size_t i;

	for (i = data->a; i <= data->b; i++)
		if (compatible(data->rows[i], data->prow, data->sh)) {
			pthread_mutex_lock(data->m);
			if (!*(data->max_row) || data->rows[i]->v > (*(data->max_row))->v) *(data->max_row) = data->rows[i];
			pthread_mutex_unlock(data->m);
		}

	free(data);
	pthread_exit(NULL);
}
static bool contains(const ConsensusSA *csa,
                     unsigned long sa_1, unsigned long sa_2)
{
  GtRange range_sa_1, range_sa_2;
  gt_assert(csa);

  /* get ranges */
  range_sa_1 = extract_genomic_range(csa, sa_1);
  range_sa_2 = extract_genomic_range(csa, sa_2);

  if (gt_range_contains(&range_sa_1, &range_sa_2) &&
      compatible(csa, sa_1, sa_2)) {
    return true;
  }
  return false;
}
Exemple #20
0
static Tree cmptree(int op, Tree l, Tree r) {
	Type ty;

	if (isarith(l->type) && isarith(r->type)) {
		ty = binary(l->type, r->type);
		l = cast(l, ty);
		r = cast(r, ty);
	} else if (compatible(l->type, r->type)) {
		ty = unsignedptr;
		l = cast(l, ty);
		r = cast(r, ty);
	} else {
		ty = unsignedtype;
		typeerror(op, l, r);
	}
	return simplify(mkop(op,ty), inttype, l, r);
}
Exemple #21
0
int
CC_LockSet::try_lock_i (CC_LockModeEnum lm)
{
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mlock_, 1);
  // If the lock we try is compatible with the locks we hold we just
  // opdates the count. Otherwise we return false.
  if (compatible (lm) == 0)
    {
      this->dump ();
      return 0;
    }
  else
    lock_[lm]++;

  this->dump ();
  return 1;
}
Exemple #22
0
bool
Units::can_convert (const symbol from, const symbol to, Treelog& msg) const
{
  if (from == to)
    return true;

  // Defined?
  if (!has_unit(from) || !has_unit (to))
    {
      if (!allow_old ())
        {
          if (has_unit (from))
            msg.message ("Original dimension [" + from + "] known.");
          else
            msg.message ("Original dimension [" + from + "] not known.");
          if (has_unit (to))
            msg.message ("Target dimension [" + to + "] known.");
          else
            msg.message ("Target dimension [" + to + "] not known.");
          return false;
        }
      msg.message (std::string ("Trying old conversion of ") 
                   + (has_unit (from) ? "" : "unknown ") + "[" + from + "] to " 
                   + (has_unit (to) ? "" : "unknown ") + "[" + to + "]." );
      return Oldunits::can_convert (from, to);
    }

  const Unit& from_unit = get_unit (from);
  const Unit& to_unit = get_unit (to);

  if (compatible (from_unit, to_unit))
    return true;

  // Not compatible.
  std::ostringstream tmp;
  tmp << "Cannot convert [" << from 
      << "] with base [" << from_unit.base_name () << "] to [" << to
      << "] with base [" << to_unit.base_name () << "]";
  msg.message (tmp.str ());
  if (!allow_old ())
    return false;

  msg.message ("Trying old conversion.");
  return Oldunits::can_convert (from, to);
}
Exemple #23
0
int
CC_LockSet::lock_i (CC_LockModeEnum lm)
{
  ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mlock_, 1);
  // If the lock is not compatible with the locks we hold allready or
  // there is lock requests in the queue we cannot grant the lock and
  // thus we queue the request. Otherwise update the lock count.
  if (compatible (lm) == 0 || lock_queue_.size () > 0)
    {
      // Put the lock mode in the queue
      lock_queue_.enqueue_tail (lm);
      this->dump ();
      return 1; // Lock the semaphore.
    }
  else
    lock_[lm]++;

  this->dump ();
  return 0;
}
Exemple #24
0
Type Type::operator * (const Type& t2) const {
	if (_types.size() == 0) {
		return t2;
	}
	if (t2._types.size() == 0) {
		return *this;
	}
	if (*this == t2) {
		return *this;
	}
	if (is_polymorphic() and t2.is_primitive()) {
		return Type::any();
	}
	if (t2.is_polymorphic() and is_primitive()) {
		return Type::any();
	}
	if (is_any()) {
		return t2;
	}
	if (t2.is_any()) {
		return *this;
	}
	// Temporary, to be removed when compatible() is removed
	if ((is_bool() and t2.is_integer()) or (is_integer() and t2.is_bool())) {
		return any();
	}
	if (t2.compatible(*this)) {
		return t2;
	}
	if (compatible(t2)) {
		return *this;
	}
	if (is_array() and t2.is_array()) {
		if (element().is_polymorphic() and t2.element().is_polymorphic()) {
			return array(any());
		}
	}
	return Type::any();
}
Exemple #25
0
void
CC_LockSet::unlock (CosConcurrencyControl::lock_mode mode)
{
  ORBSVCS_DEBUG ((LM_DEBUG,
              "CC_LockSet::unlock\n"));

  CC_LockModeEnum lm = lmconvert (mode);

  ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mlock_);

  if (lock_[lm] == 0) // This lock is not held.
    throw CosConcurrencyControl::LockNotHeld();
  else
    lock_[lm]--;

  // If we do not have a lock held in a weaker mode than the
  // strongest held and we have requests on the semaphore signal
  // the semaphore.
  while (lock_queue_.size () > 0)
    {
      CC_LockModeEnum lock_on_queue = CC_EM;

      lock_queue_.dequeue_head (lock_on_queue);

      if (compatible (lock_on_queue) == 1)
        {
          if (semaphore_.release () == -1)
            throw CORBA::INTERNAL ();
          lock_[lock_on_queue]++;
        }
      else
        {
          lock_queue_.enqueue_head (lock_on_queue);
          break;
        }
    }
  this->dump ();
}
Exemple #26
0
OMFile* OMFile::openExistingModify(OMRawStorage* rawStorage,
                                   const OMClassFactory* factory,
                                   void* clientOnRestoreContext,
                                   const OMLoadMode loadMode,
				   const OMStoredObjectEncoding& encoding,
                                   OMDictionary* dictionary)
{
  TRACE("OMFile::openExistingModify");

  PRECONDITION("Valid raw storage", rawStorage != 0);
  PRECONDITION("Compatible access mode", compatible(rawStorage, modifyMode));
  PRECONDITION("Valid class factory", factory != 0);
  PRECONDITION("Valid dictionary", dictionary != 0);

  OMFile* newFile = new OMFile(rawStorage,
                               clientOnRestoreContext,
 			       encoding,
                               modifyMode,
                               factory,
                               dictionary,
                               loadMode);
  ASSERT("Valid heap pointer", newFile != 0);
  return newFile;
}
Exemple #27
0
void Image::copyPixelsTo(Image& targetImage) const {
    Q_ASSERT(compatible(targetImage));
    copyPixels(*this, targetImage);
}
Exemple #28
0
void Image::copyPixelsFrom(const Image& sourceImage) {
    Q_ASSERT(compatible(sourceImage));
    copyPixels(sourceImage, *this);
}
void testCMarginBuffer()
{
  const int64_t cols     = 23;
  const int64_t rows        = 54;
  const int64_t numPixels   = cols * rows;
  const int64_t numElements = (cols + 2 * margin) * (rows + 2 * margin);

  CMarginBuffer2D<margin> buffer1(cols, rows);

  EXPECT_EQ(cols, buffer1.cols());
  EXPECT_EQ(rows, buffer1.rows());
  EXPECT_EQ(numPixels, buffer1.numPixels());
  EXPECT_EQ(numElements, buffer1.numElements());

  // generate test data
  generateTestData(buffer1);

  // check the data in the buffer
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
      EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)), static_cast<Real>(x)),
                buffer1.pixel(x, y));
    }
  }

  // create a compatible buffer
  auto buffer2 = buffer1.createCompatibleBuffer();

  EXPECT_EQ(cols, buffer1.cols());
  EXPECT_EQ(rows, buffer2.rows());
  EXPECT_EQ(numPixels, buffer2.numPixels());
  EXPECT_EQ(numElements, buffer2.numElements());
  EXPECT_TRUE(buffer1.compatible(buffer2));
  EXPECT_TRUE(buffer2.compatible(buffer1));

  // copy the data in the new buffer
  buffer2.assign(buffer1);

  // clear the first buffer
  const Complex clearValue(42.0, -8.0);
  buffer1.setValue(clearValue);

  // check the data in the first buffer
  for (int64_t y = 0; y < rows; ++y)
    for (int64_t x = 0; x < cols; ++x)
      EXPECT_EQ(clearValue, buffer1.pixel(x, y));

  // check the data in the second buffer
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
       EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)), static_cast<Real>(x)),
                 buffer2.pixel(x, y));
    }
  }

  // test addAssign
  buffer1.setValue(Complex(1.0, -1.0));
  generateTestData(buffer2);
  buffer1 += buffer2;
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
      EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)) + R(1.0),
                        static_cast<Real>(x) - R(1.0)),
                        buffer1.pixel(x, y));
    }
  }

  // test multiplyAssign(CMarginBuffer)
  buffer1.setValue(Complex(1.0, -1.0));
  generateTestData(buffer2);
  buffer1 *= buffer2;
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
      EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)) + static_cast<Real>(x),
                        -std::sin(static_cast<Real>(y)) + static_cast<Real>(x)),
                        buffer1.pixel(x, y));
     }
  }

  // test multiplyAssign(Complex)
  generateTestData(buffer1);
  buffer1 *= Complex(1.0, -1.0);
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
      EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)) + static_cast<Real>(x),
                        -std::sin(static_cast<Real>(y)) + static_cast<Real>(x)),
                        buffer1.pixel(x, y));
     }
  }

  // test multiplyAssign(Real)
  generateTestData(buffer1);
  buffer1 *= 5.0;
  for (int64_t y = 0; y < rows; ++y)
  {
    for (int64_t x = 0; x < cols; ++x)
    {
      EXPECT_EQ(Complex(std::sin(static_cast<Real>(y)) * R(5.0),
                        static_cast<Real>(x) * R(5.0)),
                        buffer1.pixel(x, y));
     }
  }

  // create a third buffer
  const Complex initialValue(-49.0, 7.0);
  CMarginBuffer2D<margin> buffer3(cols + 1, rows, initialValue);
  EXPECT_FALSE(buffer3.compatible(buffer1));
  EXPECT_FALSE(buffer1.compatible(buffer3));

  for (int64_t y = 0; y < rows; ++y)
    for (int64_t x = 0; x < cols; ++x)
      EXPECT_EQ(initialValue, buffer3.pixel(x, y));

  std::mt19937 generator;
  std::uniform_real_distribution<Real> distribution(0.0, Math::twoPi);
  for (int64_t y = 0; y < rows; ++y)
    for (int64_t x = 0; x < cols + 1; ++x)
      buffer3.pixel(x, y) = fromArg(distribution(generator));

  EXPECT_EQ(buffer3.numPixels(), buffer3.absSqrReduce());

  // todo: test multiplyAssign
  // todo: test info
}
Exemple #30
0
void HistoryChatView::addImpl(ChatView *view)
{
  if (compatible(view->id()) && sync(view->id()))
    emit loading(SimpleID::encode(view->id()));
}