/* File compgrp.c. Contains main program for command compgrp, which can be used to compare two groups. The command format is
compgrp <options> <group1> <group2>
where <group1> and <group2> are the permutation groups to be compared. The command prints one of the following messages:
i) <group1> and <group2> are equal. ii) <group1> is properly contained in <group2>. iii) <group2> is properly contained in <group1>. iv) Neither of <group1> or <group2> is contained in the other.
The return value is 0, 1, 2, or 3 depending on whether (i), (ii), (iii), or (iv) above hold, respectively. If an error occurs, the return code is 4.
The only options are -c and -n (and the special options -l and -v, which have their standard meaning). If -c is specified, the program checks whether the two groups centralize each other. If -n is specified, it checks whether either group normalizes the other.
*/
/* Check for limits option. If present in position 1, 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 most 2 parameters following options. */ if ( argc - optionCountPlus1 > 2 )
ERROR( "Compgrp", "Exactly 2 non-option parameters are required.")
/* If second group is omitted, check if first group is the identity. */ if ( !group2 ) { if ( group1->order->noOfFactors == 0 ) { if ( options.inform )
printf( "\n %s is the identity.\n", group1->name); return 0;
} else { if ( options.inform )
printf( "\n %s is not the identity.\n", group1->name); return 1;
}
}
/* Check containment. */ if ( isSubgroupOf(group1,group2) ) { if ( isSubgroupOf(group2,group1) ) { if ( options.inform )
printf( "\n %s and %s are equal.\n", group1->name, group2->name); if ( centralizeFlag ) { if ( isCentralizedBy(group1,group2) ) {
printf( " %s and %s centralize each other.\n",
group1->name, group2->name);
skipNormalize = TRUE;
} else
printf( " %s and %s do not centralize each other.\n",
group1->name, group2->name);
}
returnCode = 0;
} else { if ( options.inform )
printf( "\n %s is properly contained in %s.\n", group1->name,
group2->name); if ( centralizeFlag ) { if ( isCentralizedBy(group1,group2) ) {
printf( " %s and %s centralize each other.\n",
group1->name, group2->name);
skipNormalize = TRUE;
} else
printf( " %s and %s do not centralize each other.\n",
group1->name, group2->name);
} if ( normalizeFlag && !skipNormalize ) { if ( isNormalizedBy(group1,group2) )
printf( " %s is normal in %s.\n", group1->name,
group2->name); else
printf( " %s is not normal in %s.\n", group1->name,
group2->name);
}
returnCode = 1;
}
} else { if ( isSubgroupOf(group2,group1) ) { if ( options.inform )
printf( "\n %s is properly contained in %s.\n", group2->name,
group1->name); if ( centralizeFlag ) { if ( isCentralizedBy(group1,group2) ) {
printf( " %s and %s centralize each other.\n",
group1->name, group2->name);
skipNormalize = TRUE;
} else
printf( " %s and %s do not centralize each other.\n",
group1->name, group2->name);
} if ( normalizeFlag && !skipNormalize ) { if ( isNormalizedBy( group2, group1) )
printf( " %s is normal in %s.\n", group2->name,
group1->name); else
printf( " %s is not normal in %s.\n", group2->name,
group1->name);
}
returnCode = 2;
} else { if ( options.inform )
printf( "\n Neither of %s or %s is contained in the other.\n",
group1->name, group2->name); if ( centralizeFlag ) { if ( isCentralizedBy(group1,group2) ) {
printf( " %s and %s centralize each other.\n",
group1->name, group2->name);
skipNormalize = TRUE;
} else
printf( " %s and %s do not centralize each other.\n",
group1->name, group2->name);
} if ( normalizeFlag && !skipNormalize ) { if ( isNormalizedBy( group1, group2) )
printf( " %s is normalized by %s.\n", group1->name,
group2->name); else
printf( " %s is not normalized by %s.\n", group1->name,
group2->name); if ( isNormalizedBy( group2, group1) )
printf( " %s is normalized by %s.\n", group2->name,
group1->name); else
printf( " %s is not normalized by %s.\n", group2->name,
group1->name);
}
returnCode = 3;
}
}
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.