示例#1
0
/***********************************************************************//**
 * @brief Print integral information
 *
 * @param[in] chatter Chattiness (defaults to NORMAL).
 * @return String containing integral information.
 ***************************************************************************/
std::string GIntegral::print(const GChatter& chatter) const
{
    // Initialise result string
    std::string result;

    // Continue only if chatter is not silent
    if (chatter != SILENT) {

        // Append header
        result.append("=== GIntegral ===");

        // Append information
        result.append("\n"+gammalib::parformat("Relative precision"));
        result.append(gammalib::str(eps()));
        result.append("\n"+gammalib::parformat("Max. number of iterations"));
        result.append(gammalib::str(max_iter()));
        if (silent()) {
            result.append("\n"+gammalib::parformat("Warnings")+"suppressed");
        }
        else {
            result.append("\n"+gammalib::parformat("Warnings"));
            result.append("in standard output");
        }

    } // endif: chatter was not silent

    // Return result
    return result;
}
示例#2
0
int last_non_silent_frame(float *chrom_energy, int frame_count)
{
    int frames;
    for (frames = frame_count - 1; frames > 0; frames--) {
        if (!silent(frames, chrom_energy)) break;
    }
    return frames; 
}
示例#3
0
int frames_of_init_silence(float *chrom_energy, int frame_count)
{
    int frames;
    for (frames = 0; frames < frame_count; frames++) {
        if (!silent(frames, chrom_energy)) break;
    }
    return frames; 
}
void QSimpleUpdater::checkForUpdates (void)
{
    if (!m_reference_url.isEmpty())
    {
        connect (m_manager, SIGNAL (finished (QNetworkReply *)),
                 this,        SLOT (checkDownloadedVersion (QNetworkReply *)));

        m_manager->get (QNetworkRequest (m_reference_url));

        if (!silent())
            m_progressDialog->show();
    }
示例#5
0
文件: Tone.cpp 项目: Dzenik/Cosa
void 
Tone::play(uint16_t freq, uint8_t volume, uint16_t duration, bool background) 
{
  // Check if turn off tone
  if ((freq == 0) || (volume == 0)) { 
    silent();
    return;
  }

  // Check volume does not exceed limit
  if (volume > VOLUME_MAX) volume = VOLUME_MAX;
  
  // Calculate clock prescaling 
  uint8_t prescaler = _BV(CS10);
  uint32_t top = (F_CPU / freq / 2) - 1;
  if (top > 65535L) {
    prescaler = _BV(CS12);
    top = (top / 256) - 1;
  }

  // Get duty from volume map
  uint16_t duty = top / pgm_read_byte(&s_map[volume - 1]);

  // Check if interrupt handler should be enabled to turn off tone
  if ((duration > 0) && background) {
    s_expires = Watchdog::millis() + duration;
    TIMSK1 |= _BV(OCIE1A);
  }
  ICR1 = top;
  if (TCNT1 > top) TCNT1 = top;
  TCCR1B = (_BV(WGM13) | prescaler);
  OCR1A = duty;
  OCR1B = duty;
  TCCR1A = (_BV(COM1A1) | _BV(COM1B1) | _BV(COM1B0));

  // Check for asychronious mode
  if ((duration == 0) || background) return;
  delay(duration); 
  silent(); 
}
示例#6
0
// We can ignore scale(i) here, because it factors out.
efloat_t DParrayConstrained::path_P(const vector<int>& g_path) const
{
    const int I = size()-1;
    int i=I;
    int l=g_path.size()-1;
    int state2 = g_path[l];

    vector<double> transition(nstates());

    efloat_t Pr=1.0;
    while (l>0)
    {
        transition.resize(states(i).size());
        for(int s1=0; s1<transition.size(); s1++) {
            int state1 = states(i)[s1];
            transition[s1] = (*this)(i,state1)*GQ(state1,state2);
        }

        int state1 = g_path[l-1];
        int s1 = find_index(states(i),state1);
        assert(s1 != -1);
        double p = choose_P(s1,transition);
        assert(p > 0.0);

        if (di(state1)) i--;

        l--;
        state2 = state1;
        Pr *= p;
        assert(Pr > 0.0);
    }

    // In column 0, all states are allowed:
    // - silent states can't contradict anything
    // - non-silent states reprent the start state.
    transition.resize(states(0).size());

    // include probability of choosing 'Start' vs ---+ !
    for(int state1=0; state1<nstates(); state1++)
        transition[state1] = (*this)(0,state1) * GQ(state1,state2);

    // Get the probability that the previous state was 'Start'
    double p=0.0;
    for(int state1=0; state1<nstates(); state1++)
        if (not silent(state1))
            p += choose_P(state1,transition);

    Pr *= p;

    assert(Pr > 0.0);
    return Pr;
}
示例#7
0
文件: error.c 项目: E-LLP/QuIP
void warn(QSP_ARG_DECL  const char* msg)
	/* warning message */
{
	if( ! silent(SINGLE_QSP_ARG) ){
		(*warn_vec)(QSP_ARG  msg);
	}

	INC_QS_N_WARNINGS(THIS_QSP);

	if( QS_MAX_WARNINGS(THIS_QSP) > 0 &&
		QS_N_WARNINGS(THIS_QSP) >= QS_MAX_WARNINGS(THIS_QSP) ){

		sprintf(ERROR_STRING,"Too many warnings (%d max)",
			QS_MAX_WARNINGS(THIS_QSP));
		error1(QSP_ARG  ERROR_STRING);
//        advise(ERROR_STRING);
//        abort();
	}
}
void MT_MProEngProfile::IsSilentTestL()
    {
    TBool silent( iProfile->IsSilent() );
    TBool expected( EFalse );
    switch( iProfileId )
        {
        case 1:
        case 4:
        case 6:
            {
            expected = ETrue;
            break;
            }
        default: // EFalse is already set above
            {
            break;
            }
        }
    EUNIT_ASSERT( expected == silent );
    }
示例#9
0
// We can ignore scale(i) here, because it factors out.
efloat_t DParray::path_P(const vector<int>& g_path) const
{
    const int I = size()-1;
    int i=I;
    int l=g_path.size()-1;
    int state2 = g_path[l];

    vector<double> transition(nstates());

    efloat_t Pr=1.0;
    while (l>0)
    {
        for(int state1=0; state1<nstates(); state1++)
            transition[state1] = (*this)(i,state1)*GQ(state1,state2);

        int state1 = g_path[l-1];
        double p = choose_P(state1,transition);
        assert(p > 0.0);

        if (di(state1)) i--;

        l--;
        state2 = state1;
        Pr *= p;
    }

    // include probability of choosing 'Start' vs ---+ !
    for(int state1=0; state1<nstates(); state1++)
        transition[state1] = (*this)(0,state1) * GQ(state1,state2);

    // Get the probability that the previous state was 'Start'
    double p=0.0;
    for(int state1=0; state1<nstates(); state1++)
        if (not silent(state1))
            p += choose_P(state1,transition);

    Pr *= p;

    assert(Pr > 0.0);
    return Pr;
}
示例#10
0
/***********************************************************************//**
 * @brief Print integral information
 ***************************************************************************/
std::string GIntegral::print(void) const
{
    // Initialise result string
    std::string result;

    // Append header
    result.append("=== GIntegral ===");

    // Append information
    result.append("\n"+parformat("Relative precision")+str(eps()));
    result.append("\n"+parformat("Max. number of iterations")+str(max_iter()));
    if (silent()) {
        result.append("\n"+parformat("Warnings")+"suppressed");
    }
    else {
        result.append("\n"+parformat("Warnings")+"in standard output");
    }

    // Return result
    return result;
}
示例#11
0
文件: error.c 项目: E-LLP/QuIP
void _advise(QSP_ARG_DECL  const char* msg)
	/* Advisory message */
{
	if( ! silent(SINGLE_QSP_ARG) )
		(*advise_vec)(QSP_ARG  msg);
}