void KisKraSaveXmlVisitorTest::testCreateDomDocument()
{
    KisDocument* doc = createCompleteDocument();

    quint32 count = 0;

    QDomDocument dom;
    QDomElement image = dom.createElement("IMAGE"); // Legacy!
    KisSaveXmlVisitor visitor(dom, image, count, "", true);

    Q_ASSERT(doc->image());

    QStringList list;

    doc->image()->lock();
    
    KisCountVisitor cv(list, KoProperties());
    doc->image()->rootLayer()->accept(cv);

    doc->image()->rootLayer()->accept(visitor);

    QCOMPARE((int)visitor.m_count, (int)cv.count());

    //delete doc;
}
Ejemplo n.º 2
0
/**
 *	Get the number of vertices emanating from this vertex.
 *	Get a count of laths representing the vertices emanating from the vertex
 *	this lath represents.
 *
 *	@return	Count of laths.
 */
TqInt CqLath::cQvv() const
{
	TqInt c = 1; // Start with this
	// Laths representing the edges that radiate from the associated vertex are obtained by
	// following the clockwise vertex links around the vertex.
	CqLath* pNext = cv();
	const CqLath* pLast = this;
	while(NULL != pNext && this != pNext)
	{
		c++;
		pLast = pNext;
		pNext = pNext->cv();
	}

	// If we hit a boundary, add the ec of this boundary edge and start again going backwards.
	// @warning Adding ccf for the boundary edge means that the lath represents a different vertex.
	if(NULL == pNext)
	{
		pLast = this;
		pNext = ccv();
		// We know we are going to hit a boundary in this direction as well so we can just look for that
		// case as a terminator.
		while(NULL != pNext)
		{
			assert( pNext != this );
			c++;
			pLast = pNext;
			pNext = pNext->ccv();
		}
		// We have hit the boundary going the other way, so add the ccf of this boundary edge.
		c++;
	}
	return( c );
}
Ejemplo n.º 3
0
/**
 *	Get the facets which share this vertex.
 *	Get a list of laths which represent the facets which share the vertex this
 *	lath represents.
 *
 *	@return	Pointer to an array of lath pointers.
 */
void CqLath::Qvf(std::vector<const CqLath*>& Result) const
{
	TqInt len = cQvf();

	const CqLath* pNext = cv();

	Result.resize(len);
	TqInt index = 0;

	// Laths representing the edges that radiate from the associated vertex are obtained by
	// following the clockwise vertex links around the vertex.
	const CqLath *pTmpLath = this;
	Result[index++] = pTmpLath;

	while(NULL != pNext && this != pNext)
	{
		Result[index++] = pNext;
		pNext = pNext->cv();
	}

	// If we hit a boundary, start again going backwards.
	if(NULL == pNext)
	{
		pNext = ccv();
		// We know we are going to hit a boundary in this direction as well so we can just look for that
		// case as a terminator.
		while(NULL != pNext)
		{
			Result[index++] = pNext;
			pNext = pNext->ccv();
		}
	}
}
Ejemplo n.º 4
0
/**
 *	Get the edges emanating from a vertex.
 *	Get a list of laths representing the edges which emanate from the vertex
 *	this lath represents.
 *
 *	@return	Pointer to an array of lath pointers.
 */
TqInt CqLath::cQve() const
{
	TqInt len = 1;

	CqLath* pNext = cv();
	const CqLath* pLast = this;
	while(NULL != pNext && this != pNext)
	{
		len++;
		pLast = pNext;
		pNext = pNext->cv();
	}

	// If we hit a boundary, add the ec of this boundary edge and start again going backwards.
	// @warning Adding ccf for the boundary edge means that the lath represents a different vertex.
	if(NULL == pNext)
	{
		pLast = this;
		pNext = ccv();
		// We know we are going to hit a boundary in this direction as well so we can just look for that
		// case as a terminator.
		while(NULL != pNext)
		{
			assert( pNext != this );
			len++;
			pLast = pNext;
			pNext = pNext->ccv();
		}
		// We have hit the boundary going the other way, so add the ccf of this boundary edge.
		len++;
	}
	return(len);
}
Ejemplo n.º 5
0
  void SurfPhase::
  setCoveragesByName(std::string cov) {
    int kk = nSpecies();
    int k;
    compositionMap cc;
    for (k = 0; k < kk; k++) { 
      cc[speciesName(k)] = -1.0;
    }
    parseCompString(cov, cc);
    doublereal c;
    vector_fp cv(kk, 0.0);
    bool ifound = false;
    for (k = 0; k < kk; k++) { 
      c = cc[speciesName(k)];
      if (c > 0.0) {
	ifound = true;
	cv[k] = c;
      }
    }
    if (!ifound) {
      throw CanteraError("SurfPhase::setCoveragesByName",
			 "Input coverages are all zero or negative");
    }
    setCoverages(DATA_PTR(cv));
  }
Ejemplo n.º 6
0
int max_fs_arity(const Constraint_Handle &c) {
    int max_arity=0;
    for(Constr_Vars_Iter cv(c); cv; cv++)
        if((*cv).var->kind() == Global_Var)
            max_arity = omega::max(max_arity,(*cv).var->get_global_var()->arity());
    return max_arity;
}
TEST(CLConditionVariable, Multi_process_for_Shared_Cond)
{
	CLSharedMemory *psm = new CLSharedMemory("test_for_multi_process_for_shared_cond", 16);
	long *p = (long *)(psm->GetAddress());
	*p = 0;

	long *flag = (long *)(((char *)p) + 8);
	*flag = 0;

	CLEvent event("test_for_event_auto");

	CLProcess *process = new CLProcess(new CLProcessFunctionForExec);
	EXPECT_TRUE(process->Run((void *)"../test_for_exec/test_for_CLConditionVariable/main").IsSuccess());

	CLMutex mutex("mutex_for_test_for_multi_process_for_shared_cond", MUTEX_USE_SHARED_PTHREAD);

	CLConditionVariable cv("test_conditoin_variable_for_multiprocess");

	{
		CLCriticalSection cs(&mutex);

		while(*flag == 0)
			EXPECT_TRUE((cv.Wait(&mutex)).IsSuccess());
	}

	EXPECT_EQ(*p, 5);

	EXPECT_TRUE(event.Wait().IsSuccess());

	delete psm;
}
Ejemplo n.º 8
0
void mark_cells_on_vertices(VertexIt   seed,
			    CellSeq&   cell_seq,
			    EltMarker& visited,
			    int        level,
			    CellPred   inside)
{
  typedef typename VertexIt::grid_type       grid_type;
  typedef GT                                 gt;
  typedef typename gt::Cell                  Cell;
  typedef typename gt::Vertex                Vertex;
  typedef typename gt::CellOnVertexIterator  CellOnVertexIterator;
 
  while(! seed.IsDone()) {
    Vertex V = *seed;
    for(CellOnVertexIterator cv(V); ! cv.IsDone(); ++cv)
      if( inside(*cv)) {
	Cell C(*cv);
	if(visited(C) == 0) {
	  visited[C] = level;
	  cell_seq.append(C);
	}
      }
    ++seed;
  }
}
int main()
{

Vector3DFast av(4,-2,5);
Vector3DFast bv(2,5,-3);
Vector3DFast cv(0,0,0);
cv=av+bv;
}
Ejemplo n.º 10
0
 ExecStatus
 Distinct<View0,View1>::post(Home home, View0 x, View1 y) {
   if (x.assigned()) {
     GlbRanges<View0> xr(x);
     IntSet xs(xr);
     ConstSetView cv(home, xs);
     GECODE_ES_CHECK((DistinctDoit<View1>::post(home,y,cv)));
   }
   if (y.assigned()) {
     GlbRanges<View1> yr(y);
     IntSet ys(yr);
     ConstSetView cv(home, ys);
     GECODE_ES_CHECK((DistinctDoit<View0>::post(home,x,cv)));
   }
   (void) new (home) Distinct<View0,View1>(home,x,y);
   return ES_OK;
 }
Ejemplo n.º 11
0
float CGameHelper::GuiTraceRay(const float3 &start, const float3 &dir, float length, CUnit*& hit, bool useRadar, CUnit* exclude)
{
    if (dir == ZeroVector) {
        return -1.0f;
    }

    // distance from start to ground intersection point + fudge
    float groundLen   = ground->LineGroundCol(start, start + dir * length);
    float returnLenSq = Square( (groundLen > 0.0f)? groundLen + 200.0f: length );

    hit = NULL;
    CollisionQuery cq;

    GML_RECMUTEX_LOCK(quad); // GuiTraceRay

    vector<int> quads = qf->GetQuadsOnRay(start, dir, length);
    vector<int>::iterator qi;

    for (qi = quads.begin(); qi != quads.end(); ++qi) {
        const CQuadField::Quad& quad = qf->GetQuad(*qi);
        std::list<CUnit*>::const_iterator ui;

        for (ui = quad.units.begin(); ui != quad.units.end(); ++ui) {
            CUnit* unit = *ui;
            if (unit == exclude) {
                continue;
            }

            if ((unit->allyteam == gu->myAllyTeam) || gu->spectatingFullView ||
                    (unit->losStatus[gu->myAllyTeam] & (LOS_INLOS | LOS_CONTRADAR)) ||
                    (useRadar && radarhandler->InRadar(unit, gu->myAllyTeam))) {

                CollisionVolume cv(unit->collisionVolume);

                if (unit->isIcon) {
                    // for iconified units, just pretend the collision
                    // volume is a sphere of radius <unit->IconRadius>
                    cv.SetDefaultScale(unit->iconRadius);
                }

                if (CCollisionHandler::MouseHit(unit, start, start + dir * length, &cv, &cq)) {
                    // get the distance to the ray-volume egress point
                    // so we can still select stuff inside factories
                    const float len = (cq.p1 - start).SqLength();

                    if (len < returnLenSq) {
                        returnLenSq = len;
                        hit = unit;
                    }
                }
            }
        }
    }

    return ((hit)? math::sqrt(returnLenSq): (math::sqrt(returnLenSq) - 200.0f));
}
Ejemplo n.º 12
0
	table< T > compute_covariance( const storage< T, L >& sto )
	{
		auto nchannels = sto.channel_size();
		auto nframes = sto.frame_size();

		auto means = compute_channel_means( sto );
		table< T, L > cv( nchannels, nchannels );
		for ( size_t row = 0; row < nchannels; ++row )
		{
			for ( size_t col = 0; col < nchannels; ++col )
			{
				T v = T( 0 );
				for ( index_t i = 0; i < sto.frame_size(); ++i )
					v += ( sto( i, row ) - means[ row ] ) * ( sto( i, col ) - means[ col ] );
				cv( row, col ) = v / nframes;
			}
		}
		return cv;
	}
Ejemplo n.º 13
0
clRowEntry::clRowEntry(clTreeCtrl* tree, const wxString& label, int bitmapIndex, int bitmapSelectedIndex)
    : m_tree(tree)
    , m_model(tree ? &tree->GetModel() : nullptr)
{
    // Fill the verctor with items constructed using the _non_ default constructor
    // to makes sure that IsOk() returns TRUE
    m_cells.resize(m_tree->GetHeader()->empty() ? 1 : m_tree->GetHeader()->size(),
                   clCellValue("", -1, -1)); // at least one column
    clCellValue cv(label, bitmapIndex, bitmapSelectedIndex);
    m_cells[0] = cv;
}
Ejemplo n.º 14
0
nsPagePrintTimer::~nsPagePrintTimer()
{
  // "Destroy" the document viewer; this normally doesn't actually
  // destroy it because of the IncrementDestroyRefCount call below
  // XXX This is messy; the document viewer should use a single approach
  // to keep itself alive during printing
  nsCOMPtr<nsIContentViewer> cv(do_QueryInterface(mDocViewerPrint));
  if (cv) {
    cv->Destroy();
  }
}
Ejemplo n.º 15
0
void AgeLength::DoExecute() {
  auto age_length = model_->managers().age_length()->FindAgeLength(age_length_label_);
  if (!age_length)
    LOG_FATAL() << "Could not find age_length " << age_length_label_ << " for the report";

  unsigned min_age = model_->min_age();
  unsigned max_age = model_->max_age();
  unsigned year = model_->current_year();
  unsigned time_steps = model_->time_steps().size();

  // Print the header
  cache_ << "*"<< type_ << "[" << label_ << "]" << "\n";
  cache_ << "year: " << model_->current_year() << "\n";
  cache_ << "time_step: " << time_step_ << "\n";

  cache_ << "year time_step ";
  for (unsigned age = min_age; age <= max_age; ++age)
    cache_ << age << " ";
  cache_ << "\n";

  for (unsigned time_step = 0; time_step < time_steps; ++time_step) {
    cache_ << year << " " << time_step << " ";
    for (unsigned age = min_age; age <= max_age; ++age)
      cache_ << age_length->cv(year, time_step, age) << " ";
    cache_ << "\n";
  }

  cache_ << "\n\n";

  cache_ << "year time_step ";
  cache_ << "age  ";
  for (auto length : model_->length_bins())
    cache_ << "L(" << length << ") ";
  cache_ << "\n";

  unsigned start_year = model_->start_year();
  auto age_lengths = model_->partition().age_length_proportions(category_); // map<category, vector<year, time_step, age, length, proportion>>;
  for (unsigned i = 0; i < age_lengths.size(); ++i) {
    if (std::find(years_.begin(), years_.end(), i + start_year) != years_.end()) {
      for (unsigned j = 0; j < age_lengths[i].size(); ++j) {
        for (unsigned k = 0; k < age_lengths[i][j].size(); ++k) {
          cache_ << (start_year + i) << " " << j << " " << (min_age + k) << " ";
          for (unsigned l = 0; l < age_lengths[i][j][k].size(); ++l) {
            cache_ << age_lengths[i][j][k][l] << " ";
          }
          cache_ << "\n";
        }
      }
    }
  }

  ready_for_writing_ = true;
}
Ejemplo n.º 16
0
vector<ContourIndex::ContourPointIdx> ContourIndex::kNearestNeighbors(int k, Contour::ContourPart contourPoint) {

	vector<double> qData(numDimensions);
	qData.push_back(contourPoint->x);
	qData.push_back(contourPoint->y);
	qData.push_back(contourPoint->gradientAngleSmooth.normalize().degree());
	qData.push_back(contourPoint->curvature.normalize().degree());
	SpatialIndex::Point query(&qData[0], numDimensions);
	CollectIndicesVisitor cv(this);
	tree->nearestNeighborQuery(k, query, cv);
	return cv.result;
}
Ejemplo n.º 17
0
TouchClassifier::~TouchClassifier()
{
#ifdef RETRAIN_THE_CLASSIFIER
    std::cout << "training the color classifier..." << std::endl;
    ColorClassifier::CrossValidator cv(3); //cv(60);
    ColorClassifier::KnownSampleSet trainingSet;
    cv.retrieveTrainingSamples(trainingSet);
    _colorClassifier->train(trainingSet);
#endif
    delete _colorClassifier;
    cvReleaseImage(&_transformedColorImage);
}
Ejemplo n.º 18
0
Archivo: eval.c Proyecto: kbob/schetoo
/* N.B., c_eval_seq discards CAR(values) so pass it an extra value. */
static cv_t c_eval_seq(obj_t cont, obj_t values)
{
    assert(is_cont4(cont));
    obj_t env = cont_env(cont);
    obj_t exprs = cont4_arg(cont);
    EVAL_LOG("exprs=%O", exprs);
    obj_t second = cont_cont(cont);
    if (!is_null(CDR(exprs)))
	second = make_cont4(c_eval_seq, second, env, CDR(exprs));
    obj_t first = make_cont4(c_eval, second, env, CAR(exprs));
    return cv(first, CDR(values));
}
Ejemplo n.º 19
0
Archivo: eval.c Proyecto: kbob/schetoo
static cv_t default_handler(obj_t cont, obj_t values)
{
    /*
     * For all non-message-irritants-who conditions,
     *     print the condition's class.
     * For all message conditions, print the condition's message.
     * If who or irritants given, print (cons who irritants).
     */

    assert(is_cont(cont));
    EVAL_LOG("cont=%O values=%O", cont, values);
    obj_t ex = CAR(values);
    obj_t parts = record_get_field(ex, 0);
    const char *psn = program_short_name();
    size_t psnl = strlen(psn);
    size_t i, size = vector_len(parts);
    for (i = 0; i < size; i++) {
	obj_t rtd = record_rtd(vector_ref(parts, i));
	if (rtd != message && rtd != irritants && rtd != who) {
	    ofprintf(stderr, "%*s: %O\n", (int)psnl, psn, rtd_name(rtd));
	    psn = "";
	}
    }
    obj_t who_p = FALSE_OBJ;
    obj_t irr_p = make_uninitialized();
    for (i = 0; i < size; i++) {
	obj_t p = vector_ref(parts, i);
	obj_t rtd = record_rtd(p);
	if (rtd == message) {
	    obj_t msg = record_get_field(p, 0);
	    const wchar_t *chars = string_value(msg);
	    fprintf(stderr, "%*s  %ls\n", (int)psnl, psn, chars);
	    psn = "";
	} else if (rtd == who)
	    who_p = record_get_field(p, 0);
	else if (rtd == irritants)
	    irr_p = record_get_field(p, 0);
    }
    if (who_p != FALSE_OBJ && !is_uninitialized(irr_p)) {
	ofprintf(stderr, "%*s  %O\n", (int)psnl, psn, CONS(who_p, irr_p));
	psn = "";
    } else if (who_p != FALSE_OBJ) {
	ofprintf(stderr, "%*s  %O\n", (int)psnl, psn, who_p);
	psn = "";
    } else if (!is_uninitialized(irr_p)) {
	ofprintf(stderr, "%*s  %O\n", (int)psnl, psn, irr_p);
	psn = "";
    }
    if (*psn)
	fprintf(stderr, "%s: unknown exception\n", psn);
    ofprintf(stderr, "\n");
    return cv(EMPTY_LIST, CONS(make_uninitialized(), EMPTY_LIST));
}
Ejemplo n.º 20
0
cvec cofdm_sel::get_sel( )
{
cvec cv;
int K = sel_carriers.length();
int i;

	cv.set_length(K);
	for (i=0; i<K; i++) {
		cv(i)= y0(sel_carriers(i));
	}
	return (cv);
}
Ejemplo n.º 21
0
/* Runs the convert chain */
static int convert_chain(int c, ...)
{
  va_list list;
  char_cv_t cv;

  va_start(list,c);
  while (cv = va_arg(list,char_cv_t), cv) {
    c = cv(c);
  }
  va_end(list);
  return c;
}
Ejemplo n.º 22
0
void likelihood()
{
	/* writes the log-likelihood given current parameter values */

	/* set sum over log-likelihood to zero */
	set_metr_ltotnew(0.0);
	set_metr_number_ok(0);

	/* loop over data */
	int numdata = table_numrows("mydata");
	for(int ii=0 ; ii<numdata ; ii++)
	{
		double y = table_getvalue("mydata","y",ii);
		/* if this val came from dist 1 */
		double prob1 = normal_density(y, cv("mean1"), cv("sigma1")); 
		/* if this val came from dist 1 */
		double prob2 = normal_density(y, cv("mean2"), cv("sigma2"));
		/* weighted prob */
		double prob3 = prob1*cv("q") + prob2*( 1.0 - cv("q") );
		inc_metr_ltotnew(log(prob3));
		inc_metr_number_ok(1);
	}
	
	return;
}
TEST(CircularValue_NegativeRange, AssignBorder)
{
    // additions
    {
        cv_type cv(-20);
        EXPECT_EQ(-10, cv + 10);
    }
    {
        cv_type cv(-20);
        EXPECT_EQ(-100, cv + 11);
    }
    {
        cv_type cv(-20);
        EXPECT_EQ(-99, cv + 12);
    }

    // subtractions
    {
        cv_type cv(-90);
        EXPECT_EQ(-100, cv - 10);
    }
    {
        cv_type cv(-90);
        EXPECT_EQ(-10, cv - 11);
    }
    {
        cv_type cv(-90);
        EXPECT_EQ(-11, cv - 12);
    }
}
Ejemplo n.º 24
0
  std::auto_ptr<Radiometer> MergeRadiometers( std::vector<const Radiometer *> & vr)
  {
    
    // Number of radiometers
    const size_t nr( vr.size() );
    
    // The merged frequency grid
    std::vector<double> fg;

    // The vector of coeffiecients
    std::vector< std::vector<double> >  cv( nr);

    // The vector iterators
    std::vector< RadioIter >  iv;    
    for ( size_t i =0 ; i < nr ; ++i )
      iv.push_back(RadioIter(vr[i], 0));

    std::vector< RadioIter >::iterator iv_first= iv.begin();

    while (true)
    {
      // i is the radiometer with the smallest current frequency in
      // the set.
      std::vector< RadioIter >::iterator i =
	std::min_element( iv.begin(), iv.end() );

      if (i->atend())
      {
	// we are done
	break;
      }

      fg.push_back( * (i->f_i) );
      for (size_t j = 0  ; j < nr ; ++j)
      {
	if ( (i- iv_first)  == (int)j) 
	{
	  cv[j].push_back( *(i->c_i)  );
	}
	else
	{
	  cv[j].push_back(0.0 );
	}
      }
      
      i->advance();

    }
    
    return std::auto_ptr<Radiometer> ( new Radiometer( fg, cv));

  }
Ejemplo n.º 25
0
void likelihood()
{
    /* writes the log-likelihood given current parameter values */
    int ii;
    double prob1;
    double lambda, ph, depth, moss, count;
    double phref=7.0, depthref=10.0, mossref=0.0;

    /* set sum over log-likelihood to zero */
    set_metr_ltotnew(0.0);
    set_metr_number_ok(0);

    /* loop over data */
    for(ii=0 ; ii<numdata ; ii++)
    {
        ph = table_getvalue("mydata","ph",ii);
        depth = table_getvalue("mydata","depth",ii);
        moss = table_getvalue("mydata","moss",ii);
        count = table_getvalue("mydata","count",ii);

        /* calc lambda */
        lambda = cv("beta") + cv("m0")*exp( cv("gph")*(ph-phref) + cv("gdepth")*(depth-depthref) + cv("gmoss")*(moss-mossref));
        /* prob of observed count */
        prob1 = poisson_density((int)count,lambda);

        if(prob1<0.000000010)
            prob1 = 0.000000010;

        // write prediction into data structure (nb would not be allowable under OMP parallel chains: serial chains only)
        table_writevalue("mydata","predlambda",ii,lambda);
        table_writevalue("mydata","simulatedcount",ii,poisson_draw(lambda));
        // add log prob to sum
        inc_metr_ltotnew(log(prob1));
        inc_metr_number_ok(1);
    }

    return;
} // end of likelihood function
Ejemplo n.º 26
0
static cv_t c_continue_define(obj_t cont, obj_t values)
{
    assert(is_cont5(cont));
    EVAL_LOG("var=%O values=%O", cont5_arg1(cont), values);
    /* N.B., allocate new values before mutating environment. */
    obj_t new_values = CONS(make_unspecified(), cont5_arg2(cont));
    obj_t ret = cont_cont(cont);
    env_bind(cont_env(cont),
	     cont5_arg1(cont),
	     BT_LEXICAL,
	     M_MUTABLE,
	     CAR(values));
    return cv(ret, new_values);
}
Ejemplo n.º 27
0
static already_AddRefed<nsIDocument>
document(nsIDocShell *aDocShell)
{
    nsCOMPtr<nsIContentViewer> cv(doc_viewer(aDocShell));
    if (!cv)
        return nsnull;
    nsCOMPtr<nsIDOMDocument> domDoc;
    cv->GetDOMDocument(getter_AddRefs(domDoc));
    if (!domDoc)
        return nsnull;
    nsIDocument *result = nsnull;
    CallQueryInterface(domDoc, &result);
    return result;
}
Ejemplo n.º 28
0
std::complex<T> hankel_imp(T v, T x, const bessel_no_int_tag&, const Policy& pol, int sign)
{
   BOOST_MATH_STD_USING
   static const char* function = "boost::math::cyl_hankel_1<%1%>(%1%,%1%)";

   if(x < 0)
   {
      bool isint_v = floor(v) == v;
      T j, y;
      bessel_jy(v, -x, &j, &y, need_j | need_y, pol);
      std::complex<T> cx(x), cv(v);
      std::complex<T> j_result, y_result;
      if(isint_v)
      {
         int s = (iround(v) & 1) ? -1 : 1;
         j_result = j * s;
         y_result = T(s) * (y - (2 / constants::pi<T>()) * (log(-x) - log(cx)) * j);
      }
      else
      {
         j_result = pow(cx, v) * pow(-cx, -v) * j;
         T p1 = pow(-x, v);
         std::complex<T> p2 = pow(cx, v);
         y_result = p1 * y / p2
            + (p2 / p1 - p1 / p2) * j / tan(constants::pi<T>() * v);
      }
      // multiply y_result by i:
      y_result = std::complex<T>(-sign * y_result.imag(), sign * y_result.real());
      return j_result + y_result;
   }

   if(x == 0)
   {
      if(v == 0)
      {
         // J is 1, Y is -INF
         return std::complex<T>(1, sign * -policies::raise_overflow_error<T>(function, 0, pol));
      }
      else
      {
         // At least one of J and Y is complex infinity:
         return std::complex<T>(policies::raise_overflow_error<T>(function, 0, pol), sign * policies::raise_overflow_error<T>(function, 0, pol));
      }
   }

   T j, y;
   bessel_jy(v, x, &j, &y, need_j | need_y, pol);
   return std::complex<T>(j, sign * y);
}
Ejemplo n.º 29
0
static inline long do_const_sync(c_block *A,
				 sort_info *B,char *flagB,
				 long posA,long posB,
				 long *begin,long *end,long *offset){
  char *flagA=A->flags;
  long ret=0;

  if(flagB==NULL)
    ret=i_paranoia_overlap(cv(A),iv(B),posA,posB,
			   cs(A),is(B),begin,end);
  else
    if((flagB[posB]&2)==0)
      ret=i_paranoia_overlap2(cv(A),iv(B),flagA,flagB,posA,posB,cs(A),
			      is(B),begin,end);
	
  if(ret>MIN_WORDS_SEARCH){
    *offset=+(posA+cb(A))-(posB+ib(B));
    *begin+=cb(A);
    *end+=cb(A);
    return(ret);
  }
  
  return(0);
}
void MusicPlaylistFoundItemWidget::downLoadFinished(const QByteArray &data)
{
    QPixmap pix;
    pix.loadFromData(data);
    if(!pix.isNull())
    {
        QPixmap cv(":/image/lb_album_cover");
        cv = cv.scaled(m_iconLabel->size());
        pix = pix.scaled(m_iconLabel->size());
        MusicUtils::Widget::fusionPixmap(pix, cv, QPoint(0, 0));
        m_iconLabel->setPixmap(pix);
    }
    m_topListenButton->raise();
    m_playButton->raise();
}