コード例 #1
0
ファイル: AssumptionSet.cpp プロジェクト: VSRonin/CLOModel
bool AssumptionSet::IsValid() const {
    Q_D(const AssumptionSet);
    if (BloombergVector(d->m_CDRscenario).IsEmpty(0.0, 1.0)) return false;
    if (BloombergVector(d->m_CPRscenario).IsEmpty(0.0, 1.0)) return false;
    if (BloombergVector(d->m_LSscenario).IsEmpty(0.0, 1.0)) return false;
    if (BloombergVector(d->m_DelinqScenario).IsEmpty(0.0, 1.0)) return false;
    if (IntegerVector(d->m_RecLagScenario).IsEmpty(0)) return false;
    if (IntegerVector(d->m_DelinqLagScenario).IsEmpty(0)) return false;
	return true;
}
コード例 #2
0
void Polynomial::scaleMarkedCoefficientToOne()
{
	assert(isMarked());
  FieldElement a=marked.c.inverse();
  Monomial k(theRing);
  k.exponent=IntegerVector(getNumberOfVariables());
  Term s(a,k);
  *this*=s;
  marked.c=marked.c.one();
}
コード例 #3
0
ファイル: MtgCalculator.cpp プロジェクト: bubble501/CLOModel
QString MtgCalculator::ReadyToCalculate()const{
    Q_D(const MtgCalculator);
	RETURN_WHEN_RUNNING(true, "Calculator Already Running\n" )
	QString Result;
	QString TempStr;
    if (d->StartDate.isNull()) Result += "Invalid Start Date\n";
    const auto loansKeys = d->m_Loans.keys();
    for (auto SingleLoan = loansKeys.constBegin(); SingleLoan != loansKeys.constEnd(); ++SingleLoan){
        TempStr = std::get<1>(d->m_Loans.value<Mortgage>(*SingleLoan)).ReadyToCalculate();
        if (!TempStr.isEmpty()) Result += TempStr + '\n';
    }
    if (BloombergVector(d->m_CPRass).IsEmpty(0.0, 1.0)) Result += "CPR Vector: " + d->m_CPRass + '\n';
    if (BloombergVector(d->m_CDRass).IsEmpty(0.0, 1.0)) Result += "CDR Vector: " + d->m_CDRass + '\n';
    if (BloombergVector(d->m_LSass).IsEmpty()) Result += "LS Vector: " + d->m_LSass + '\n';
    if (IntegerVector(d->m_RecoveryLag).IsEmpty()) Result += "Recovery Lag Vector: " + d->m_RecoveryLag + '\n';
    if (BloombergVector(d->m_Delinquency).IsEmpty(0, 1.0)) Result += "Delinquency Vector Vector: " + d->m_Delinquency + '\n';
    if (IntegerVector(d->m_DelinquencyLag).IsEmpty()) Result += "Delinquency Lag Vector: " + d->m_DelinquencyLag + '\n';
	if(!Result.isEmpty()) return Result.left(Result.size()-1);
	return Result;
}
コード例 #4
0
ファイル: StressTest.cpp プロジェクト: bubble501/CLOModel
void StressTest::RunCurrentScenario() {
    Q_D( StressTest);
    if (!d->ContinueCalculation)  return StoppedCalculation();
	AssumptionSet CurrentAss(
        *(d->m_CPRscenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssCPR])
        , *(d->m_CDRscenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssCDR])
        , *(d->m_LSscenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssLS])
        , *(d->m_RecLagScenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssRecLag])
        , *(d->m_DelinqScenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssDelinq])
        , *(d->m_DelinqLagScenarios.constBegin() + d->CurrentAssumption[StressTestPrivate::AssDelinqLag])
	);
	if (
        d->UseFastVersion
		&& !IntegerVector(CurrentAss.GetRecLagScenario()).IsEmpty(0, 0)
		&& !IntegerVector(CurrentAss.GetDelinqLagScenario()).IsEmpty(0, 0)
		&& !BloombergVector(CurrentAss.GetDelinqScenario()).IsEmpty(0.0, 0.0)
	) {
        if (d->ProgressForm) {
            d->ProgressForm->SetPhaseMax(1, 100);
            d->ProgressForm->SetPhaseMax(0, d->ProgressForm->GetPhaseMax(0) - 1);
		}
        d->BaseApplier->AddAssumption(CurrentAss, d->BaseApplier->NumBees());
		emit CurrentScenarioCalculated();
	}
    else {
        connect(d->BaseCalculator, &MtgCalculator::Calculated, this, &StressTest::SlowLoansCalculated, Qt::UniqueConnection);
        d->BaseCalculator->SetCPRass(CurrentAss.GetCPRscenario());
        d->BaseCalculator->SetCDRass(CurrentAss.GetCDRscenario());
        d->BaseCalculator->SetLSass(CurrentAss.GetLSscenario());
        d->BaseCalculator->SetRecoveryLag(CurrentAss.GetRecLagScenario());
        d->BaseCalculator->SetDelinquency(CurrentAss.GetDelinqScenario());
        d->BaseCalculator->SetDelinquencyLag(CurrentAss.GetDelinqLagScenario());
        if (std::get<0>(d->BaseCalculator->StartCalculation(true))) {
			emit ErrorInCalculation();
		}
	}

}
コード例 #5
0
QWidget *LoanAssumptionDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & index) const {
    if (!index.data(Qt::UserRole).isNull())	{
        switch (index.data(Qt::UserRole).toInt()) {
        case static_cast<qint8>(AssumptionType::DoubleAssumption) : {
            QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
            editor->setMinimum(0.0);
            editor->setSingleStep(5.0);
            //connect(editor, SIGNAL(valueChanged(double)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::DoubleAssumption0To100) : {
            QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
            editor->setMinimum(0.0);
            editor->setSingleStep(5.0);
            editor->setMaximum(100.0);
            editor->setSuffix("%");
            //connect(editor, SIGNAL(valueChanged(double)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::IntegerAssumption) : {
            QSpinBox *editor = new QSpinBox(parent);
            editor->setMinimum(0);
            editor->setSingleStep(1);
            //connect(editor, SIGNAL(valueChanged(int)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::BloombergVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(BloombergVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::IntegerVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(IntegerVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        case static_cast<qint8>(AssumptionType::DayCountVectorAssumption) : {
            QLineEdit *editor = new QLineEdit(parent);
            editor->setValidator(DayCountVector().GetValidator(editor));
            //connect(editor, SIGNAL(textEdited(const QString &)), this, SIGNAL(Edited()));
            return editor;
        }
        default:
            break;
        }
    }
    return new QWidget(parent);
}
コード例 #6
0
Simulator::Simulator() {
    network_type_ = COLLOCATED;
    network_size_ = 0;
    interference_radius_ = 0;
    maximal_schedule_matrix_ = BooleanMatrix(0);
    arrival_dist_ = UNIFORM_PACKET;
    min_packet_ = IntegerVector(network_size_, 0);
    max_packet_ = IntegerVector(network_size_, 0);
    binom_param_ = Ratios(network_size_, 0);
    bern_param_ = Ratios(network_type_, 0);
    min_delay_bound_ = IntegerVector(network_size_, 0);
    max_delay_bound_ = IntegerVector(network_size_, 0);
    base_qos_ = Ratios(network_size_, 0);
    num_iterations_ = 0;
    policy_indicator_ = BooleanVector(POLICY_COUNT, false);
    bandwidth_ = IntegerVector(0);
    qos_ratio_ = Ratios(0);
    queueing_system_ = QueueingSystem3D(0);
    system_clock_ = 0;
    rng_seed_ = 0;
    output_throughput_ = false;
    threshold_ratio_ = 0;
}
コード例 #7
0
ファイル: GloveFitter.cpp プロジェクト: cran/text2vec
AdaGradIter::AdaGradIter(GloveFit &fit):
  x_irow(IntegerVector(0)),
  x_icol(IntegerVector(0)),
  x_val(NumericVector(0)),
  iter_order(IntegerVector(0)),
  fit(fit) {};