void Settings::addGeneralItems() { _generalLayout.setSpacing(0); _generalLayout.setMargin(0); _langItem.setText(Tr("SoftWare Language")); _langItem.underLine(false); _generalLayout.addWidget(&_langItem); Style::FlatButton style; _langItem.setStyleSheet(QString("color:%1;").arg(style.color.name())); _langLayout.addWidget(&_langLabel); _langItem.setLayout(&_langLayout); if (align() == Align::Rtl) { _langLayout.addWidget(&_langLabel); _langLayout.addStretch(); } else { _langLayout.addStretch(); _langLayout.addWidget(&_langLabel); } _langLayout.setSpacing(0); _langLayout.setMargin(0); _branchesItem.underLine(false); _branchesItem.setText(Tr("Branches Info")); _generalLayout.addWidget(&_branchesItem); }
void LanguagePage::onLangchange(int id) { if (id != _currentId) { _restart.setText(Tr("Restart")); _langChenged = true; } else { _restart.setText(Tr("Ok")); _langChenged = false; } }
main() { initwindow (400, 300,"Triangles"); Tr (100, 100, COLOR(0,0,255)); Tr (200, 220, COLOR(0,255,0)); Tr (200, 160, COLOR(255,0,0)); Tr (100, 220, COLOR(0,255,0)); Tr (100, 160, COLOR(0,0,255)); getch(); closegraph(); }
Matrix VisualOdometry::transformationVectorToMatrix (vector<double> tr) { // extract parameters double rx = tr[0]; double ry = tr[1]; double rz = tr[2]; double tx = tr[3]; double ty = tr[4]; double tz = tr[5]; // precompute sine/cosine double sx = sin(rx); double cx = cos(rx); double sy = sin(ry); double cy = cos(ry); double sz = sin(rz); double cz = cos(rz); // compute transformation Matrix Tr(4,4); Tr.val[0][0] = +cy*cz; Tr.val[0][1] = -cy*sz; Tr.val[0][2] = +sy; Tr.val[0][3] = tx; Tr.val[1][0] = +sx*sy*cz+cx*sz; Tr.val[1][1] = -sx*sy*sz+cx*cz; Tr.val[1][2] = -sx*cy; Tr.val[1][3] = ty; Tr.val[2][0] = -cx*sy*cz+sx*sz; Tr.val[2][1] = +cx*sy*sz+sx*cz; Tr.val[2][2] = +cx*cy; Tr.val[2][3] = tz; Tr.val[3][0] = 0; Tr.val[3][1] = 0; Tr.val[3][2] = 0; Tr.val[3][3] = 1; return Tr; }
Settings::Settings(QWidget *parent) : Dialog(parent), _passcodeSwitch(""), _passCodePage(parent), _changePassCodePage(parent), _langPage(parent) { _mainLayout.setContentsMargins(24, 24, 24, 24); setLayout(&_mainLayout); initGeneral(); initSecurity(); initDataBase(); _mainLayout.insertSpacing(2, 24); _mainLayout.insertSpacing(5, 24); _mainLayout.insertSpacing(8, 24); setMinimumWidth(400); _passCodePage.hide(); _changePassCodePage.hide(); _langPage.hide(); QSettings setting("MyOrg", "MyApp"); _passcodeSwitch.setChecked(setting.value("authentication/hasPasscode").toBool()); _langLabel.setText(Tr(setting.value("Language").toString())); QObject::connect(&_passcodeSwitch, SIGNAL(toggled(bool)), this, SLOT(onSwitch(bool))); QObject::connect(&_passCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel())); QObject::connect(&_changePassCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel())); QObject::connect(&_passCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray))); QObject::connect(&_changePassCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray))); QObject::connect(&_langItem, SIGNAL(clicked()), this, SLOT(onLanguage())); QObject::connect(&_langPage, SIGNAL(ok()), this, SLOT(onLanguageOk())); QObject::connect(&_langPage, SIGNAL(restart(QString)), this, SLOT(onLanguageRestart(QString))); QObject::connect(&_passCodeItem, SIGNAL(clicked()), this, SLOT(onChangePassCode())); }
/** Calculates covariance matrix * * @param covar :: Returned covariance matrix * @param epsrel :: Is used to remove linear-dependent columns */ void CostFuncFitting::calCovarianceMatrix(GSLMatrix &covar, double epsrel) { GSLMatrix c; calActiveCovarianceMatrix(c, epsrel); size_t np = m_function->nParams(); bool isTransformationIdentity = true; size_t ii = 0; for (size_t i = 0; i < np; ++i) { if (!m_function->isActive(i)) continue; isTransformationIdentity = isTransformationIdentity && (m_function->activeParameter(i) == m_function->getParameter(i)); ++ii; } if (isTransformationIdentity) { // if the transformation is identity simply copy the matrix covar = c; } else { // else do the transformation GSLMatrix tm; calTransformationMatrixNumerically(tm); covar = Tr(tm) * c * tm; } }
Array2D<double> ForceConst::transpose(Array2D<double> y){ int n=y.dim1(); Array2D<double> Tr(n,n); for(int i=0;i<n;i++) for(int j=0;j<n;j++) Tr[i][j]=y[j][i]; return Tr; }
NewPassCodePage::NewPassCodePage(QWidget *parent) : Dialog(parent), _passcode(Tr("New PassCode")), _confirm(Tr("Confirm PassCode")), _save(Tr("Save")), _cancel(Tr("Cancel")) { _main.setContentsMargins(24, 24, 24, 8); _main.addLayout(&_active); _main.addLayout(&_pass); _main.addLayout(&_actions); setLayout(&_main); init(); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QObject::connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel())); QObject::connect(&_save, SIGNAL(clicked()), this, SLOT(onSave())); QObject::connect(this, SIGNAL(keyPressd(Qt::Key)), this, SLOT(onKeyPress(Qt::Key))); }
LanguagePage::LanguagePage(QWidget *parent) : Dialog(parent), _fa(Tr("Persian")), _en(Tr("English")), _restart(Tr("Ok")), _langChenged(false) { _main.setContentsMargins(24, 24, 24, 8); setLayout(&_main); _main.addWidget(&_fa); _main.addWidget(&_en); _main.addWidget(&_restart); _group.addButton(&_fa, 0); _group.addButton(&_en, 1); checkLanguage(); QObject::connect(&_group, SIGNAL(buttonClicked(int)), this, SLOT(onLangchange(int))); QObject::connect(&_restart, SIGNAL(clicked()), this, SLOT(onRestart())); QObject::connect(this, SIGNAL(keyPressd(Qt::Key)), this, SLOT(onKeyPress(Qt::Key))); }
void EditSheet::addColumn() { column c; c.name = Tr("CompleteName"); c.width = 50; c.stream = Stream_General; c.key = "CompleteName"; ui->vboxLayout->addLayout(createColumn(c)); emit newPos(ui->vboxLayout->count()); refreshDisplay(); }
bool PulseClusterer::getLRResult(float32_t *startBinP, float32_t *driftP) { double del = pulseCnt * sumxx - sumx*sumx; if (del < 1) return false; *driftP = pulseCnt*sumxy/del - sumx*sumy/del; *startBinP = sumxx*sumy/del - sumx*sumxy/del; // XXX range-check startBin and drift; return false if bad ??? Tr(detail,("LR start bin %f, drift %f", *startBinP, *driftP)); return true; }
void PulseClusterer::addPulseToLR(const Pulse &pulse) { double spec = pulse.spectrum; double bin = pulse.bin; Tr(detail,("add LR pulse spec %f, bin %f", spec, bin)); sumx += spec; sumy += bin; sumxx += spec*spec; sumxy += spec*bin; pulseCnt++; }
int Insert(char *s) { int x=0; for (int l=strlen(s),i=0,w;i<l;i++) { if (!son[x][w=Tr(s[i])]) { son[x][w]=++tot; dph[tot]=i+1; } x=son[x][w]; } sum[x]++; return x; }
void Foam::fv::radialActuationDiskSource:: addRadialActuationDiskAxialInertialResistance ( vectorField& Usource, const labelList& cells, const scalarField& Vcells, const RhoFieldType& rho, const vectorField& U ) const { scalar a = 1.0 - Cp_/Ct_; scalarField Tr(cells.size()); const vector uniDiskDir = diskDir_/mag(diskDir_); tensor E(Zero); E.xx() = uniDiskDir.x(); E.yy() = uniDiskDir.y(); E.zz() = uniDiskDir.z(); const Field<vector> zoneCellCentres(mesh().cellCentres(), cells); const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells); const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V(); const scalar maxR = gMax(mag(zoneCellCentres - avgCentre)); scalar intCoeffs = radialCoeffs_[0] + radialCoeffs_[1]*sqr(maxR)/2.0 + radialCoeffs_[2]*pow4(maxR)/3.0; vector upU = vector(VGREAT, VGREAT, VGREAT); scalar upRho = VGREAT; if (upstreamCellId_ != -1) { upU = U[upstreamCellId_]; upRho = rho[upstreamCellId_]; } reduce(upU, minOp<vector>()); reduce(upRho, minOp<scalar>()); scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1.0 - a); forAll(cells, i) { scalar r2 = magSqr(mesh().cellCentres()[cells[i]] - avgCentre); Tr[i] = T *(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*sqr(r2)) /intCoeffs; Usource[cells[i]] += ((Vcells[cells[i]]/V_)*Tr[i]*E) & upU; }
void Preferences::on_pushButton_newSheet_clicked() { Sheet* s = Sheet::add("newsheet"); s->addColumn(Tr("File Name").toStdString().c_str(),300,Stream_General,"CompleteName"); EditSheet es(s, C, this); if(es.exec() == QDialog::Accepted) { es.apply(); refreshDisplay(); } else { Sheet::removeLast(); qDebug() << "new sheet cancelled"; } }
bool PulseClusterer::absorb(Train &cluster, const pair<float, Triplet>&i) { if (i.first > cluster.hiBin + clusterRange) return false; // adjust signal Tr(detail,("absorb triplet at %f into train max %f", i.first, cluster.hiBin + clusterRange)); int period = i.second.pulses[1].spectrum - i.second.pulses[0].spectrum; cluster.histogram[period].val += 1; cluster.hiBin = i.first; for (int j=0; j<TSZ; j++) cluster.addPulse(i.second.pulses[j]); return true; }
Spectrum EmissionIntegrator::Li(const Scene *scene, const Renderer *renderer, const RayDifferential &ray, const Sample *sample, RNG &rng, Spectrum *T, MemoryArena &arena) const { VolumeRegion *vr = scene->volumeRegion; Assert(sample != NULL); float t0, t1; if (!vr || !vr->IntersectP(ray, &t0, &t1) || (t1-t0) == 0.f) { *T = Spectrum(1.f); return 0.f; } // Do emission-only volume integration in _vr_ Spectrum Lv(0.); // Prepare for volume integration stepping int nSamples = Ceil2Int((t1-t0) / stepSize); float step = (t1 - t0) / nSamples; Spectrum Tr(1.f); pbrt::Point p = ray(t0), pPrev; Vector w = -ray.d; t0 += sample->oneD[scatterSampleOffset][0] * step; for (int i = 0; i < nSamples; ++i, t0 += step) { // Advance to sample at _t0_ and update _T_ pPrev = p; p = ray(t0); Ray tauRay(pPrev, p - pPrev, 0.f, 1.f, ray.time, ray.depth); Spectrum stepTau = vr->tau(tauRay, .5f * stepSize, rng.RandomFloat()); Tr *= Exp(-stepTau); // Possibly terminate ray marching if transmittance is small if (Tr.y() < 1e-3) { const float continueProb = .5f; if (rng.RandomFloat() > continueProb) { Tr = 0.f; break; } Tr /= continueProb; } // Compute emission-only source term at _p_ Lv += Tr * vr->Lve(p, w, ray.time); } *T = Tr; return Lv * step; }
/*********************************************************** update model ***********************************************************/ void OsgObjectHandler::UpdateModel(const LbaNet::ModelInfo &mInfo) { if(_uselight) { if(_OsgObject) OsgHandler::getInstance()->RemoveActorNode(_sceneidx, _OsgObject, true); } else { if(_OsgObjectNoLight) OsgHandler::getInstance()->RemoveActorNode(_sceneidx, _OsgObjectNoLight, false); } osg::ref_ptr<osg::MatrixTransform> node; boost::shared_ptr<DisplayTransformation> Tr(new DisplayTransformation());; Tr->translationX = mInfo.TransX; Tr->translationY = mInfo.TransY; Tr->translationZ = mInfo.TransZ; Tr->rotation = LbaQuaternion(mInfo.RotX, mInfo.RotY, mInfo.RotZ); Tr->scaleX = mInfo.ScaleX; Tr->scaleY = mInfo.ScaleY; Tr->scaleZ = mInfo.ScaleZ; if(mInfo.TypeRenderer == LbaNet::RenderSprite) { node = OsgHandler::getInstance()->CreateSpriteObject(_sceneidx, mInfo.ModelName, mInfo.ColorR, mInfo.ColorG, mInfo.ColorB, mInfo.ColorA, Tr, mInfo.UseLight, mInfo.CastShadow, mInfo.UseBillboard); } else { if(mInfo.ModelName != "") node = OsgHandler::getInstance()->CreateSimpleObject(_sceneidx, mInfo.ModelName, Tr, mInfo.UseLight, mInfo.CastShadow); } if(_uselight) _OsgObject = node; else _OsgObjectNoLight = node; UpdateMatrix(); RefreshText(); }
Spectrum VSDScatteringIntegrator::LiSingle(const Scene *scene, const Renderer *renderer, const RayDifferential &ray, const Sample *sample, RNG &rng, Spectrum *T, MemoryArena &arena) const { VolumeRegion *vr = scene->volumeRegion; float t0, t1; vr->IntersectP(ray, &t0, &t1); // Do single scattering volume integration in _vr_ Spectrum Lv(0.); // Prepare for volume integration stepping int nSamples = Ceil2Int((t1-t0) / stepSize); float step = (t1 - t0) / nSamples; Spectrum Tr(1.f); Point p = ray(t0), pPrev; t0 += sample->oneD[scatterSampleOffset][0] * step; // Compute the emission from the voxels, not from the light sources for (int i = 0; i < nSamples; ++i, t0 += step) { // Advance to sample at _t0_ and update _T_ pPrev = p; p = ray(t0); Ray tauRay(pPrev, p - pPrev, 0.f, 1.f, ray.time, ray.depth); Spectrum stepTau = vr->tau(tauRay, .5f * stepSize, rng.RandomFloat()); Tr *= Exp(-stepTau); // Possibly terminate ray marching if transmittance is small if (Tr.y() < 1e-3) { const float continueProb = .5f; if (rng.RandomFloat() > continueProb) { Tr = 0.f; break; } Tr /= continueProb; } // Compute emission term at _p_ Lv += Tr * vr->PhotonDensity(p); } *T = Tr; return Lv * step; }
Spectrum VisibilityTester::Tr(const Scene &scene, Sampler &sampler) const { Ray ray(p0.SpawnRayTo(p1)); Spectrum Tr(1.f); while (true) { SurfaceInteraction isect; bool hitSurface = scene.Intersect(ray, &isect); // Handle opaque surface along ray's path if (hitSurface && isect.primitive->GetMaterial() != nullptr) return Spectrum(0.0f); // Update transmittance for current ray segment if (ray.medium) Tr *= ray.medium->Tr(ray, sampler); // Generate next ray segment or return final transmittance if (!hitSurface) break; ray = isect.SpawnRayTo(p1); } return Tr; }
void Foam::radialActuationDiskSource:: addRadialActuationDiskAxialInertialResistance ( vectorField& Usource, const labelList& cells, const scalarField& Vcells, const RhoFieldType& rho, const vectorField& U ) const { scalar a = 1.0 - Cp_/Ct_; scalarField T(cells.size()); scalarField Tr(cells.size()); const vector uniDiskDir = diskDir_/mag(diskDir_); tensor E(tensor::zero); E.xx() = uniDiskDir.x(); E.yy() = uniDiskDir.y(); E.zz() = uniDiskDir.z(); const Field<vector> zoneCellCentres(mesh().cellCentres(), cells); const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells); const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V(); const scalar maxR = mag(max(zoneCellCentres - avgCentre)); scalar intCoeffs = coeffs_[0] + coeffs_[1]*sqr(maxR)/2.0 + coeffs_[2]*pow4(maxR)/3.0; forAll(cells, i) { T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a); scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre); Tr[i] = T[i]*(coeffs_[0] + coeffs_[1]*sqr(r) + coeffs_[2]*pow4(r)) /intCoeffs; }
void Settings::addSecurityItems() { _securityLayout.setSpacing(0); _securityLayout.setMargin(0); _passCodeItem.underLine(false); _passCodeItem.setBackground(false); _passCodeItem.setText(Tr("PassCode")); _passcodeLayout.setMargin(0); _passcodeLayout.setSpacing(0); if (align() == Align::Rtl) { _passcodeLayout.addWidget(&_passcodeSwitch); _passcodeLayout.addStretch(); } else if (align() == Align::Ltr) { _passcodeLayout.addStretch(); _passcodeLayout.addWidget(&_passcodeSwitch); } _passCodeItem.setLayout(&_passcodeLayout); _securityLayout.addWidget(&_passCodeItem); }
QString Export::name(int mode) { switch(mode) { default: case TEXT: return Tr("Text"); break; case HTML: return Tr("HTML"); break; case XML: return Tr("XML"); break; case PBCORE: return Tr("PBCore"); break; case PBCORE2: return Tr("PBCore 2"); break; case MPEG7: return Tr("MPEG-7"); break; case CSV: return Tr("CSV"); break; } }
void compute(const vle::devs::Time& /* t */) { PAR = 0.5 * 0.01 * RG(); Tmean = std::max(0.0, (Tmin() + Tmax()) / 2); if (SemRec() == 2) { SemRecVar = 0; } else if (SemRec() == 1) { SemRecVar = 1; } if (SemRecVar() == 0) { ST = 0; LAI = 0; } else if (SemRecVar() == 1) { ST = ST() + Tmean(); LAI = std::max(0.0, Lmax() * ((1 / (1 + std::exp(-A() * (ST() - TI())))) - std::exp(B() * (ST() - Tr())))); } U = U(-1) + Eb() * Eimax() * (1 - std::exp(-K() * LAI())) * PAR(); }
Spectrum SingleScatteringFluorescenceRWLIntegrator::Li(const Scene *scene, const Renderer *renderer, const RayDifferential &ray, const Sample *sample, RNG &rng, Spectrum *T, MemoryArena &arena) const { VolumeRegion *vr = scene->volumeRegion; float t0, t1; if (!vr || !vr->IntersectP(ray, &t0, &t1) || (t1-t0) == 0.f) { *T = 1.f; return 0.f; } // Do single scattering volume integration in _vr_ Spectrum Lv(0.); // Prepare for volume integration stepping int nSamples = Ceil2Int((t1-t0) / stepSize); float step = (t1 - t0) / nSamples; Spectrum Tr(1.f); Point p = ray(t0), pPrev; Vector w = -ray.d; t0 += sample->oneD[scatterSampleOffset][0] * step; // Compute sample patterns for single scattering samples float *lightNum = arena.Alloc<float>(nSamples); LDShuffleScrambled1D(1, nSamples, lightNum, rng); float *lightComp = arena.Alloc<float>(nSamples); LDShuffleScrambled1D(1, nSamples, lightComp, rng); float *lightPos = arena.Alloc<float>(2*nSamples); LDShuffleScrambled2D(1, nSamples, lightPos, rng); uint32_t sampOffset = 0; for (int i = 0; i < nSamples; ++i, t0 += step) { // Advance to sample at _t0_ and update _T_ pPrev = p; p = ray(t0); Ray tauRay(pPrev, p - pPrev, 0.f, 1.f, ray.time, ray.depth); Spectrum stepTau = vr->tau(tauRay, 0.5f * stepSize, rng.RandomFloat()); Tr *= Exp(-stepTau); // Possibly terminate ray marching if transmittance is small if (Tr.y() < 1e-3) { const float continueProb = .5f; if (rng.RandomFloat() > continueProb) { Tr = 0.f; break; } Tr /= continueProb; } // Compute fluorescence emission Spectrum sigma = vr->Mu(p, w, ray.time); if (!sigma.IsBlack() && scene->lights.size() > 0) { int nLights = scene->lights.size(); int ln = min(Floor2Int(lightNum[sampOffset] * nLights), nLights-1); Light *light = scene->lights[ln]; // Add contribution of _light_ due to the in-scattering at _p_ float pdf; VisibilityTester vis; Vector wo; LightSample ls(lightComp[sampOffset], lightPos[2*sampOffset], lightPos[2*sampOffset+1]); Spectrum L = light->Sample_L(p, 0.f, ls, ray.time, &wo, &pdf, &vis); if (!L.IsBlack() && pdf > 0.f && vis.Unoccluded(scene)) { Spectrum Ld = L * vis.Transmittance(scene, renderer, NULL, rng, arena); int lambdaExcIndex = light->GetLaserWavelengthIndex(); float Lpower = Ld.GetLaserEmissionPower(lambdaExcIndex); float yield = vr->Yeild(Point()); Spectrum fEx = vr->fEx(Point()); Spectrum fEm = vr->fEm(Point()); float scale = fEx.GetSampleValueAtWavelengthIndex(lambdaExcIndex); Lv += Lpower * Tr * sigma * vr->p(p, w, -wo, ray.time) * scale * fEm * yield * float(nLights) / pdf; } } ++sampOffset; } *T = Tr; return Lv * step; }
void ComputerWidget::createCaptions() { int i, j; QStringList text; QVector <QStringList> propText; QTreeWidgetItem *top, *cur; text << Tr("Процессор") << Tr("Память (RAM)") << Tr("FDD") << Tr("CD-ROM") << Tr("Жесткий диск") << Tr("Видеокарта"); if (p_comp!=NULL) if (p_comp->className() == NotebookDefaultClassName) { text << Tr("Монитор") << Tr("Внеший вид") << Tr("Батарея") << Tr("Производитель"); } text << Tr("Переферия"); if (p_comp!=NULL) propText.resize(7 + (p_comp->className()==NotebookDefaultClassName)*4); else propText.resize(7); propText[0] << Tr("Модель") << Tr("Кол-во ядер") << Tr("Частота") << Tr("Разрядность (длинна слова)") << Tr("Архитектура"); propText[1] << Tr("Размер") << Tr("Частота") << Tr("Тип"); propText[2] << Tr("Наличие") << Tr("Размер дискет"); //CD propText[3] << Tr("Наличие") << Tr("Название") << Tr("Параметры"); //HDD propText[4] << Tr("Название") << Tr("Размер"); //Video propText[5] << Tr("Наличие") << Tr("Тип") << Tr("Название") << Tr("Размер памяти"); if (p_comp!=NULL) if (p_comp->className()==NotebookDefaultClassName) { propText[6] << Tr("Диагональ") << Tr("Разрешение"); propText[7] << Tr("Вес") << Tr("Цвет"); propText[8] << Tr("Заряд") << Tr("Время работы"); propText[9] << Tr("Название") << Tr("Страна-производитель") << Tr("Стоимость"); } caption.resize(0); for (i=0; i<text.size(); i++) { top=new QTreeWidgetItem(this); top->setText(0, text[i]); top->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); top->setBackground(0, QBrush(QColor::fromRgb(0xB5, 0xFF, 0xB5))); caption.push_back(top); for (j=0; j<propText[i].size(); j++) { cur=new QTreeWidgetItem(top); cur->setText(0, propText[i][j]); cur->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); caption.push_back(cur); } } }
void ComputerWidget::outputData() { QString s; int i; qDebug() << "outputData()"; if (p_comp==NULL) return; caption[1]->setText(1, p_comp->cpuName); caption[2]->setText(1, QString::number(p_comp->cpuCoreCount)); caption[3]->setText(1, QString::number(p_comp->cpuSpeed)+tr(" Мгц")); caption[4]->setText(1, QString::number(p_comp->cpuWordLen)+tr(" бит")); switch (p_comp->cpuArch) { case Computer::x86: caption[5]->setText(1, "x86");break; case Computer::x86_64: caption[5]->setText(1, "x86_64");break; case Computer::sparc: caption[5]->setText(1, "sparc");break; case Computer::arm: caption[5]->setText(1, "arm");break; case Computer::otherArch: caption[5]->setText(1, "неизвестно");break; }; caption[7]->setText(1, QString::number(p_comp->ramSize)+tr(" МБайт")); caption[8]->setText(1, QString::number(p_comp->ramSpeed)+tr(" МГц")); caption[9]->setText(1, Tr("DDR%1").arg(p_comp->ramDDR)); caption[11]->setText(1, p_comp->hasFdd ? Tr("Да") : Tr("Нет") ); if (p_comp->hasFdd) switch (p_comp->sizeFdd) { case Computer::inch525: caption[12]->setText(1, Tr("5,25 дюма"));break; case Computer::inch35: caption[12]->setText(1, Tr("3,5 дюма"));break; case Computer::otherSize: caption[12]->setText(1, Tr("Неизвестный размер")); } else caption[12]->setText(1, Tr("")); caption[14]->setText(1, p_comp->hasCdrom ? Tr("Есть") : Tr("Нет")); if (p_comp->hasCdrom) { caption[15]->setText(1, p_comp->cdRomName); if (p_comp->cdRomFlags & Computer::cdrfCDRW) s+="CD-RW "; else if (p_comp->cdRomFlags & Computer::cdrfCDR) s+="CD-R" ; if (p_comp->cdRomFlags & Computer::cdrfDVDRW) s+="DVD-RW "; else if (p_comp->cdRomFlags & Computer::cdrfDVDR) s+="DVD-R "; if (p_comp->cdRomFlags & Computer::cdrfBRRW) s+="BluRay-RW "; else if (p_comp->cdRomFlags & Computer::cdrfBRR) s+="BluRay-R"; caption[16]->setText(1, s); } caption[18]->setText(1, p_comp->hddName); caption[19]->setText(1, QString::number(p_comp->hddSize/gBytes)+tr(" ГБайт")); caption[21]->setText(1, p_comp->hasVideoCard ? Tr("Есть") : Tr("Нет")); if (p_comp->hasVideoCard) switch (p_comp->videoCardType) { case Computer::vctBuiltIn: caption[22]->setText(1, Tr("Встроенная"));break; case Computer::vctPCI: caption[22]->setText(1, Tr("PCI"));break; case Computer::vctUSB: caption[22]->setText(1, Tr("USB"));break; } caption[23]->setText(1, p_comp->videoCardName); caption[24]->setText(1, QString::number(p_comp->videoCardRam)+tr(" МБайт")); if (p_comp->className() != ComputerDefaultClassName) { /* propText[6] << Tr("Диагональ") << Tr("Разрешение"); propText[7] << Tr("Вес") << Tr("Цвет"); propText[8] << Tr("Название") << Tr("Страна-производитель") << Tr("Стоимость"); */ caption[26]->setText(1, QString::number(((Notebook*)p_comp)->monitorDiagonal)+tr(" дюйм(ов)")); caption[27]->setText(1, QString("%1 x %2").arg(((Notebook*)p_comp)->monitorSize.width()).arg(((Notebook*)p_comp)->monitorSize.height())); caption[29]->setText(1, QString::number(((Notebook*)p_comp)->weight)+tr(" кг")); caption[30]->setText(1, ((Notebook*)p_comp)->color); caption[32]->setText(1, QString::number(((Notebook*)p_comp)->batterySize)+tr(" мАч")); caption[33]->setText(1, QString::number(((Notebook*)p_comp)->batteryTime)+tr(" час(а)")); caption[35]->setText(1, ((Notebook*)p_comp)->notebookName); caption[36]->setText(1, ((Notebook*)p_comp)->notebookOrigin); caption[37]->setText(1, QString::number(((Notebook*)p_comp)->notebookCost)+tr(" руб.")); } QList <QTreeWidgetItem*> list=caption[caption.size()-1]->takeChildren(); QList <QTreeWidgetItem*>::iterator it; it=list.begin(); qDebug() << *it; qDebug() << list.size(); for (i=0; i<p_comp->otherHardware.size(); i++) { qDebug() << p_comp->otherHardware[i]; if (list.size() <= i) { list.push_back(new QTreeWidgetItem(caption[caption.size()-1])); it=list.end(); --it; } (*it)->setText(0, p_comp->otherHardware[i]); (*it)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); qDebug() << (*it)->data(0, Qt::DisplayRole); ++it; } while (list.size() > i) delete list.takeLast(); caption[caption.size()-1]->addChildren(list); // Qt 4.3 bug -- no repaint // collapseItem(caption[caption.size()-1]); // expandItem(caption[caption.size()-1]); }
int main() { cout<<"Effective confs: "<<nconfs<<endl; fin=open_file("rende_new","r"); vector<pair<vector<int>,string>> full_Tr_map(nfull_Tr); //prepare all maps DEF_MAP_1(M_dM); DEF_MAP_1(M_d2M); DEF_MAP_1(M_dM_M_dM); DEF_MAP_1(M_d3M); DEF_MAP_1(M_dM_M_d2M); DEF_MAP_1(M_dM_M_dM_M_dM); DEF_MAP_1(M_d2M_M_d2M); DEF_MAP_1(M_d2M_M_dM_M_dM); DEF_MAP_1(M_dM_M_dM_M_dM_M_dM); DEF_MAP_2(M_dM,M_dM); DEF_MAP_2(M_dM,M_dM_M_dM); DEF_MAP_2(M_dM,M_d2M); DEF_MAP_3(M_dM,M_dM,M_dM); DEF_MAP_2(M_dM,M_dM_M_d2M); DEF_MAP_2(M_d2M,M_dM_M_dM); DEF_MAP_2(M_dM_M_dM,M_dM_M_dM); DEF_MAP_2(M_dM_M_dM_M_dM,M_dM); DEF_MAP_2(M_d2M,M_d2M); DEF_MAP_3(M_dM_M_dM,M_dM,M_dM); DEF_MAP_3(M_d2M,M_dM,M_dM); DEF_MAP_4(M_dM,M_dM,M_dM,M_dM); //read all flavour, confs and take all trace products conf by conf for(int iconf=0;iconf<nconfs;iconf++) { const int ijack=iconf/clust_size; read_conf(); for(int iflav=0;iflav<nflavs;iflav++) for(int ifull=0;ifull<nfull_Tr;ifull++) full_Tr[ind_full(iflav,ifull)][ijack]+= Tr(full_Tr_map[ifull].first,iflav).real(); // dcompl a=0; // double nc=0; // for(int icopy=0;icopy<ncopies;icopy++) // for(int jcopy=icopy+1;jcopy<ncopies;jcopy++) // for(int kcopy=jcopy+1;kcopy<ncopies;kcopy++) // for(int lcopy=kcopy+1;lcopy<ncopies;lcopy++) // { // a+= // base_Tr[ind(0,M_dM,icopy)]* // base_Tr[ind(0,M_dM,jcopy)]* // base_Tr[ind(0,M_dM,kcopy)]* // base_Tr[ind(0,M_dM,lcopy)]; // nc+=1; // } // double ex=a.real()/nc; // double al=full_Tr[ind_full(0,Tr_M_dM_Tr_M_dM_Tr_M_dM_Tr_M_dM)][iconf]; // cout<<"exact: "<<ex<<", algo: "<<al<<", rel diff: "<<(ex-al)/(ex+al)<<", nc: "<<nc<<" "<<((1.0)*(nconfs)*(ncopies)*(ncopies-1)*(ncopies-2)*(ncopies-3))<<endl; } //close and clusterize fclose(fin); full_Tr.clusterize(clust_size); for(int ifull=0;ifull<nfull_Tr;ifull++) cout<<full_Tr_map[ifull].second<<" ("<<Tr_get_nperm(full_Tr_map[ifull].first)<<" "<<Tr_get_mult(full_Tr_map[ifull].first)<<") = "<<fTr(ifull)<<endl; //compute susc2 jack susc2_disc=(fTr(Tr_M_dM_Tr_M_dM)-sqr(fTr(Tr_M_dM)))/(16*V4); jack susc2_conn=(fTr(Tr_M_d2M)-fTr(Tr_M_dM_M_dM))/(4*V4); jack susc2_tot=susc2_conn+susc2_disc; jack susc4= -6*fTr(Tr_M_dM_M_dM_Tr_M_dM_Tr_M_dM)/64 +1*fTr(Tr_M_dM_Tr_M_dM_Tr_M_dM_Tr_M_dM)/256 +6*fTr(Tr_M_d2M_Tr_M_dM_Tr_M_dM)/64 -3*fTr(Tr_M_dM_Tr_M_dM)*fTr(Tr_M_d2M)/64 +3*fTr(Tr_M_dM_Tr_M_dM)*fTr(Tr_M_dM_M_dM)/64 -3*fTr(Tr_M_dM_Tr_M_dM)*fTr(Tr_M_dM_Tr_M_dM)/256 -6*fTr(Tr_M_d2M_Tr_M_dM_M_dM)/16 +3*fTr(Tr_M_dM_M_dM_Tr_M_dM_M_dM)/16 +1*fTr(Tr_M_dM_M_dM_M_dM_Tr_M_dM)/2 +1*fTr(Tr_M_dM_Tr_M_dM)/16 +3*fTr(Tr_M_d2M_Tr_M_d2M)/16 -33*fTr(Tr_M_dM_Tr_M_dM_M_d2M)/64 -3*fTr(Tr_M_d2M)*fTr(Tr_M_d2M)/16 +3*fTr(Tr_M_d2M)*fTr(Tr_M_dM_M_dM)/16 -3*fTr(Tr_M_d2M)*fTr(Tr_M_dM_Tr_M_dM)/64 -3*fTr(Tr_M_d2M_M_d2M)/4 +3*fTr(Tr_M_d2M_M_dM_M_dM)/1 -1*fTr(Tr_M_dM_M_dM)/1 -3*fTr(Tr_M_dM_M_dM_M_dM_M_dM)/2 +1*fTr(Tr_M_d2M)/4 +3*fTr(Tr_M_dM_M_dM)*fTr(Tr_M_d2M)/16 -3*fTr(Tr_M_dM_M_dM)*fTr(Tr_M_dM_M_dM)/16 +3*fTr(Tr_M_dM_M_dM)*fTr(Tr_M_dM_Tr_M_dM)/64; susc4/=V4*Nt*Nt; cout<<"susc2 = "<<susc2_tot<<endl; cout<<"susc4 = "<<susc4<<endl; return 0; }
void Settings::initDataBase() { _dbHeader.setText(Tr("DataBase Settings")); _mainLayout.addWidget(&_dbHeader); _mainLayout.addLayout(&_dbLayout); addDataBaseItems(); }
void Settings::initSecurity() { _sHeader.setText(Tr("Security Settings")); _mainLayout.addWidget(&_sHeader); _mainLayout.addLayout(&_securityLayout); addSecurityItems(); }