本文整理汇总了C++中sk函数的典型用法代码示例。如果您正苦于以下问题:C++ sk函数的具体用法?C++ sk怎么用?C++ sk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sk函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sk
// set value
void ReservoirMethod::SetValue(const char* key, float value)
{
string sk(key);
if (StringMatch(sk,"TimeStep"))
m_TimeStep = int(value);
else if (StringMatch(sk, "ThreadNum"))
omp_set_num_threads((int)value);
else if (StringMatch(sk,"CellSize"))
m_nCells = int(value);
else if (StringMatch(sk,"CellWidth"))
m_CellWidth = int(value);
else if (StringMatch(sk,"Kg"))
m_Kg = value;
else if (StringMatch(sk,"Base_ex"))
m_Base_ex = value;
else if (StringMatch(sk,"df_coef"))
m_dp_co = value;
else if (StringMatch(sk,"GW0"))
m_GW0 = value;
else if (StringMatch(sk,"GWMAX"))
m_GWMAX = value;
//else if(StringMatch(sk, "UpperSoilDepth"))
// m_upSoilDepth = value;
else
throw ModelException("GWA_RE","SetValue","Parameter " + sk + " does not exist in GWA_RE module. Please contact the module developer.");
}
示例2: m_id
RegionDesc::Block::Block(const Func* func,
bool resumed,
Offset start,
int length,
FPInvOffset initSpOff,
uint16_t inlineLevel)
: m_id(s_nextId--)
, m_func(func)
, m_resumed(resumed)
, m_start(start)
, m_last(kInvalidOffset)
, m_length(length)
, m_initialSpOffset(initSpOff)
, m_inlinedCallee(nullptr)
, m_inlineLevel(inlineLevel)
{
assertx(length >= 0);
if (length > 0) {
SrcKey sk(func, start, resumed);
for (unsigned i = 1; i < length; ++i) sk.advance();
m_last = sk.offset();
}
checkInstructions();
checkMetadata();
}
示例3: initialOutputs
void ReservoirMethod::Get1DData(const char *key, int *nRows, float **data)
{
initialOutputs();
string sk(key);
if (StringMatch(sk, VAR_REVAP))
{
*data = m_D_Revap;
*nRows = m_nCells;
}
else if (StringMatch(sk, VAR_RG))
{
*data = m_T_RG;
*nRows = m_nSubbasins + 1;
}
else if (StringMatch(sk, VAR_SBQG))
{
*data = m_T_QG;
*nRows = m_nSubbasins + 1;
}
else if (StringMatch(sk, VAR_SBGS))
{
*data = m_gwStore;
*nRows = m_nSubbasins + 1;
}
else if (StringMatch(sk, VAR_SBPET))
{
*data = m_petSubbasin;
*nRows = m_nSubbasins + 1;
}
else
throw ModelException(MID_GWA_RE, "Get1DData", "Parameter " + sk + " does not exist.");
}
示例4: main
int main(int argc, char *argv[]) {
long m, p, r, L, R;
ArgMapping argmap;
MDL::Timer timer;
argmap.arg("m", m, "m");
argmap.arg("L", L, "L");
argmap.arg("p", p, "p");
argmap.arg("r", r, "r");
argmap.arg("R", R, "R");
argmap.parse(argc, argv);
timer.start();
FHEcontext context(m, p, r);
buildModChain(context, L);
FHESecKey sk(context);
sk.GenSecKey(64);
addSome1DMatrices(sk);
FHEPubKey pk = sk;
auto G = context.alMod.getFactorsOverZZ()[0];
EncryptedArray ea(context, G);
timer.end();
printf("slots %ld\n", ea.size());
printf("Key Gen %f\n", timer.second());
auto data = load_csv("adult.data", R);
benchmark(ea, pk, sk, data);
}
示例5: sk
void ReservoirMethod::Set1DData(const char *key, int n, float *data)
{
string sk(key);
if (StringMatch(sk, VAR_GWNEW))
{
m_VgroundwaterFromBankStorage = data;
return;
}
//check the input data
if (!CheckInputSize(key, n)) return;
//set the value
if (StringMatch(sk, VAR_INET))
m_D_EI = data;
else if (StringMatch(sk, VAR_DEET))
m_D_ED = data;
else if (StringMatch(sk, VAR_SOET))
m_D_ES = data;
else if (StringMatch(sk, VAR_AET_PLT))
m_plantEP = data;
else if (StringMatch(sk, VAR_PET))
m_D_PET = data;
else if (StringMatch(sk, VAR_SLOPE))
m_Slope = data;
else if (StringMatch(sk, VAR_SOILLAYERS))
m_soilLayers = data;
else
throw ModelException(MID_GWA_RE, "Set1DData", "Parameter " + sk + " does not exist in current module.");
}
示例6: Scene
GameMenuScene::GameMenuScene(Stage* stage, QGraphicsItem* parent)
: Scene(mapSceneName(sceneGameMenu), stage, parent)
{
setBackground("gm_background");
LinearLayout* leftLayout = new LinearLayout(Qt::Vertical);
Actor* gameTitle = new Actor("ge_game_title", this);
gameTitle->setPaddings(0.1);
leftLayout->addItem(gameTitle, 0.2);
LinearLayout* centralLayout = new LinearLayout(Qt::Horizontal);
leftLayout->addLayout(centralLayout, 0.8);
Actor* robot = new Actor("ge_robot", this);
robot->setPaddings(0.2);
centralLayout->addItem(robot, 0.5);
robot->alignCenter();
centralLayout->addStretch(0.5);
LinearLayout* rightLayout = new LinearLayout(Qt::Vertical);
setupButtons(rightLayout);
LinearLayout* globalLayout = new LinearLayout(Qt::Horizontal);
globalLayout->addLayout(leftLayout, 0.7);
globalLayout->addLayout(rightLayout, 0.3);
setLayout(globalLayout);
// This is the last scene loaded
QSettings settings;
settings.setValue( sk("Application/LastScene"), sceneName );
}
示例7: TEST
TEST(OptimizationBfgsUpdate, bfgs_update_secant) {
typedef stan::optimization::BFGSUpdate_HInv<> QNUpdateT;
typedef QNUpdateT::VectorT VectorT;
const unsigned int nDim = 10;
QNUpdateT bfgsUp;
VectorT yk(nDim), sk(nDim), sdir(nDim);
// Construct a set of BFGS update vectors and check that
// the secant equation H*yk = sk is always satisfied.
for (unsigned int i = 0; i < nDim; i++) {
sk.setZero(nDim);
yk.setZero(nDim);
sk[i] = 1;
yk[i] = 1;
bfgsUp.update(yk,sk,i==0);
// Because the constructed update vectors are all orthogonal the secant
// equation should be exactlty satisfied for all nDim updates.
for (unsigned int j = 0; j <= i; j++) {
sk.setZero(nDim);
yk.setZero(nDim);
sk[i - j] = 1;
yk[i - j] = 1;
bfgsUp.search_direction(sdir,yk);
EXPECT_NEAR((sdir + sk).norm(),0.0,1e-10);
}
}
}
示例8: sk
void SUR_GA::SetValue(const char *key, float value)
{
string sk(key);
if (StringMatch(sk, "ThreadNum"))
{
omp_set_num_threads((int) value);
}
else if (StringMatch(sk, "TimeStep"))
{
m_TimeStep = value * 60; //hour -> mimute
}
else if (StringMatch(sk, "T_snow"))
{
m_Tsnow = value;
}
else if (StringMatch(sk, "t_soil"))
{
m_Tsoil = value;
}
else if (StringMatch(sk, "T0"))
{
m_T0 = value;
}
else if (StringMatch(sk, "s_frozen"))
{
this->m_Sfrozen = value;
}
else
throw ModelException("SUR_GA", "SetValue", "Parameter " + sk
+
" does not exist in SUR_GA method. Please contact the module developer.");
}
示例9: sk
int wxListBox::DoAppend(const wxString& item)
{
wxSizeKeeper sk( this );
Widget listBox = (Widget) m_mainWidget;
bool managed = XtIsManaged(listBox);
if (managed)
XtUnmanageChild (listBox);
int n;
XtVaGetValues (listBox, XmNitemCount, &n, NULL);
wxXmString text( item );
// XmListAddItem(listBox, text, n + 1);
XmListAddItemUnselected (listBox, text(), 0);
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
SetSelectionPolicy();
if (managed)
XtManageChild (listBox);
sk.Restore();
m_noItems ++;
return GetCount() - 1;
}
示例10: update
// update performs the heart of an iteration:
// It walks the border path from the active point to the end point
// and adds the required Transitions brought by the insertion of
// the string's i-th character.
//
// It returns the end point.
ReferencePoint update(Node *s, MappedSubstring ki) {
Node *oldr = &tree.root;
Node *r = nullptr;
bool is_endpoint = false;
MappedSubstring ki1 = ki;
auto ref_str_it = haystack.find(ki.ref_str);
S w = ref_str_it->second;
ReferencePoint sk(s, std::pair<int,int>(ki.ref_str, ki.l));
ki1.r = ki.r-1;
is_endpoint = test_and_split(s, ki1, w[ki.r], w, &r);
while (!is_endpoint) {
Leaf *r_prime = new Leaf();
r->g.insert(std::pair<C,Transition>(
w[ki.r], Transition(MappedSubstring(
ki.ref_str, ki.r, std::numeric_limits<int>::max()), r_prime)));
if (&tree.root != oldr) {
oldr->suffix_link = r;
}
oldr = r;
sk = canonize(sk.first->suffix_link, ki1);
ki1.l = ki.l = sk.second.second;
is_endpoint = test_and_split(sk.first, ki1, w[ki.r], w, &r);
}
if (&tree.root != oldr) {
oldr->suffix_link = sk.first;
}
return sk;
}
示例11: QByteArray
void PlayerManager::saveLastPlayer()
{
QSettings settings;
const QByteArray& playerId = currentPlayer ? currentPlayer->getId() : QByteArray();
settings.setValue(sk("Players/LastPlayer"), QVariant(playerId));
if ( currentPlayer) currentPlayer->save();
}
示例12: keyguard
int Ardb::ZClear(const DBID& db, const Slice& key)
{
KeyLockerGuard keyguard(m_key_locker, db, key);
ZSetMetaValue meta;
if (0 != GetZSetMetaValue(db, key, meta))
{
return 0;
}
Slice empty;
ZSetKeyObject sk(key, empty, meta.min_score, db);
BatchWriteGuard guard(GetEngine());
struct ZClearWalk: public WalkHandler
{
Ardb* z_db;
int OnKeyValue(KeyObject* k, ValueObject* value, uint32 cursor)
{
ZSetKeyObject* sek = (ZSetKeyObject*) k;
ZSetScoreKeyObject tmp(sek->key, sek->value, sek->db);
z_db->DelValue(*sek);
z_db->DelValue(tmp);
return 0;
}
ZClearWalk(Ardb* db) :
z_db(db)
{
}
} walk(this);
Walk(sk, false, &walk);
KeyObject k(key, ZSET_META, db);
DelValue(k);
return 0;
}
示例13: sk
void DepressionFSDaily::SetValue(const char* key, const float value) {
string sk(key);
if (StringMatch(sk, VAR_DEPREIN)) m_depCo = value;
else {
throw ModelException(MID_DEP_LINSLEY, "SetValue", "Parameter " + sk + " does not exist.");
}
}
示例14: sk
void wxStaticBox::SetLabel( const wxString& label )
{
wxXmSizeKeeper sk( (Widget)GetMainWidget() );
wxStaticBoxBase::SetLabel( label );
sk.Restore();
}
示例15: sk
void DepressionFSDaily::SetValue(const char *key, float data)
{
string sk(key);
if (StringMatch(sk, VAR_DEPREIN)) m_depCo = data;
else if (StringMatch(sk, VAR_OMP_THREADNUM))omp_set_num_threads((int) data);
else
throw ModelException(MID_DEP_LINSLEY, "SetValue", "Parameter " + sk + " does not exist.");
}