本文整理汇总了C++中decompose函数的典型用法代码示例。如果您正苦于以下问题:C++ decompose函数的具体用法?C++ decompose怎么用?C++ decompose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decompose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ffi_pl_perl_to_complex_float
void
ffi_pl_perl_to_complex_float(SV *sv, float *ptr)
{
if(sv_isobject(sv) && sv_derived_from(sv, "Math::Complex"))
{
ptr[0] = decompose(sv, 0);
ptr[1] = decompose(sv, 1);
}
else if(SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVAV)
{
AV *av = (AV*) SvRV(sv);
SV **real_sv, **imag_sv;
real_sv = av_fetch(av, 0, 0);
imag_sv = av_fetch(av, 1, 0);
ptr[0] = real_sv != NULL ? SvNV(*real_sv) : 0.0;
ptr[1]= imag_sv != NULL ? SvNV(*imag_sv) : 0.0;
}
else if(SvOK(sv))
{
ptr[0] = SvNV(sv);
ptr[1] = 0.0;
}
else
{
ptr[0] = 0.0;
ptr[1] = 0.0;
}
}
开发者ID:plicease,项目名称:FFI-Platypus,代码行数:28,代码来源:complex.c
示例2: decompose
void AnimatedTransform::setTransforms(const Transform& t1, const Transform& t2) {
_actuallyAnimated = true;
_transforms[0] = t1;
_transforms[1] = t2;
// Decompose matrices
decompose(t1.getMatrix(), &_translations[0], &_rotations[0], &_scales[0]);
decompose(t2.getMatrix(), &_translations[1], &_rotations[1], &_scales[1]);
if (dot(_rotations[0], _rotations[1]) < 0.f) {
_rotations[1] = -_rotations[1];
}
}
开发者ID:gaelduplessix,项目名称:lvv,代码行数:11,代码来源:AnimatedTransform.cpp
示例3: decompose
/*
* n:剩余数值
* visited:设置访问标志
* sum:当前元素的总和
* 当前记录数组可用的位置
*/
int decompose(int n,int a[],int visited[],int size,int sum,int idx,int current)
{
int i;
if(n == 0) {
puts("decompose:");
for(i = 0;i < idx;++i)
printf("%d ",a[i]);
printf("\n");
count++;
//printf("sum:%d,n:%d,idx:%d\n",sum,n,idx);
//printf("idx:%d,%d\n",idx,a[idx]);
//getchar();
return 0;
}
//printf("begin loop:%d,idx:%d,sum:%d,n:%d,a[0]:%d\n",current,idx,sum,n,a[0]);
//print(a,idx);
for(i = current;i <= size;i++) {
if(!visited[i] && n >= i && sum >= 0 && idx < size) {
//printf("a[0]:%d,idx:%d,i:%d\n",a[0],idx,i);
a[idx] = i;
visited[i] = 1;
sum += i;
n -= i;
//print(a,idx);
//printf("idx:%d,i:%d,n:%d,sum:%d\n",idx,i,n,sum);
break;
}
}
//puts("--------end loop -----------");
//not found i,clear idx
if(i == size+1) {
idx--;
visited[a[idx]] = 0;
n += a[idx];
sum -= a[idx];
//printf("not found,clear idx:%d,a[idx]:%d,sum:%d,n:%d\n",idx,a[idx],sum,n);
return 0;
}
//choose i
//printf("next recursion idx:%d,sum:%d,n:%d\n",idx+1,sum,n);
decompose(n,a,visited,size,sum,idx+1,a[idx]+1);
//dont' choose i
visited[a[idx]] = 0;
n += a[idx];
sum -= a[idx];
//clear i
decompose(n,a,visited,size,sum,idx,a[idx]+1);
return 0;
}
开发者ID:ytaoWang,项目名称:test,代码行数:59,代码来源:test.c
示例4: cells
Foam::labelList Foam::metisDecomp::decompose
(
const labelListList& globalCellCells,
const pointField& cellCentres,
const scalarField& cellWeights
)
{
if (cellCentres.size() != globalCellCells.size())
{
FatalErrorIn
(
"metisDecomp::decompose"
"(const pointField&, const labelListList&, const scalarField&)"
) << "Inconsistent number of cells (" << globalCellCells.size()
<< ") and number of cell centres (" << cellCentres.size()
<< ")." << exit(FatalError);
}
// Make Metis CSR (Compressed Storage Format) storage
// adjncy : contains neighbours (= edges in graph)
// xadj(celli) : start of information in adjncy for celli
CompactListList<label> cellCells(globalCellCells);
// Decompose using default weights
labelList decomp;
decompose(cellCells.m(), cellCells.offsets(), cellWeights, decomp);
return decomp;
}
开发者ID:markuskolano,项目名称:OpenFOAM-2.0.x,代码行数:31,代码来源:metisDecomp.C
示例5: coordinate
Foam::labelList Foam::metisDecomp::decompose
(
const polyMesh& mesh,
const pointField& points,
const scalarField& pointWeights
)
{
if (points.size() != mesh.nCells())
{
FatalErrorIn
(
"metisDecomp::decompose(const pointField&,const scalarField&)"
) << "Can use this decomposition method only for the whole mesh"
<< endl
<< "and supply one coordinate (cellCentre) for every cell." << endl
<< "The number of coordinates " << points.size() << endl
<< "The number of cells in the mesh " << mesh.nCells()
<< exit(FatalError);
}
CompactListList<label> cellCells;
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
// Decompose using default weights
labelList decomp;
decompose(cellCells.m(), cellCells.offsets(), pointWeights, decomp);
return decomp;
}
开发者ID:markuskolano,项目名称:OpenFOAM-2.0.x,代码行数:29,代码来源:metisDecomp.C
示例6: test_1_2_ja_flat
void
test_1_2_ja_flat(void)
{
cut_assert_equal_string("Sample of OpenDocument Text 1.2 (flat)\n"
"OpenDocument Text 1.2 (flat) の日本語サンプル\n",
decompose("1.2_ja.fodt"));
}
开发者ID:ranguba,项目名称:chupatext,代码行数:7,代码来源:test_open_document_text.c
示例7: test_1_2_ja
void
test_1_2_ja(void)
{
cut_assert_equal_string("Sample of OpenDocument Text 1.2\n"
"OpenDocument Text 1.2 の日本語サンプル\n",
decompose("1.2_ja.odt"));
}
开发者ID:ranguba,项目名称:chupatext,代码行数:7,代码来源:test_open_document_text.c
示例8: getCharClass
static le_int32 getCharClass(LEUnicode ch, LEUnicode &lead, LEUnicode &vowel, LEUnicode &trail)
{
lead = LJMO_FILL;
vowel = VJMO_FILL;
trail = TJMO_FIRST;
if (ch >= LJMO_FIRST && ch <= LJMO_LAST) {
lead = ch;
return CC_L;
}
if (ch >= VJMO_FIRST && ch <= VJMO_LAST) {
vowel = ch;
return CC_V;
}
if (ch > TJMO_FIRST && ch <= TJMO_LAST) {
trail = ch;
return CC_T;
}
le_int32 c = decompose(ch, lead, vowel, trail);
if (c == 2) {
return CC_LV;
}
if (c == 3) {
return CC_LVT;
}
trail = ch;
return CC_X;
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:34,代码来源:HangulLayoutEngine.cpp
示例9: toString
void Bigint::internalDivide(const Bigint& number, const bool& isDecimal, const int& precision)
{
std::string mstring;
std::vector<int> mparts;
std::string fnvalue = toString();
std::string snvalue = number.toString();
if(fnvalue.length()>snvalue.length())
{
if(!number.isPositive)
mstring = snvalue.substr(1);
else
mstring = snvalue;
mparts = parts;
}
else
{
if(!number.isPositive)
mstring = fnvalue.substr(1);
else
mstring = fnvalue;
mparts = number.parts;
}
if(mstring!="" && mparts.size()>0)
{
int recurse = 0;
std::string build;
decompose(fnvalue, snvalue, number, recurse, build, isDecimal, precision);
try {
create(build);
} catch (...) {
}
}
}
开发者ID:hornsey,项目名称:ffead-cpp,代码行数:33,代码来源:Bigint.cpp
示例10: decompose
void decompose(char* in,char* wr,Decomposed_word **morph_list, Dictionary dict){
char *o;
char tempstr[MDWL];
int i;
Decomposed_word *morph_node;
o=(char *) xalloc(MAX_WORD*sizeof(char));
strcpy(o,"");
for (i=0;wr[i]!='\0';i++){
o=strncat(o,wr+i,1);
if (dictionary_lookup(dict, o))
{
strcpy(tempstr,in);
strcat(in," ");
strcat(in,o);
decompose(in, wr+i+1,morph_list, dict);
strcpy(in,tempstr);
}
}
if ((wr[0]=='\0')&&(in[0])) {
morph_node=(Decomposed_word *) xalloc(sizeof(Decomposed_word));
strcpy(morph_node->word,in);
morph_node->next = (*morph_list);
if(*morph_list!=NULL){
(*morph_list)->prev=morph_node;
}
(*morph_list)=morph_node;
}
xfree(o,MAX_WORD*sizeof(char));
}
开发者ID:asajadi,项目名称:UniLinkParser,代码行数:32,代码来源:morpho-analyzer.c
示例11: sqrtf
void Physics3DComponent::syncPhysicsToNode()
{
if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY
|| _physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::COLLIDER)
{
Mat4 parentMat;
if (_owner->getParent())
parentMat = _owner->getParent()->getNodeToWorldTransform();
auto mat = parentMat.getInversed() * _physics3DObj->getWorldTransform();
//remove scale, no scale support for physics
float oneOverLen = 1.f / sqrtf(mat.m[0] * mat.m[0] + mat.m[1] * mat.m[1] + mat.m[2] * mat.m[2]);
mat.m[0] *= oneOverLen;
mat.m[1] *= oneOverLen;
mat.m[2] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[4] * mat.m[4] + mat.m[5] * mat.m[5] + mat.m[6] * mat.m[6]);
mat.m[4] *= oneOverLen;
mat.m[5] *= oneOverLen;
mat.m[6] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[8] * mat.m[8] + mat.m[9] * mat.m[9] + mat.m[10] * mat.m[10]);
mat.m[8] *= oneOverLen;
mat.m[9] *= oneOverLen;
mat.m[10] *= oneOverLen;
mat *= _transformInPhysics;
static Vec3 scale, translation;
static Quaternion quat;
mat.decompose(&scale, &quat, &translation);
_owner->setPosition3D(translation);
quat.normalize();
_owner->setRotationQuat(quat);
}
}
开发者ID:1005491398,项目名称:Threes,代码行数:33,代码来源:CCPhysics3DComponent.cpp
示例12: decompose
// Get decomposed filename .......................................
FileName FileName::getDecomposedFileName() const
{
String str;
size_t no;
decompose(no, str);
return str;
}
开发者ID:I2PC,项目名称:scipion,代码行数:8,代码来源:xmipp_filename.cpp
示例13: main
int main(void)
{
double pi = 3.1415;
int int_part;
double frac_part;
int num;
int *p = 0x8048000;
printf("*p = %d\n", *p);
printf("input a number:\n");
scanf("%d", 0x8048000);
printf("*p = %d\n", *p);
return 0;
printf("&int_part = %p\n", &int_part);
decompose(pi, &int_part, &frac_part);
printf("int_part = %d\n", int_part);
printf("frac_part = %f\n", frac_part);
printf("&int_part = %p\n", &int_part);
return 0;
}
开发者ID:dajun,项目名称:akaedu-c-learning-1,代码行数:25,代码来源:pointer-para.c
示例14: main
int main() {
int n;
int i;
bool first_print = true;
init_number();
scanf("%d", &n);
for(i = 1; i <= n; i++) {
decompose(i);
}
for(i = 2; i <= n; i++) {
if(composit_number[i] && record[i] >= 1) {
if(record[i] == 1) {
if(first_print) {
printf("%d", i);
first_print = false;
}
else
printf("*%d", i);
}
else {
if(first_print) {
printf("%d^%d", i, record[i]);
first_print = false;
}
else
printf("*%d^%d", i, record[i]);
}
}
}
return 0;
}
开发者ID:mRasey,项目名称:C,代码行数:31,代码来源:decompose.c
示例15: decompose
void TransformationMatrix::blend(const TransformationMatrix& from, double progress)
{
if (from.isIdentity() && isIdentity())
return;
// decompose
DecomposedType fromDecomp;
DecomposedType toDecomp;
from.decompose(fromDecomp);
decompose(toDecomp);
// interpolate
blendFloat(fromDecomp.scaleX, toDecomp.scaleX, progress);
blendFloat(fromDecomp.scaleY, toDecomp.scaleY, progress);
blendFloat(fromDecomp.scaleZ, toDecomp.scaleZ, progress);
blendFloat(fromDecomp.skewXY, toDecomp.skewXY, progress);
blendFloat(fromDecomp.skewXZ, toDecomp.skewXZ, progress);
blendFloat(fromDecomp.skewYZ, toDecomp.skewYZ, progress);
blendFloat(fromDecomp.translateX, toDecomp.translateX, progress);
blendFloat(fromDecomp.translateY, toDecomp.translateY, progress);
blendFloat(fromDecomp.translateZ, toDecomp.translateZ, progress);
blendFloat(fromDecomp.perspectiveX, toDecomp.perspectiveX, progress);
blendFloat(fromDecomp.perspectiveY, toDecomp.perspectiveY, progress);
blendFloat(fromDecomp.perspectiveZ, toDecomp.perspectiveZ, progress);
blendFloat(fromDecomp.perspectiveW, toDecomp.perspectiveW, progress);
slerp(&fromDecomp.quaternionX, &toDecomp.quaternionX, progress);
// recompose
recompose(fromDecomp);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:31,代码来源:TransformationMatrix.cpp
示例16: load
static vumatptr load(const char* n){
typedef std::vector<VUMATPtrHandler> VUMATPtrContainer;
static LibrariesHandler libraries;
static VUMATPtrContainer fcts;
#ifdef HAVE_STD_MUTEX
static std::mutex m;
std::lock_guard<std::mutex> lock(m);
#else /* HAVE_STD_MUTEX */
lock l;
#endif /* HAVE_STD_MUTEX */
try{
VUMATPtrContainer::const_iterator p;
p = std::find_if(fcts.begin(),fcts.end(),VUMATNameCompare(n));
if(p==fcts.end()){
const std::pair<std::string,std::string> lf = decompose(n);
const std::string& lib = lf.first;
const std::string& fct = lf.second;
if(lib.empty()){
report("","","",n);
return NULLPTR(vumatptr);
}
#if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__)
libptr l = ::LoadLibrary(TEXT (lib.c_str()));
#else
libptr l = ::dlopen(lib.c_str(),RTLD_NOW);
#endif
if(l==NULLPTR(libptr)){
#if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__)
report(lib,"",getLastWin32Error(),n);
#else
report(lib,"",::dlerror(),n);
#endif
return NULLPTR(vumatptr);
}
libraries.insert(std::make_pair(lib,l));
union {
void *ptr;
vumatptr f;
} r;
#if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__)
r.f = reinterpret_cast<vumatptr>(::GetProcAddress(l,fct.c_str()));
#else
r.ptr = ::dlsym(l,fct.c_str());
#endif
if(r.ptr==NULLPTR(void *)){
#if (defined _WIN32 || defined _WIN64) && (!defined __CYGWIN__)
report(lib,fct,getLastWin32Error(),n);
#else
report(lib,fct,::dlerror(),n);
#endif
return NULLPTR(vumatptr);
}
VUMATPtrHandler h;
h.name = std::string(n,n+80);
h.ptr = r.f;
fcts.push_back(h);
return r.f;
}
return p->ptr;
}
开发者ID:thelfer,项目名称:tfel,代码行数:60,代码来源:vumat-sp.cpp
示例17: freejarcs
void
Subdivider::drawSurfaces( long nuid )
{
renderhints.init( );
if (qlist == NULL) return;
for( Quilt *q = qlist; q; q = q->next ) {
if( q->isCulled( ) == CULL_TRIVIAL_REJECT ) {
freejarcs( initialbin );
return;
}
}
REAL from[2], to[2];
qlist->getRange( from, to, spbrkpts, tpbrkpts );
if( ! initialbin.isnonempty() ) {
makeBorderTrim( from, to );
} else {
REAL rate[2];
qlist->findRates( spbrkpts, tpbrkpts, rate );
if( decompose( initialbin, min(rate[0], rate[1]) ) )
mylongjmp( jumpbuffer, 31 );
}
backend.bgnsurf( renderhints.wiretris, renderhints.wirequads, nuid );
subdivideInS( initialbin );
backend.endsurf();
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:30,代码来源:subdivider.cpp
示例18: inverse
Matrix inverse( Matrix const & matrix )
{
assert( matrix.rows() == matrix.cols() );
auto [ p, lu ] = decompose( matrix, Strategy::LUP );
std::vector< Matrix > xSolutions;
xSolutions.reserve( lu.rows() );
for ( std::size_t i{ 0 }; i < lu.rows(); ++i )
{
Matrix m{ lu.rows(), 1 };
m( i, 0 ) = 1;
m = p * m;
supstitution::forward( lu, m );
supstitution::backward( lu, m );
xSolutions.emplace_back( m );
}
for ( std::size_t i{ 0 }; i < lu.rows(); ++i )
{
for ( std::size_t j{ 0 }; j < lu.cols(); ++j )
{
lu( i, j ) = xSolutions[ j ]( i, 0 );
}
}
Matrix identity{ Matrix::Identity( lu.rows() ) };
if ( lu.hasNan() || lu.hasInf() )
{
LOG_ERROR( "Matirx does not have inverse." );
}
return lu;
}
开发者ID:hermanzdosilovic,项目名称:computer-aided-analysis-and-design,代码行数:35,代码来源:linear.hpp
示例19: decompose
double CameraAnimator::determineDurationFactor()
{
// first try: if the start and end orientation differ by more than 90 degree, make the full animation
dp::math::Quatf diffQuat = m_cameraMoveStart->getOrientation() / m_cameraMoveTarget->getOrientation();
dp::math::Vec3f axis;
float angle;
decompose( diffQuat, axis, angle );
double durationFactor = dp::math::clamp( (double)(angle / dp::math::PI_HALF), 0.0, 1.0 );
// second try: if position moves about the focus distance (in fact the medium between start and end), make the full
// animation.
float mediumFocus = 0.5f * ( m_cameraMoveStart->getFocusDistance() + m_cameraMoveTarget->getFocusDistance() );
float posDistance = dp::math::distance( m_cameraMoveStart->getPosition(), m_cameraMoveTarget->getPosition() );
durationFactor = dp::math::clamp( (double)(posDistance / mediumFocus), durationFactor, 1.0 );
// third try: if near distance changes by more than 25%, make the full animation
durationFactor = clampDeviation( m_cameraMoveStart->getNearDistance(), m_cameraMoveTarget->getNearDistance(), 0.25f, durationFactor );
// fourth try: if focus distance changes by more than 25%, make the full animation
durationFactor = clampDeviation( m_cameraMoveStart->getFocusDistance(), m_cameraMoveTarget->getFocusDistance(), 0.25f, durationFactor );
// fifth try: if far distance changes by more than 25%, make the full animation
durationFactor = clampDeviation( m_cameraMoveStart->getFarDistance(), m_cameraMoveTarget->getFarDistance(), 0.25f, durationFactor );
// sixth try: if window size changes by more than 25%, make the full animation
durationFactor = clampDeviation( m_cameraMoveStart->getWindowSize()[0], m_cameraMoveTarget->getWindowSize()[0], 0.25f, durationFactor );
durationFactor = clampDeviation( m_cameraMoveStart->getWindowSize()[1], m_cameraMoveTarget->getWindowSize()[1], 0.25f, durationFactor );
// ignore windowOffset, lowerLeft, upperRight for now! I don't expect them to change much.
return( durationFactor );
}
开发者ID:mtavenrath,项目名称:pipeline,代码行数:31,代码来源:CameraAnimator.cpp
示例20: SubGraph
set<MinimalSeparator> IndSetExtBySeparators::extendToMaxIndependentSet(
const set<MinimalSeparator>& minSeps) {
queue<SubGraph> Q;
// create a copy of minSeps
set<MinimalSeparator> maximalSet = minSeps;
SubGraph sg = SubGraph(graph);
if (maximalSet.empty()) {
Q.push(sg);
} else {
Q = decompose(sg, minSeps);
}
vector<NodeSet> cComponents;
while (!Q.empty()) {
SubGraph& c = Q.front();
vector<Node> unconnectedNodes = getUnconnectedNodes(c);
if (unconnectedNodes[0] >= 0) { // <=> not clique
NodeSet minSepInC = findMinSep(unconnectedNodes, c);
c.addClique(minSepInC); // saturate
// c components when removing minSepInC group
cComponents = c.getComponents(minSepInC);
for (NodeSet& cComponent : cComponents) {
NodeSet cComponentNeighbors = c.getNeighbors(cComponent);
// mapping of the node indices in the component c to the node
// indices in the main graph
vector<int>& cNodeMapInMainGraph = c.getNodeMapToMainGraph();
includeNodesToMaximalSet(cNodeMapInMainGraph, maximalSet,
cComponentNeighbors, minSepInC);
// subComp nodes merged with its neighbors
NodeSet cComponentNeighborsMerged = mergeComponentAndNeighbors(
cComponent, cComponentNeighbors);
// create a sub graph out of c component and subCompMerged nodes
SubGraph cComponentSubGraph = SubGraph(c,
cComponentNeighborsMerged);
Q.push(cComponentSubGraph);
}
}
Q.pop();
}
return maximalSet;
}
开发者ID:NofarCarmeli,项目名称:TreeDecompositionEnumeration,代码行数:59,代码来源:IndSetExtBySeparators.cpp
注:本文中的decompose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论