本文整理汇总了C++中Variables类的典型用法代码示例。如果您正苦于以下问题:C++ Variables类的具体用法?C++ Variables怎么用?C++ Variables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Variables类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: operator
MatrixPtr GenerateClusteredData::operator()() {
auto matrix = std::make_shared<Matrix>();
matrix->reserve(nbrInds);
Variables variables;
for (size_t var = 0; var < nbrClusters * clustSize; ++var) {
variables ^= Variable( boost::lexical_cast<std::string>(var),
plIntegerType(0, cardinality-1) );
}
Clustering clustering; clustering.reserve(nbrClusters);
for ( size_t clust = 0; clust < nbrClusters; ++clust ) {
Cluster cluster;
for ( size_t item = 0; item < clustSize; ++item ) {
cluster.push_back( clust*clustSize + item );
}
clustering.push_back( cluster );
}
plJointDistribution jointDist = createClusteringJointDist( variables, clustering);
plValues values( variables );
// std::cout << jointDist << std::endl << jointDist.get_computable_object_list() << std::endl;
for (size_t ind = 0; ind < nbrInds; ++ind) {
jointDist.draw(values);
std::vector<int> row(variables.size());
for (size_t var = 0; var < variables.size(); ++var) {
row[var] = values[variables[var]];
}
matrix->push_back(row);
}
//std::cout << jointDist << std::endl;
return Transpose(*matrix);
}
开发者ID:siolag161,项目名称:samogwas,代码行数:34,代码来源:data_generation.hpp
示例2: getVariables
Variables Stack::getVariables() const {
Variables vars;
for (int i = 1; i <= getSize(); ++i) {
vars.push_back(getVariableAt(i));
}
return vars;
}
开发者ID:ImperatorPrime,项目名称:xoreos,代码行数:7,代码来源:stack.cpp
示例3: context_guard
void
madara::knowledge::containers::NativeDoubleVector::set_name (
const std::string & var_name,
Variables & knowledge, int size)
{
if (context_ != knowledge.get_context () || name_ != var_name)
{
context_ = knowledge.get_context ();
ContextGuard context_guard (*context_);
MADARA_GUARD_TYPE guard (mutex_);
madara_logger_ptr_log (logger::global_logger.get (),
logger::LOG_MAJOR,
"NativeDoubleVector::set_name: setting name to %s\n",
var_name.c_str ());
name_ = var_name;
vector_ = knowledge.get_ref (var_name, settings_);
if (size > 0)
resize (size_t (size));
}
}
开发者ID:,项目名称:,代码行数:25,代码来源:
示例4: Java_ai_madara_knowledge_Variables_jni_1compile
/*
* Class: ai_madara_knowledge_Variables
* Method: jni_compile
* Signature: (JLjava/lang/String;)J
*/
jlong JNICALL Java_ai_madara_knowledge_Variables_jni_1compile(
JNIEnv* env, jobject, jlong cptr, jstring expression)
{
const char* nativeExpression = env->GetStringUTFChars(expression, 0);
Variables* vars = (Variables*)cptr;
CompiledExpression* result(0);
if (vars)
{
result = new CompiledExpression(vars->compile(nativeExpression));
env->ReleaseStringUTFChars(expression, nativeExpression);
}
else
{
// user has tried to use a deleted object. Clean up and throw
madara::utility::java::throw_dead_obj_exception(env,
"Variables::compile: "
"Variables objects are released already");
}
return (jlong)result;
}
开发者ID:jredmondson,项目名称:madara,代码行数:30,代码来源:ai_madara_knowledge_Variables.cpp
示例5: call
Variables FunctionRef::call(const Variable &v1, const Variable &v2, const Variable &v3) const {
Variables params;
params.push_back(v1);
params.push_back(v2);
params.push_back(v3);
return call(params);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:7,代码来源:function.cpp
示例6: test_count_targets_number
void VariablesTest::test_count_targets_number(void)
{
message += "test_count_targets_number\n";
Variables v;
assert_true(v.count_targets_number() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:8,代码来源:variables_test.cpp
示例7: test_get_variables_number
void VariablesTest::test_get_variables_number(void)
{
message += "test_get_variables_number\n";
Variables v;
assert_true(v.get_variables_number() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:8,代码来源:variables_test.cpp
示例8: getSize
Aurora::Lua::Variables Aurora::Lua::Stack::getVariablesFromTop(int count) const {
Variables vars;
const int start = std::max(0, getSize() - count) + 1;
for (int i = start; i <= getSize(); ++i) {
vars.push_back(getVariableAt(i));
}
return vars;
}
开发者ID:ImperatorPrime,项目名称:xoreos,代码行数:8,代码来源:stack.cpp
示例9: sendStackInfo
int InterpreterDBG::nextCmd(int line, Variables& v, list<pair<string, int> >& stk) {
sendStackInfo(stk);
sendVariables(v.getGlobals(), stk, true);
sendVariables(v.getLocals(), stk, false);
return receiveCmd();
}
开发者ID:BackupTheBerlios,项目名称:gpt-svn,代码行数:9,代码来源:InterpreterDBG.cpp
示例10: checkFunctionVariableUsage_iterateScopes
void CheckUnusedVar::checkFunctionVariableUsage()
{
if (!_settings->isEnabled("style"))
return;
// Parse all executing scopes..
const SymbolDatabase *symbolDatabase = _tokenizer->getSymbolDatabase();
for (std::list<Scope>::const_iterator scope = symbolDatabase->scopeList.begin(); scope != symbolDatabase->scopeList.end(); ++scope) {
// only check functions
if (scope->type != Scope::eFunction)
continue;
// varId, usage {read, write, modified}
Variables variables;
checkFunctionVariableUsage_iterateScopes(&*scope, variables);
// Check usage of all variables in the current scope..
for (Variables::VariableMap::const_iterator it = variables.varUsage().begin(); it != variables.varUsage().end(); ++it) {
const Variables::VariableUsage &usage = it->second;
const std::string &varname = usage._name->str();
// variable has been marked as unused so ignore it
if (usage._name->isUnused())
continue;
// skip things that are only partially implemented to prevent false positives
if (usage._type == Variables::pointerPointer ||
usage._type == Variables::pointerArray ||
usage._type == Variables::referenceArray)
continue;
// variable has had memory allocated for it, but hasn't done
// anything with that memory other than, perhaps, freeing it
if (usage.unused() && !usage._modified && usage._allocateMemory)
allocatedButUnusedVariableError(usage._name, varname);
// variable has not been written, read, or modified
else if (usage.unused() && !usage._modified)
unusedVariableError(usage._name, varname);
// variable has not been written but has been modified
else if (usage._modified && !usage._write && !usage._allocateMemory)
unassignedVariableError(usage._name, varname);
// variable has been written but not read
else if (!usage._read && !usage._modified)
unreadVariableError(usage._name, varname);
// variable has been read but not written
else if (!usage._write && !usage._allocateMemory)
unassignedVariableError(usage._name, varname);
}
}
}
开发者ID:Drahakar,项目名称:cppcheck,代码行数:57,代码来源:checkunusedvar.cpp
示例11: test_arrange_targets_indices
void VariablesTest::test_arrange_targets_indices(void)
{
message += "test_arrange_targets_indices\n";
Variables v;
Vector<size_t> targets_indices = v.arrange_targets_indices();
assert_true(targets_indices.size() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:10,代码来源:variables_test.cpp
示例12: test_arrange_names
void VariablesTest::test_arrange_names(void)
{
message += "test_get_names\n";
Variables v;
Vector<std::string> names = v.arrange_names();
assert_true(names.size() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:10,代码来源:variables_test.cpp
示例13: build_get_variable
const char* build_get_variable(const char* name)
{
Variables::iterator i = g_build_variables.find(name);
if(i != g_build_variables.end())
{
return (*i).second.c_str();
}
globalErrorStream() << "undefined build variable: " << makeQuoted(name) << "\n";
return "";
}
开发者ID:raynorpat,项目名称:cake,代码行数:10,代码来源:build.cpp
示例14: test_arrange_units
void VariablesTest::test_arrange_units(void)
{
message += "test_arrange_units\n";
Variables v;
Vector<std::string> units = v.arrange_units();
assert_true(units.size() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:11,代码来源:variables_test.cpp
示例15: test_arrange_descriptions
void VariablesTest::test_arrange_descriptions(void)
{
message += "test_arrange_descriptions\n";
Variables v;
Vector<std::string> descriptions = v.arrange_descriptions();
assert_true(descriptions.size() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:11,代码来源:variables_test.cpp
示例16: filterFields
static void filterFields (const StringSet &avoid, Variables &fields) {
for (int i = 0; i < fields.length (); i++) {
const VariableDef &cur = fields.at (i);
if (avoid.contains (cur.type)) {
fields.remove (i);
i--;
}
}
}
开发者ID:NuriaProject,项目名称:Tria,代码行数:12,代码来源:definitions.cpp
示例17: resizeAxis
/**
* Applies the required resizes to nodes in the specified axis, rerouting edges
* around the resized nodes.
* @param dim axis
* @param targets the target rectangles (in both axes)
* @param nodes to be moved and/or resized
* @param edges to be rerouted around nodes
* @param resizes ResizeInfo for specific nodes
* @param vs canonical list of variables passed into solver. Note that
* the first nodes.size() variables are used for each corresponding node.
* Note also that new variables for the dummy nodes will be appended to this
* list and will need to be cleaned up later.
* @param cs canonical list of constraints over variables. Note that new
* non-overlap constraints may be appended to the end of this list.
*/
static void resizeAxis(vpsc::Dim dim, const Rectangles& targets,
Nodes& nodes, Edges& edges, RootCluster *clusters, ResizeMap& resizes,
Variables& vs, Constraints& cs)
{
COLA_ASSERT(vs.size()>=nodes.size());
// - create copy tn of topologyNodes with resize rects replaced with
// three nodes: one for the lhs of rect, one for centre and one for rhs.
// lhs node goes at position of replaced node, the others are appended
// to end of tn.
// - set desired positions of each lhs node to be the left side
// of resized rect and symmetric for rhs node, centre node's desired
// pos it at the centre
Nodes tn(nodes.size());
COLA_ASSERT(assertConvexBends(edges));
COLA_ASSERT(assertNoSegmentRectIntersection(nodes,edges));
transform(nodes.begin(),nodes.end(),tn.begin(),
TransformNode(dim, targets,resizes,vs));
feach(resizes, CreateLeftRightDummyNodes(dim,targets,tn,vs));
COLA_ASSERT(tn.size()==nodes.size()+2*resizes.size());
COLA_ASSERT(vs.size()>=tn.size());
// update topologyRoutes with references to resized nodes replaced with
// correct references to lhs/rhs nodes
feach(edges,SubstituteNodes(dim,resizes,tn));
COLA_ASSERT(assertConvexBends(edges));
COLA_ASSERT(assertNoSegmentRectIntersection(tn,edges));
// move nodes and reroute
topology::TopologyConstraints t(dim, tn, edges, clusters, vs, cs);
COLA_ASSERT(checkDesired(dim,tn,targets,resizes));
#ifndef NDEBUG
unsigned loopCtr=0;
#endif
while(t.solve()) { COLA_ASSERT(++loopCtr<1000); }
//COLA_ASSERT(checkFinal(tn,targets,resizes));
// reposition and resize original nodes
feach(nodes,CopyPositions(dim,tn,resizes));
// revert topologyRoutes back to original nodes
feach(edges,RevertNodes(nodes));
COLA_ASSERT(assertConvexBends(edges));
COLA_ASSERT(assertNoSegmentRectIntersection(nodes,edges));
// clean up
feach(tn,DeleteTempNode());
}
开发者ID:SiteView,项目名称:NNMQT,代码行数:67,代码来源:resize.cpp
示例18: test_set
void VariablesTest::test_set(void)
{
message += "test_set\n";
Variables v;
// Instances and inputs and target variables
v.set(1);
assert_true(v.count_inputs_number() == 0, LOG);
assert_true(v.count_targets_number() == 0, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:13,代码来源:variables_test.cpp
示例19: test_from_XML
void VariablesTest::test_from_XML(void)
{
message += "test_from_XML\n";
Variables v;
// Test
v.set(3);
tinyxml2::XMLDocument* document = v.to_XML();
v.from_XML(*document);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:14,代码来源:variables_test.cpp
示例20: test_get_display
void VariablesTest::test_get_display(void)
{
message += "test_get_display\n";
Variables v;
v.set_display(true);
assert_true(v.get_display() == true, LOG);
v.set_display(false);
assert_true(v.get_display() == false, LOG);
}
开发者ID:pappakrishnan,项目名称:OpenNN,代码行数:14,代码来源:variables_test.cpp
注:本文中的Variables类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论