本文整理汇总了C++中L函数的典型用法代码示例。如果您正苦于以下问题:C++ L函数的具体用法?C++ L怎么用?C++ L使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了L函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
//.........这里部分代码省略.........
示例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
}
示例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));
}
示例5: L
void DBConnectionPool::release(const string& host, DBClientBase *c) {
scoped_lock L(_mutex);
_pools[PoolKey(host,c->getSoTimeout())].done(this,c);
}
示例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);
}
}
示例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();
//.........这里部分代码省略.........
示例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());
}
示例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;
}
示例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--;
}
//.........这里部分代码省略.........
示例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);
}
示例12: L
void Peer::AddPeerNode(PeerNodePtr pNode)
{
boost::recursive_mutex::scoped_lock L(m_mutex);
m_peerNodeList.push_back(pNode);
}
示例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) {
//.........这里部分代码省略.........
示例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;
}
示例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();
}