本文整理汇总了C++中VectorI::end方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorI::end方法的具体用法?C++ VectorI::end怎么用?C++ VectorI::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorI
的用法示例。
在下文中一共展示了VectorI::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: minpoly
ALGEB minpoly(MKernelVector kv, ALGEB* args)
{
int i;
ALGEB retlist, blank;
char err[] = "ERROR! Associated blackbox object does not exist!";
int key = MapleToInteger32(kv,args[1]), flag;
std::map<int,int>::iterator f_i;
std::map<int,void*>::iterator h_i;
// Get the data from the hash table
f_i = typeTable.find(key);
if( f_i == typeTable.end() )
MapleRaiseError(kv,err);
else
flag = f_i->second;
h_i = hashTable.find(key);
if(h_i != hashTable.end() ) { // We've got data
switch( flag ) {
// Getting the minimal polynomial is rather complicated, so both instances of this code were
// wrapped up inside a block, to cut down at the clutter at the top of this function.
// First declares a vector of the proper type and casts the pointer. Then computes the minimal
// polynomial. It then builds the proper Maple list structure for this application.
case BlackBoxi: {
Vectorl mpreturn;
Vectorl::iterator mp_i;
TriplesBBi* BB = (TriplesBBi*) h_i->second;
LinBox::minpoly( mpreturn, *BB, BB->field() );
retlist = MapleListAlloc(kv, mpreturn.size() );
for(i = 1, mp_i = mpreturn.begin(); mp_i != mpreturn.end(); ++mp_i, ++i)
MapleListAssign(kv, retlist, i, ToMapleInteger(kv, *mp_i));
}
break;
case BlackBoxI: {
VectorI mpreturn;
VectorI::iterator mp_i;
TriplesBBI* BB = (TriplesBBI*) h_i->second;
LinBox::minpoly( mpreturn, *BB, BB->field() );
retlist = MapleListAlloc(kv, mpreturn.size());
for(i = 1, mp_i = mpreturn.begin(); mp_i != mpreturn.end(); ++mp_i, ++i)
MapleListAssign(kv, retlist, i, LiToM(kv, *mp_i, blank));
}
break;
}
}
else
MapleRaiseError(kv,err);
return retlist;
}
示例2: getVector
ALGEB getVector(MKernelVector kv, ALGEB* args)
{
// Get the key, declare variables
int key = MapleToInteger32(kv,args[1]), flag;
char err[] = "ERROR! The associated Vector object does not exist!";
M_INT index, bound[2];
RTableData d;
RTableSettings s;
ALGEB rtable, blank;
char MapleStatement[100] = "rtable(1..";
// Check to see if the object pointed to by key is in the type table. If not, panic
std::map<int,int>::iterator f_i = typeTable.find(key);
if(f_i == typeTable.end() ) {
MapleRaiseError(kv, err);
}
// Otherwise, we have our object
flag = f_i->second;
// Get a pointer to the actual data
std::map<int,void*>::iterator h_i = hashTable.find(key);
if(h_i != hashTable.end() ) {
// Diverge over whether we are using maple 7 or 8 ( and 5 & 6)
// in Maple, arg 3 is a flag indicating which method to use
switch( MapleToInteger32(kv, args[3])) {
// In this case, Maple 7 is being used, we have to construct a call using "EvalMapleStatement()"
// to call the RTable constructor
case 1:
switch(flag) {
case SmallV:{
// Get the vector
Vectorl* V = (Vectorl*) h_i->second;
Vectorl::const_iterator V_i;
// Create the Maple object
sprintf(MapleStatement + strlen(MapleStatement), "%d", V->size() );
strcat(MapleStatement, ", subtype=Vector[column], storage=sparse)");
rtable = kv->evalMapleStatement(MapleStatement);
// populate the Maple vector w/ the entries from V above
for(index = 1, V_i = V->begin(); V_i != V->end(); ++V_i, ++index) {
d.dag = ToMapleInteger(kv, *V_i); // d is a union, dag is the
// ALGEB union field
RTableAssign(kv, rtable, &index, d);
}
}
break;
case LargeV: {
// This part works the same way as above
VectorI* V = (VectorI*) h_i->second;
VectorI::const_iterator V_i;
sprintf(MapleStatement + strlen(MapleStatement), "%d", V->size() );
strcat(MapleStatement, ",subtype=Vector[column], storage=sparse)");
rtable = kv->evalMapleStatement(MapleStatement);
// Use maple callback to call the procedure from Maple that translates a gmp integer
// into a large maple integer. Then put this into the Maple vector
for(index = 1, V_i = V->begin(); V_i != V->end(); ++V_i, ++index) {
/* Okay, here's how this line works. Basically,
* in order to set the entries of this RTable to
* multi-precision integers, I have to first use my own conversion
* method, LiToM, to convert the integer entry to a ALGEB structure,
* then do a callback into Maple that calls the ExToM procedure,
* which converts the results of LiToM into a Maple multi-precision
* integer. At the moment, this is the best idea I've got as to
* how to convert a GMP integer into a Maple representation in one shot.
*/
d.dag = EvalMapleProc(kv,args[2],1,LiToM(kv, *V_i, blank));
RTableAssign(kv, rtable, &index, d);
}
}
break;
default:
MapleRaiseError(kv, err);
break;
}
break;
// In this case, use the simpler RTableCreate function, rather than building a string
// that must be parsed by maple
case 2:
kv->rtableGetDefaults(&s); // Get default settings - set datatype to Maple,
// DAGTAG to anything
s.subtype = 2; // Subtype set to column vector
s.storage = 4; // Storage set to rectangular
s.num_dimensions = 1; // What do you think this means :-)
bound[0] = 1; // Set the lower bounds of each dimension to 0
switch(flag) {// Switch on data type of vector
//.........这里部分代码省略.........