/* File fndelt.c. Main program for fndelt command, which may be used to find semirandom elements of specified order (default 2) in a permutation group and to find the orders of all products of these elements or their number of fixed points. Selected elements can be appended to a Cayley library, either in permutation or permutation group format. The format of the command is:
/* If there are no options, provide usage information and exit. */ if ( argc == 1 ) {
printf( "\nUsage: fndelt [options] permGroup numberOfElts [saveElt]...\n"); return 0;
}
/* Check for limits option. If present in position i (i as above) give
limits and return. */ if ( strcmp(argv[1], "-l") == 0 || strcmp(argv[1], "-L") == 0 ) {
showLimits(); return 0;
}
/* Check for verify option. If present in position i (i as above) perform
verify (Note verifyOptions terminates program). */ if ( strcmp(argv[1], "-v") == 0 || strcmp(argv[1], "-V") == 0 )
verifyOptions();
/* Check for at least two parameters following options. */ for ( optionCountPlus1 = 1 ; optionCountPlus1 <= argc-1 &&
argv[optionCountPlus1][0] == '-' ; ++optionCountPlus1 )
;
if ( argc - optionCountPlus1 < 2 ) {
printf( "\n\nError: At least 2 non-option parameters are required.\n"); exit(ERROR_RETURN_CODE);
}
/* Read in group. */
G = readPermGroup( permGroupFileName, permGroupLibraryName, 0, "Generate");
/* Repeatedly generate random group elements. When possible, take power
to give desired order. */
successCount = 0;
attemptCount = 0;
initializeSeed( seed); while ( successCount < numberOfInvolsToFind && ++attemptCount <= maxAttemptCount) {
newPerm = randGroupPerm( G, 1);
order = permOrder( newPerm); if ( (order = permOrder(newPerm)) % orderToFind == 0 ) {
raisePermToPower( newPerm, order / orderToFind);
newPerm->name[0] = 'x';
invol[++successCount] = newPerm;
sprintf( newPerm->name+1, "%d", successCount);
}
}
/* Find the number of fixed points, if desired. */ if ( fixedPointsOption ) {
printf( "\n\n Number of fixed points.\n\n"); for ( i = 1 ; i <= successCount ; ++i ) {
f = 0; for ( j = 1 ; j <= G->degree ; ++j )
f += (invol[i]->image[j] == j);
printf( " %-5s %5d\n", invol[i]->name, f);
}
}
/* Find orders of products, if desired. */ if ( orderOption ) {
printf( "\n\n Orders of products.\n");
prodPerm = newUndefinedPerm( G->degree); for ( i = 1 ; i < successCount ; ++i ) for ( j = i+1 ; j <= successCount ; ++j ) {
copyPermutation( invol[i], prodPerm);
rightMultiply( prodPerm, invol[j]);
printf( "\n %-5s %-5s %8ld", invol[i]->name, invol[j]->name,
permOrder( prodPerm) );
}
}
/* Print involutions if requested, and write out group. */ if ( groupOutputName[0] ) {
involSubgroup = newTrivialPermGroup( G->degree); if ( outputObjectName[0] )
strcpy( involSubgroup->name, outputObjectName); else
strcpy( involSubgroup->name, groupOutputLibraryName);
involSubgroup->base = NULL;
involSubgroup->order = NULL;
involSubgroup->printFormat = (imageFormatFlag ? imageFormat : cycleFormat);
sprintf( comment, "Constructed by fndElt. Generators have order %d.",
orderToFind); for ( j = optionCountPlus1+2 ; j < argc ; ++j ) {
i = strtol(argv[j], NULL, 0); if ( i > successCount ) {
printf( "\nFewer than %u permutations were found.\n", i); continue;
}
strcpy( invol[i]->name, "x");
sprintf( invol[i]->name+1, "%d", i);
invol[i]->next = NULL; if ( involSubgroup->generator )
invol[i]->next = involSubgroup->generator;
involSubgroup->generator = invol[i];
}
writePermGroup( groupOutputFileName, groupOutputLibraryName,
involSubgroup, comment);
}
if ( permOutputName[0] && optionCountPlus1+2 < argc ) {
i = strtol(argv[optionCountPlus1+2], NULL, 0); if ( i < successCount ) {
sprintf( comment, "Constructed by fndElt. Seed %lu, permutation %d.",
seed, i); if ( outputObjectName[0] )
strcpy( invol[i]->name, outputObjectName); else
strcpy( invol[i]->name, permOutputLibraryName);
writePermutation( permOutputFileName, permOutputLibraryName,
invol[i], (imageFormatFlag ? "image" : "cycle"), comment);
} else
printf( "\nFewer than %u permutations were found.\n", i);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.