本文整理汇总了C++中L函数的典型用法代码示例。如果您正苦于以下问题:C++ L函数的具体用法?C++ L怎么用?C++ L使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ConnectBDPT
Spectrum ConnectBDPT(const Scene &scene, Vertex *lightVertices,
Vertex *cameraVertices, int s, int t,
const Distribution1D &lightDistr, const Camera &camera,
Sampler &sampler, Point2f *pRaster, Float *misWeightPtr) {
Spectrum L(0.f);
// Ignore invalid connections related to infinite area lights
if (t > 1 && s != 0 && cameraVertices[t - 1].type == VertexType::Light)
return Spectrum(0.f);
// Perform connection and write contribution to _L_
Vertex sampled;
if (s == 0) {
// Interpret the camera subpath as a complete path
const Vertex &pt = cameraVertices[t - 1];
if (pt.IsLight()) L = pt.Le(scene, cameraVertices[t - 2]) * pt.beta;
Assert(!L.HasNaNs());
} else if (t == 1) {
// Sample a point on the camera and connect it to the light subpath
const Vertex &qs = lightVertices[s - 1];
if (qs.IsConnectible()) {
VisibilityTester vis;
Vector3f wi;
Float pdf;
Spectrum Wi = camera.Sample_Wi(qs.GetInteraction(), sampler.Get2D(),
&wi, &pdf, pRaster, &vis);
if (pdf > 0 && !Wi.IsBlack()) {
// Initialize dynamically sampled vertex and _L_ for $t=1$ case
sampled = Vertex::CreateCamera(&camera, vis.P1(), Wi / pdf);
L = qs.beta * qs.f(sampled) * sampled.beta;
if (qs.IsOnSurface()) L *= AbsDot(wi, qs.ns());
Assert(!L.HasNaNs());
// Only check visibility after we know that the path would
// make a non-zero contribution.
if (!L.IsBlack()) L *= vis.Tr(scene, sampler);
}
}
} else if (s == 1) {
// Sample a point on a light and connect it to the camera subpath
const Vertex &pt = cameraVertices[t - 1];
if (pt.IsConnectible()) {
Float lightPdf;
VisibilityTester vis;
Vector3f wi;
Float pdf;
int lightNum =
lightDistr.SampleDiscrete(sampler.Get1D(), &lightPdf);
const std::shared_ptr<Light> &light = scene.lights[lightNum];
Spectrum lightWeight = light->Sample_Li(
pt.GetInteraction(), sampler.Get2D(), &wi, &pdf, &vis);
if (pdf > 0 && !lightWeight.IsBlack()) {
EndpointInteraction ei(vis.P1(), light.get());
sampled =
Vertex::CreateLight(ei, lightWeight / (pdf * lightPdf), 0);
sampled.pdfFwd = sampled.PdfLightOrigin(scene, pt, lightDistr);
L = pt.beta * pt.f(sampled) * sampled.beta;
if (pt.IsOnSurface()) L *= AbsDot(wi, pt.ns());
// Only check visibility if the path would carry radiance.
if (!L.IsBlack()) L *= vis.Tr(scene, sampler);
}
}
} else {
// Handle all other bidirectional connection cases
const Vertex &qs = lightVertices[s - 1], &pt = cameraVertices[t - 1];
if (qs.IsConnectible() && pt.IsConnectible()) {
L = qs.beta * qs.f(pt) * pt.f(qs) * pt.beta;
if (!L.IsBlack()) L *= G(scene, sampler, qs, pt);
}
}
++totalPaths;
if (L.IsBlack()) ++zeroRadiancePaths;
ReportValue(pathLength, s + t - 2);
// Compute MIS weight for connection strategy
Float misWeight =
L.IsBlack() ? 0.f : MISWeight(scene, lightVertices, cameraVertices,
sampled, s, t, lightDistr);
Assert(!std::isnan(misWeight));
L *= misWeight;
if (misWeightPtr) *misWeightPtr = misWeight;
return L;
}
开发者ID:zhongleiyang,项目名称:pbrt-v3,代码行数:82,代码来源:bdpt.cpp
示例2: main
int main(int argc, char** argv)
{
Shape inShape = NULL;
Shape outShape= NULL;
int i,c;
int doVTable=0;
int *oTable, *mTable;
float *vTable;
int counter;
float tester;
if(argc != 3)
{
fprintf(stderr,"Usage:\n\t%s inFile outFile.\n",argv[0]);
return 1;
}
inShape = readShapeFromFile(argv[1]);
if(inShape == NULL)
return 1;
/* printf("Let's see what's in the inShape!\n");*/
#ifdef DEBUG
printf("There are %d vertices.\n",inShape->numVertices);
#endif
/*printf("The vTable contains:\n");*/
for(c=0;c<inShape->numVertices*3;c+=3)
{
/* printf("%d => %f %f %f\n",c,inShape->vTable[c],
inShape->vTable[c+1],
inShape->vTable[c+2]);*/
}
//printf("The tTable contains %d triangles\n\n",numTriangles(inShape));
// for(c=0;c<numTriangles(inShape)*3;c+=3)
// {
// printf("%d => %d %d %d\n", c,inShape->tTable[c],
// inShape->tTable[c+1],
// inShape->tTable[c+2]);
// }
oTable = malloc(sizeof(int)*numTriangles(inShape)*3);
/*oTable = malloc(sizeof(int)*99999);*/
/* for(c=0;c<inShape->numVertices*3;c++)*/
for(c=0;c<numTriangles(inShape)*3;c++)
{
oTable[c] = -1;
}
/* for(c=0;c<numTriangles(inShape)*3;c++)
for(i=c+1;i<inShape->numVertices*3;i++)*/
// printf("There are %d iterations of c and i\n",numTriangles(inShape)*3);
for(c=0;c<numTriangles(inShape)*3;c++)
for(i=c+1;i<numTriangles(inShape)*3;i++)
{
// if(c<10)
// printf("Trying to match %d and %d..V(N(c))=%d, V(P(i))=%d, V(P(c)=%d,v(N(i))=%d\n",c,i,V(inShape,N(c)),V(inShape,P(i)),V(inShape,P(c)),V(inShape,N(i)));
if((V(inShape,N(c)) == V(inShape,P(i)))
&&(V(inShape,P(c)) == V(inShape,N(i))))
{
// printf("Match found!\n");
oTable[c] = i;
oTable[i] = c;
}
}
printf("This is the oTable:\n");
for(c=0;c<numTriangles(inShape)*3;c++)
{
printf("%d => %d\n",c,oTable[c]);
}
for(c=0;c<numTriangles(inShape)*3;c++)
if(oTable[c] == -1)
{
printf("MISALIGNMENT in corner %d!!!\n",c);
printf("Cannot find a corner (opposite than at %d) with N(c)=%d and P(c)=%d\n",
V(inShape,c),V(inShape,P(c)),V(inShape,N(c)));
return 1;
}
/*mTable = malloc(sizeof(int)*inShape->numVertices*3);*/
mTable = malloc(sizeof(int)*numTriangles(inShape)*3);
/* for(c=0;c<inShape->numVertices*3;c++)*/
for(c=0;c<numTriangles(inShape)*3;c++)
mTable[c] = -1;
/*outShape = createShape(4*inShape->numVertices-6);*/
outShape = createShape(4*inShape->numVertices,4*numTriangles(inShape));
printf("outShape has %d vertices\n",outShape->numVertices);
printf("outShape has %d Triangles\n",numTriangles(outShape));
if(outShape == NULL)
return 5;
//.........这里部分代码省略.........
开发者ID:seebq,项目名称:cs4451-project2-team-greenlee,代码行数:101,代码来源:curver.c
示例3: labelip6
void
labelip6(void)
{
wmove(wnd, 0, 0); wclrtoeol(wnd);
#define L(row, str) mvwprintw(wnd, row, 10, str)
#define R(row, str) mvwprintw(wnd, row, 45, str);
L(1, "IPv6 Input"); R(1, "IPv6 Output");
L(2, "total packets received"); R(2, "total packets sent");
L(3, "- too short for header"); R(3, "- generated locally");
L(4, "- too short for data"); R(4, "- output drops");
L(5, "- with invalid version"); R(5, "output fragments generated");
L(6, "total fragments received"); R(6, "- fragmentation failed");
L(7, "- fragments dropped"); R(7, "destinations unreachable");
L(8, "- fragments timed out"); R(8, "packets output via raw IP");
L(9, "- fragments overflown");
L(10, "- packets reassembled ok"); R(10, "Input next-header histogram");
L(11, "packets forwarded"); R(11, " - destination options");
L(12, "- unreachable dests"); R(12, " - hop-by-hop options");
L(13, "- redirects generated"); R(13, " - IPv4");
L(14, "option errors"); R(14, " - TCP");
L(15, "unwanted multicasts"); R(15, " - UDP");
L(16, "delivered to upper layer"); R(16, " - IPv6");
L(17, "bad scope packets"); R(17, " - routing header");
L(18, "address selection failed"); R(18, " - fragmentation header");
R(19, " - ICMP6");
R(20, " - none");
#undef L
#undef R
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:29,代码来源:ip6.c
示例4: query
int query(int x, int y, int id = 1, int l = 0, int r = sz) {
if(y <= l || r <= x) return INF;
if(x <= l && r <= y) return st[id];
int mid = (l + r) >> 1;
return min(query(x, y, L(id), l, mid), query(x, y, R(id), mid, r));
}
开发者ID:Jhuni0123,项目名称:PSTeamNote,代码行数:6,代码来源:HLD.cpp
示例5: L
void DBConnectionPool::release(const string& host, DBClientBase *c) {
scoped_lock L(_mutex);
_pools[PoolKey(host,c->getSoTimeout())].done(this,c);
}
开发者ID:zhanglei4214,项目名称:mongo,代码行数:4,代码来源:connpool.cpp
示例6: InitEAX
void InitEAX(void){
ALCdevice *pDevice = NULL;
ALCcontext *pContext = NULL;
pContext = qalcGetCurrentContext();
pDevice = qalcGetContextsDevice(pContext);
if (qalcIsExtensionPresent(pDevice, (ALCchar*)ALC_EXT_EFX_NAME)){
L(alGenEffects);
L(alDeleteEffects);
L(alIsEffect);
L(alEffecti);
L(alEffectiv);
L(alEffectf);
L(alEffectfv);
L(alGetEffecti);
L(alGetEffectiv);
L(alGetEffectf);
L(alGetEffectfv);
L(alGenFilters);
L(alDeleteFilters);
L(alIsFilter);
L(alFilteri);
L(alFilteriv);
L(alFilterf);
L(alFilterfv);
L(alGetFilteri);
L(alGetFilteriv);
L(alGetFilterf);
L(alGetFilterfv);
L(alGenAuxiliaryEffectSlots);
L(alDeleteAuxiliaryEffectSlots);
L(alIsAuxiliaryEffectSlot);
L(alAuxiliaryEffectSloti);
L(alAuxiliaryEffectSlotiv);
L(alAuxiliaryEffectSlotf);
L(alAuxiliaryEffectSlotfv);
L(alGetAuxiliaryEffectSloti);
L(alGetAuxiliaryEffectSlotiv);
L(alGetAuxiliaryEffectSlotf);
L(alGetAuxiliaryEffectSlotfv);
}else{
SPRaise("Extension not found: '%s'",
ALC_EXT_EFX_NAME);
}
}
开发者ID:VelocityRa,项目名称:openspades,代码行数:47,代码来源:ALFuncs.cpp
示例7: testprob
void testprob()
{
int count, graph, i, iter, j, min_n_stations, n_stations, *stations, sum, t_sum, upper_bound;
int n_explored, n_generated, n_states;
double best_first_cpu, bfs_bbr_cpu, best_hoffman_cpu, hoffman_cpu, total_cpu;
clock_t start_time;
sum = 0;
printf("%s\n",prob_file);
read_problem(prob_file);
close_pred();
if (run_forward == -1)
{
std::vector<int> E(n_tasks + 1);
std::vector<int> L(n_tasks + 1);
// Determine whether to run in forward or reverse
for (int j = 1; j <= n_tasks; ++j)
{
double ftime = t[j];
double rtime = t[j];
for (int i = 1; i <= n_tasks; ++i)
{
if (closed_predecessor_matrix[i][j]) ftime += t[i]; // If task i precedes task j
if (closed_predecessor_matrix[j][i]) rtime += t[i]; // If task j precedes task i
}
E[j] = ceil(ftime/cycle);
L[j] = ceil(rtime/cycle);
}
unsigned int f = 1; //changed by AS 2013/06/10
unsigned int r = 1; //changed by AS 2013/06/10
for (int m = 1; m <= 5; ++m)
{
unsigned int fcount = 0; //changed by AS 2013/06/08
unsigned int rcount = 0; //changed by AS 2013/06/08
for (int j = 1; j <= n_tasks; ++j)
{
if (E[j] <= m) ++fcount;
if (L[j] <= m) ++rcount;
}
f *= fcount;
r *= rcount;
}
if (r < f)
{
printf("running in reverse %d %d\n", f, r);
reverse_pred();
for (int j = 1; j <= n_tasks; ++j)
free(closed_predecessor_matrix[j]);
free(closed_predecessor_matrix);
close_pred();
}
else printf("running forward %d %d\n", f, r);
}
else if (run_forward == 0)
{
printf("running in reverse\n");
reverse_pred();
for (int j = 1; j <= n_tasks; ++j)
free(closed_predecessor_matrix[j]);
free(closed_predecessor_matrix);
close_pred();
}
find_successors();
//prn_successors();
compute_potentially_dominates();
//prn_pred(potentially_dominates);
compute_positional_weights();
//prn_vec(n_predecessors, n_tasks); prn_vec(n_successors, n_tasks); prn_vec(positional_weight, n_tasks);
compute_descending_order();
MALLOC(root_degrees, n_tasks+1, char);
t_sum = 0;
for(i = 1; i <= n_tasks; i++) {
t_sum += t[i];
count = 0;
for(j = 1; j <= n_tasks; j++) {
if(predecessor_matrix[j][i] == 1) count++;
}
root_degrees[i] = count;
}
MALLOC(stations, n_tasks+1, int);
MALLOC(states, STATE_SPACE+1, state);
search_info.start_time = clock();
//cycle = 1000;
// Use Hoffman type heuristic to find a reasonably good upper bound.
start_time = clock();
best_hoffman_cpu = 0.0;
initialize_hoffman();
//.........这里部分代码省略.........
开发者ID:UIUC-optimization,项目名称:salbp,代码行数:101,代码来源:bbr.c
示例8: compile
//.........这里部分代码省略.........
sh_to_reg(op.rs1, mov, call_regs[0]);
sh_to_reg(op.rs3, add, call_regs[0]);
if (size != 8)
sh_to_reg(op.rs2, mov, call_regs[1]);
else
sh_to_reg(op.rs2, mov, call_regs64[1]);
if (size == 1)
call((void*)WriteMem8);
else if (size == 2)
call((void*)WriteMem16);
else if (size == 4)
call((void*)WriteMem32);
else if (size == 8)
call((void*)WriteMem64);
else {
die("1..8 bytes");
}
}
break;
default:
shil_chf[op.op](&op);
break;
}
}
mov(rax, (size_t)&next_pc);
switch (block->BlockType) {
case BET_StaticJump:
case BET_StaticCall:
//next_pc = block->BranchBlock;
mov(dword[rax], block->BranchBlock);
break;
case BET_Cond_0:
case BET_Cond_1:
{
//next_pc = next_pc_value;
//if (*jdyn == 0)
//next_pc = branch_pc_value;
mov(dword[rax], block->NextBlock);
if (block->has_jcond)
mov(rdx, (size_t)&Sh4cntx.jdyn);
else
mov(rdx, (size_t)&sr.T);
cmp(dword[rdx], block->BlockType & 1);
Xbyak::Label branch_not_taken;
jne(branch_not_taken, T_SHORT);
mov(dword[rax], block->BranchBlock);
L(branch_not_taken);
}
break;
case BET_DynamicJump:
case BET_DynamicCall:
case BET_DynamicRet:
//next_pc = *jdyn;
mov(rdx, (size_t)&Sh4cntx.jdyn);
mov(edx, dword[rdx]);
mov(dword[rax], edx);
break;
case BET_DynamicIntr:
case BET_StaticIntr:
if (block->BlockType == BET_DynamicIntr) {
//next_pc = *jdyn;
mov(rdx, (size_t)&Sh4cntx.jdyn);
mov(edx, dword[rdx]);
mov(dword[rax], edx);
}
else {
//next_pc = next_pc_value;
mov(dword[rax], block->NextBlock);
}
call((void*)UpdateINTC);
break;
default:
die("Invalid block end type");
}
add(rsp, 0x28);
ret();
ready();
block->code = (DynarecCodeEntryPtr)getCode();
emit_Skip(getSize());
}
开发者ID:rasterico,项目名称:reicast-emulator,代码行数:101,代码来源:rec_x64.cpp
示例9: CreateSpectrum
Spectrum *CreateFilter(int width, int height, FilterType option, int orientation, double numAngles)
{
Spectrum *result = CreateSpectrum(width, height);
double wi = -M_PI;
double dwi = (2.0*M_PI)/height;
double dwj = (2.0*M_PI)/width;
double thetak = orientation*M_PI/numAngles;
double thetak0 = (orientation-1)*M_PI/numAngles;
double theta = 0;
int i,j;
for (i=0; i<height; i++)
{
double wj = -M_PI;
for (j=0; j<width; j++)
{
double r = sqrt(wi*wi+wj*wj);
double value = 0.0;
if (option == BandPass)
{
if(thetak > 0 && thetak <= M_PI/2)
theta = atan2(wj,wi);
else if(thetak > M_PI/2 && thetak <= M_PI)
theta = atan2(wj,wi)+M_PI;
if(theta < 0 ) theta += M_PI;
if((theta >= thetak0 && theta <= thetak))
{
value = H(r)*L(r);
}
else if((theta >= thetak0 + M_PI && theta <= thetak + M_PI))
{
value = H(r)*L(r);
}
}
else if (option == LowPass)
{
value = L(r);
}
result->real[result->tbrow[i] + j] = value;
result->imag[result->tbrow[i] + j] = 0.0;
wj += dwj;
}
wi += dwi;
}
return result;
}
开发者ID:rafaelalmeida,项目名称:poc,代码行数:62,代码来源:steerablepyramid.c
示例10: L
void CUnitTable::ReadModConfig() {
L(ai, "[CUnitTable::ReadModConfig()]");
std::string cfgFileName = GetModCfgName();
std::fstream cfgFile;
std::stringstream msg;
int cfgVersion = 0;
if (ai->cb->GetFileSize(cfgFileName.c_str()) != -1) {
if (!ai->luaParser->Execute(cfgFileName, "config")) {
msg << "\tparse-error in existing mod configuration file \"";
msg << cfgFileName << "\": " << ai->luaParser->GetError();
L(ai, msg.str());
return;
} else {
msg << "\tparsed existing mod configuration file \"";
msg << cfgFileName << "\"";
L(ai, msg.str());
}
const LuaTable* rootTbl = ai->luaParser->GetRootTbl();
const LuaTable* unitTbl = NULL;
const UnitDef* unitDef = NULL;
if (rootTbl->GetIntVal("version", cfgVersion) > CFGVERSION) {
msg.str("");
msg << "\tconfig-file version (" << cfgVersion << ") is newer than current version (" << CFGVERSION << ")";
return;
}
UnitType* unitType = NULL;
UnitCategory defUnitCat = CAT_LAST;
UnitCategory cfgUnitCat = CAT_LAST;
std::list<std::string> keys;
rootTbl->GetStrTblKeys(&keys);
for (std::list<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
unitDef = ai->cb->GetUnitDef((*it).c_str());
if (unitDef == NULL) {
msg.str("");
msg << "\t\t.cfg entry \"" << (*it) << "\" does not refer to a valid unit-type";
L(ai, msg.str());
continue;
}
unitTbl = rootTbl->GetTblVal(*it);
unitType = &unitTypes[unitDef->id];
unitType->costMultiplier = unitTbl->GetIntVal("costMult", 100) / 100.0f;
unitType->techLevel = unitTbl->GetIntVal("techLevel", -1);
defUnitCat = unitType->category;
cfgUnitCat = UnitCategory(unitTbl->GetIntVal("category", CAT_LAST));
{
msg.str("");
msg << "\t\tunitDef->id: " << unitDef->id << ", unitDef->name: " << unitDef->name;
msg << ", default cat.: " << defUnitCat << ", .cfg cat.: " << cfgUnitCat;
L(ai, msg.str());
}
/*
* TODO: look for any possible "side-effects" that might arise
* from overriding categories like this, then enable overrides
* other than builder --> attacker (ie. SEGV when an *unarmed*
* CAT_BUILDER unit masquerading as a CAT_G_ATTACK'er wants to
* or is attacked, due to NULL weapondefs)
*/
if (defUnitCat != cfgUnitCat) {
if (cfgUnitCat < 0 || cfgUnitCat >= CAT_LAST) {
// invalid unit-category number
continue;
}
if (cfgUnitCat == CAT_G_ATTACK && defUnitCat == CAT_BUILDER) {
{
msg.str("");
msg << "\t\t\t.cfg unit category (CAT_G_ATTACK) overrides unitType->category (CAT_BUILDER)";
L(ai, msg.str());
}
std::vector<int>::iterator vit;
std::vector<int>& oldDefs = categoryData.GetDefsForUnitCat(defUnitCat);
std::vector<int>& newDefs = categoryData.GetDefsForUnitCat(cfgUnitCat);
for (vit = oldDefs.begin(); vit != oldDefs.end(); vit++) {
const int unitDefID = *vit;
if (unitDefID == unitDef->id) {
oldDefs.erase(vit);
newDefs.push_back(unitDefID);
vit--;
}
//.........这里部分代码省略.........
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:101,代码来源:UnitTable.cpp
示例11: GetDbgLogName
void CUnitTable::DebugPrint() {
const char* listCategoryNames[12] = {
"GROUND-FACTORY", "GROUND-BUILDER", "GROUND-ATTACKER", "METAL-EXTRACTOR",
"METAL-MAKER", "METAL-STORAGE", "ENERGY-STORAGE", "GROUND-ENERGY", "GROUND-DEFENSE",
"NUKE-SILO", "SHIELD-GENERATOR", "LAST-CATEGORY"
};
std::stringstream msg;
std::string logFileName = GetDbgLogName();
FILE* f = fopen(logFileName.c_str(), "w");
if (f == NULL) {
msg << "[CUnitTable::DebugPrint()] could not open ";
msg << "debug log " << logFileName << " for writing";
L(ai, msg.str());
return;
}
for (int i = 1; i <= numDefs; i++) {
const UnitType* utype = &unitTypes[i];
const UnitDef* udef = unitDefs[i - 1];
msg << "UnitDef ID: " << i << "\n";
msg << "\tName: " << udef->name;
msg << " (\"" << udef->humanName << "\")\n";
msg << "\tCan Build:\n";
for (unsigned int j = 0; j != utype->canBuildList.size(); j++) {
const UnitType* buildOption = &unitTypes[utype->canBuildList[j]];
const char* buildOptName = buildOption->def->humanName.c_str();
msg << "\t\t\"" << buildOptName << "\"\n";
}
/*
msg << "\tBuilt By:\n";
for (unsigned int k = 0; k != utype->builtByList.size(); k++) {
UnitType* parent = &unitTypes[utype->builtByList[k]];
for (std::set<int>::iterator it = parent->sides.begin(); it != parent->sides.end(); it++) {
const char* sideName = sideNames[*it].c_str();
const char* parentName = parent->def->humanName.c_str();
msg << "\t\t(\"" << sideName << "\") \"" << parentName << "\"\n";
}
}
*/
msg << "\n\n";
}
for (int defCatIdx = int(CAT_GROUND_FACTORY); defCatIdx <= int(CAT_NUKE_SILO); defCatIdx++) {
msg << "units grouped under category \"";
msg << listCategoryNames[defCatIdx];
msg << "\":\n";
const UnitDefCategory c = UnitDefCategory(defCatIdx);
const std::vector<int>& defs = categoryData.GetDefsForUnitDefCat(c);
for (unsigned int i = 0; i != defs.size(); i++) {
const UnitDef* udef = unitTypes[defs[i]].def;
msg << "\t" << udef->name << " (\"";
msg << udef->humanName << "\")\n";
}
msg << "\n";
}
msg << "\n\n";
fprintf(f, "%s", msg.str().c_str());
fclose(f);
}
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:77,代码来源:UnitTable.cpp
示例12: L
void Peer::AddPeerNode(PeerNodePtr pNode)
{
boost::recursive_mutex::scoped_lock L(m_mutex);
m_peerNodeList.push_back(pNode);
}
开发者ID:rudhirg,项目名称:P2PMapReduce,代码行数:5,代码来源:Peer.cpp
示例13: dimension
/**
Purpose
-------
ZGESSM applies the factors L computed by ZGETRF_INCPIV to
a complex M-by-N tile A.
Arguments
---------
@param[in]
m INTEGER
The number of rows of the matrix A. M >= 0.
@param[in]
n INTEGER
The number of columns of the matrix A. N >= 0.
@param[in]
k INTEGER
The number of columns of the matrix L. K >= 0.
@param[in]
ib INTEGER
The inner-blocking size. IB >= 0.
@param[in]
ipiv INTEGER array on the cpu.
The pivot indices array of size K as returned by
ZGETRF_INCPIV.
@param[in]
dL1 DOUBLE COMPLEX array, dimension(LDDL1, N)
The IB-by-K matrix in which is stored L^(-1) as returned by GETRF_INCPIV
@param[in]
lddl1 INTEGER
The leading dimension of the array L1. LDDL1 >= max(1,2*IB).
@param[in]
dL DOUBLE COMPLEX array, dimension(LDDL, N)
The M-by-K lower triangular tile on the gpu.
@param[in]
lddl INTEGER
The leading dimension of the array L. LDDL >= max(1,M).
@param[in,out]
dA DOUBLE COMPLEX array, dimension (LDDA, N)
On entry, the M-by-N tile A on the gpu.
On exit, updated by the application of L on the gpu.
@param[in]
ldda INTEGER
The leading dimension of the array A. LDDA >= max(1,M).
@ingroup magma_zgesv_tile
********************************************************************/
extern "C" magma_int_t
magma_zgessm_gpu( magma_order_t order, magma_int_t m, magma_int_t n, magma_int_t k, magma_int_t ib,
magma_int_t *ipiv,
magmaDoubleComplex *dL1, magma_int_t lddl1,
magmaDoubleComplex *dL, magma_int_t lddl,
magmaDoubleComplex *dA, magma_int_t ldda,
magma_int_t *info)
{
#define AT(i,j) (dAT + (i)*ldda + (j) )
#define L(i,j) (dL + (i) + (j)*lddl )
#define dL1(j) (dL1 + (j)*lddl1)
magmaDoubleComplex c_one = MAGMA_Z_ONE;
magmaDoubleComplex c_neg_one = MAGMA_Z_NEG_ONE;
int i, s, sb;
magmaDoubleComplex *dAT;
/* Check arguments */
*info = 0;
if (m < 0)
*info = -1;
else if (n < 0)
*info = -2;
else if (ldda < max(1,m))
*info = -4;
if (*info != 0) {
magma_xerbla( __func__, -(*info) );
return *info;
}
/* Quick return if possible */
if (m == 0 || n == 0)
return *info;
if ( order == MagmaColMajor ) {
magmablas_zgetmo_in( dA, dAT, ldda, m, n );
} else {
dAT = dA;
}
s = k / ib;
for (i = 0; i < k; i += ib) {
//.........这里部分代码省略.........
开发者ID:EmergentOrder,项目名称:magma,代码行数:101,代码来源:zgessm_gpu.cpp
示例14: SR_RecognizerResult_GetValue
ESR_ReturnCode SR_RecognizerResult_GetValue(const SR_RecognizerResult* self, const size_t nbest,
const LCHAR* key, LCHAR* value, size_t* len)
{
SR_RecognizerResultImpl* impl = (SR_RecognizerResultImpl*) self;
ArrayList* results;
SR_SemanticResult* result;
SR_SemanticResultImpl* resultImpl;
LCHAR* lValue;
size_t actualLen = 0, i, resultCount;
ESR_ReturnCode rc;
ESR_BOOL noMatch = ESR_TRUE;
/* Choose nbest-list entry */
CHKLOG(rc, impl->results->get(impl->results, nbest, (void **)&results));
/* Get the number of semantic results for the entry */
CHKLOG(rc, results->getSize(results, &resultCount));
for (i = 0; i < resultCount; ++i)
{
/* Choose semantic result */
CHKLOG(rc, results->get(results, i, (void **)&result));
resultImpl = (SR_SemanticResultImpl*) result;
rc = resultImpl->results->get(resultImpl->results, key, (void**) & lValue);
if (rc == ESR_SUCCESS)
{
noMatch = ESR_FALSE;
actualLen += LSTRLEN(lValue);
}
else if (rc != ESR_NO_MATCH_ERROR)
return rc;
}
if (noMatch)
return ESR_NO_MATCH_ERROR;
++actualLen;
/* Check for overflow */
if (actualLen + 1 > *len)
{
/* Unfortunately some people are using get value functions to get the size of the value by
* passing a zero length buffer which causes errors to be logged. I am adding code so
* that the error is not logged when the length is zero, thus preventing lots of logs from
* flooding the system. SteveR
*/
if ( ( *len ) != 0 )
PLogError(L("Buffer Overflow while fetching value for %s of choice %d Len %d"),
key, nbest, *len );
*len = actualLen + 1;
return ESR_BUFFER_OVERFLOW;
}
*len = actualLen;
LSTRCPY(value, L(""));
for (i = 0; i < resultCount; ++i)
{
/* Choose semantic result */
CHKLOG(rc, results->get(results, i, (void **)&result));
resultImpl = (SR_SemanticResultImpl*) result;
rc = resultImpl->results->get(resultImpl->results, key, (void **) & lValue);
if (rc == ESR_SUCCESS)
LSTRCAT(value, lValue);
else if (rc != ESR_NO_MATCH_ERROR)
return rc;
/* Separate semantic results with '#' token */
if (i < resultCount - 1) {
int len = LSTRLEN(value);
value[len] = MULTIPLE_MEANING_JOIN_CHAR;
value[len+1] = 0;
}
}
return ESR_SUCCESS;
CLEANUP:
return rc;
}
开发者ID:0omega,项目名称:platform_external_srec,代码行数:74,代码来源:RecognizerResultImpl.c
示例15: wxStaticBox
void BedShapePanel::build_panel(ConfigOptionPoints* default_pt)
{
// on_change(nullptr);
auto box = new wxStaticBox(this, wxID_ANY, _(L("Shape")));
auto sbsizer = new wxStaticBoxSizer(box, wxVERTICAL);
// shape options
m_shape_options_book = new wxChoicebook(this, wxID_ANY, wxDefaultPosition,
wxSize(25*wxGetApp().em_unit(), -1), wxCHB_TOP);
sbsizer->Add(m_shape_options_book);
auto optgroup = init_shape_options_page(_(L("Rectangular")));
ConfigOptionDef def;
def.type = coPoints;
def.default_value = new ConfigOptionPoints{ Vec2d(200, 200) };
def.label = L("Size");
def.tooltip = L("Size in X and Y of the rectangular plate.");
Option option(def, "rect_size");
optgroup->append_single_option_line(option);
def.type = coPoints;
def.default_value = new ConfigOptionPoints{ Vec2d(0, 0) };
def.label = L("Origin");
def.tooltip = L("Distance of the 0,0 G-code coordinate from the front left corner of the rectangle.");
option = Option(def, "rect_origin");
optgroup->append_single_option_line(option);
optgroup = init_shape_options_page(_(L("Circular")));
def.type = coFloat;
def.default_value = new ConfigOptionFloat(200);
def.sidetext = L("mm");
def.label = L("Diameter");
def.tooltip = L("Diameter of the print bed. It is assumed that origin (0,0) is located in the center.");
option = Option(def, "diameter");
optgroup->append_single_option_line(option);
optgroup = init_shape_options_page(_(L("Custom")));
Line line{ "", "" };
line.full_width = 1;
line.widget = [this](wxWindow* parent) {
auto btn = new wxButton(parent, wxID_ANY, _(L("Load shape from STL...")), wxDefaultPosition, wxDefaultSize);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn);
btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e)
{
load_stl();
}));
return sizer;
};
optgroup->append_line(line);
Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent e)
{
update_shape();
}));
// right pane with preview canvas
m_canvas = new Bed_2D(this);
m_canvas->m_bed_shape = default_pt->values;
// main sizer
auto top_sizer = new wxBoxSizer(wxHORIZONTAL);
top_sizer->Add(sbsizer, 0, wxEXPAND | wxLeft | wxTOP | wxBOTTOM, 10);
if (m_canvas)
top_sizer->Add(m_canvas, 1, wxEXPAND | wxALL, 10) ;
SetSizerAndFit(top_sizer);
set_shape(default_pt);
update_preview();
}
开发者ID:prusa3d,项目名称:Slic3r,代码行数:75,代码来源:BedShapeDialog.cpp
示例16: draw_spiral
static cairo_time_t
draw_spiral (cairo_t *cr,
cairo_fill_rule_t fill_rule,
align_t align,
close_t close,
int width, int height, int loops)
{
int i;
int n=0;
double x[MAX_SEGMENTS];
double y[MAX_SEGMENTS];
int step = 3;
int side = width < height ? width : height;
assert(5*(side/step/2+1)+2 < MAX_SEGMENTS);
#define L(x_,y_) (x[n] = (x_), y[n] = (y_), n++)
#define M(x_,y_) L(x_,y_)
#define v(t) L(x[n-1], y[n-1] + (t))
#define h(t) L(x[n-1] + (t), y[n-1])
switch (align) {
case PIXALIGN: M(0,0); break;
case NONALIGN: M(0.1415926, 0.7182818); break;
}
while (side >= step && side >= 0) {
v(side);
h(side);
v(-side);
h(-side+step);
v(step);
side -= 2*step;
}
switch (close) {
case RECTCLOSE: L(x[n-1],y[0]); break;
case DIAGCLOSE: L(x[0],y[0]); break;
}
assert(n < MAX_SEGMENTS);
cairo_save (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_paint (cr);
cairo_translate (cr, 1, 1);
cairo_set_fill_rule (cr, fill_rule);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_new_path (cr);
cairo_move_to (cr, x[0], y[0]);
for (i = 1; i < n; i++) {
cairo_line_to (cr, x[i], y[i]);
}
cairo_close_path (cr);
cairo_perf_timer_start ();
cairo_perf_set_thread_aware (cr, FALSE);
while (loops--) {
if (loops == 0)
cairo_perf_set_thread_aware (cr, TRUE);
cairo_fill_preserve (cr);
}
cairo_perf_timer_stop ();
cairo_restore (cr);
return cairo_perf_timer_elapsed ();
}
开发者ID:csyuschmjuh,项目名称:apl,代码行数:71,代码来源:spiral.c
示例17: checkMatrix_
void GaussianWhiteNoise::setCovarianceMatrix(const Matrix & cov)
{
checkMatrix_(cov);
Matrix L( cov.llt().matrixL());
std_=L;
}
开发者ID:amifsud,项目名称:state-observation,代码行数:6,代码来源:gaussian-white-noise.cpp
示例18: p
// SamplerIntegrator Method Definitions
void SamplerIntegrator::Render(const Scene &scene) {
ProfilePhase p(Prof::IntegratorRender);
Preprocess(scene, *sampler);
// Render image tiles in parallel
// Compute number of tiles, _nTiles_, to use for parallel rendering
Bounds2i sampleBounds = camera->film->GetSampleBounds();
Vector2i sampleExtent = sampleBounds.Diagonal();
const int tileSize = 16;
Point2i nTiles((sampleExtent.x + tileSize - 1) / tileSize,
(sampleExtent.y + tileSize - 1) / tileSize);
ProgressReporter reporter(nTiles.x * nTiles.y, "Rendering");
{
StatTimer timer(&renderingTime);
ParallelFor2D([&](Point2i tile) {
// Render section of image corresponding to _tile_
// Allocate _MemoryArena_ for tile
MemoryArena arena;
// Get sampler instance for tile
int seed = tile.y * nTiles.x + tile.x;
std::unique_ptr<Sampler> tileSampler = sampler->Clone(seed);
// Compute sample bounds for tile
int x0 = sampleBounds.pMin.x + tile.x * tileSize;
int x1 = std::min(x0 + tileSize, sampleBounds.pMax.x);
int y0 = sampleBounds.pMin.y + tile.y * tileSize;
int y1 = std::min(y0 + tileSize, sampleBounds.pMax.y);
Bounds2i tileBounds(Point2i(x0, y0), Point2i(x1, y1));
// Get _FilmTile_ for tile
std::unique_ptr<FilmTile> filmTile =
camera->film->GetFilmTile(tileBounds);
// Loop over pixels in tile to render them
for (Point2i pixel : tileBounds) {
{
ProfilePhase pp(Prof::StartPixel);
tileSampler->StartPixel(pixel);
}
do {
// Initialize _CameraSample_ for current sample
CameraSample cameraSample =
tileSampler->GetCameraSample(pixel);
// Generate camera ray for current sample
RayDifferential ray;
Float rayWeight =
camera->GenerateRayDifferential(cameraSample, &ray);
ray.ScaleDifferentials(
1 / std::sqrt((Float)tileSampler->samplesPerPixel));
++nCameraRays;
// Evaluate radiance along camera ray
Spectrum L(0.f);
if (rayWeight > 0) L = Li(ray, scene, *tileSampler, arena);
// Issue warning if unexpected radiance value returned
if (L.HasNaNs()) {
Error(
"Not-a-number radiance value returned "
"for image sample. Setting to black.");
L = Spectrum(0.f);
} else if (L.y() < -1e-5) {
Error(
"Negative luminance value, %f, returned "
"for image sample. Setting to black.",
L.y());
L = Spectrum(0.f);
} else if (std::isinf(L.y())) {
Error(
"Infinite luminance value returned "
"for image sample. Setting to black.");
L = Spectrum(0.f);
}
// Add camera ray's contribution to image
filmTile->AddSample(cameraSample.pFilm, L, rayWeight);
// Free _MemoryArena_ memory from computing image sample
// value
arena.Reset();
} while (tileSampler->StartNextSample());
}
// Merge image tile into _Film_
camera->film->MergeFilmTile(std::move(filmTile));
reporter.Update();
}, nTiles);
reporter.Done();
}
// Save final image after rendering
camera->film->WriteImage();
}
开发者ID:Drooids,项目名称:pbrt-v3,代码行数:97,代码来源:integrator.cpp
示例19: Link
void Link(void) {
SPLog("Linking with OpenAL library.");
L(alEnable);
L(alDisable);
L(alIsEnabled);
L(alGetString);
L(alGetBooleanv);
L(alGetIntegerv);
L(alGetFloatv);
L(alGetDoublev);
L(alGetBoolean);
L(alGetInteger);
L(alGetFloat);
L(alGetDouble);
L(alGetError);
L(alIsExtensionPresent);
L(alGetProcAddress);
L(alGetEnumValue);
L(alListenerf);
L(alListener3f);
L(alListenerfv);
L(alListeneri);
L(alGetListenerf);
L(alGetListener3f);
L(alGetListenerfv);
L(alGetListeneri);
L(alGenSources);
L(alDeleteSources);
L(alIsSource);
L(alSourcef);
L(alSource3f);
L(alSourcefv);
L(alSourcei);
L(alSource3i);
L(alGetSourcef);
L(alGetSource3f);
L(alGetSourcefv);
L(alGetSourcei);
L(alSourcePlayv);
L(alSourceStopv);
L(alSourceRewindv);
L(alSourcePausev);
L(alSourcePlay);
L(alSourceStop);
L(alSourceRewind);
L(alSourcePause);
L(alSourceQueueBuffers);
L(alSourceUnqueueBuffers);
L(alGenBuffers);
L(alDeleteBuffers);
L(alIsBuffer);
L(alBufferData);
L(alGetBufferf);
L(alGetBufferi);
L(alDopplerFactor);
L(alDopplerVelocity);
L(alDistanceModel);
L(alcCreateContext);
L(alcMakeContextCurrent);
L(alcProcessContext);
L(alcSuspendContext);
L(alcDestroyContext);
L(alcGetCurrentContext);
L(alcGetContextsDevice);
L(alcOpenDevice);
L(alcCloseDevice);
L(alcGetError);
L(alcI
|
请发表评论