/* -*-c-*-
*
- * $Id: field.h,v 1.8 2004/03/27 17:54:11 mdw Exp $
+ * $Id: field.h,v 1.9 2004/04/01 12:50:09 mdw Exp $
*
* Definitions for field arithmetic
*
/*----- Revision history --------------------------------------------------*
*
* $Log: field.h,v $
+ * Revision 1.9 2004/04/01 12:50:09 mdw
+ * Add cyclic group abstraction, with test code. Separate off exponentation
+ * functions for better static linking. Fix a buttload of bugs on the way.
+ * Generally ensure that negative exponents do inversion correctly. Add
+ * table of standard prime-field subgroups. (Binary field subgroups are
+ * currently unimplemented but easy to add if anyone ever finds a good one.)
+ *
* Revision 1.8 2004/03/27 17:54:11 mdw
* Standard curves and curve checking.
*
void (*destroy)(field */*f*/);
mp *(*rand)(field */*f*/, mp */*d*/, grand */*r*/);
+ int (*samep)(field */*f*/, field */*g*/);
mp *(*in)(field */*f*/, mp */*d*/, mp */*x*/);
mp *(*out)(field */*f*/, mp */*d*/, mp */*x*/);
#define F_DESTROY(f) (f)->ops->destroy((f))
#define F_RAND(f, d, r) (f)->ops->rand((f), (d), (r))
+#define F_SAMEP(f, g) (f)->ops->samep((f), (g))
#define F_IN(f, d, x) (f)->ops->in((f), (d), (x))
#define F_OUT(f, d, x) (f)->ops->out((f), (d), (x))
extern mp *field_id(field */*f*/, mp */*d*/, mp */*x*/);
+/* --- @field_samep@ --- *
+ *
+ * Arguments: @field *f, *g@ = two fields
+ *
+ * Returns: Nonzero if the fields are identical (not just isomorphic).
+ *
+ * Use: Checks for sameness of fields. This function does the full
+ * check, not just the field-type-specific check done by the
+ * @sampep@ field operation.
+ */
+
+extern int field_samep(field */*f*/, field */*g*/);
+
+/* --- @field_stdsamep@ --- *
+ *
+ * Arguments: @field *f, *g@ = two fields
+ *
+ * Returns: Nonzero if the fields are identical (not just isomorphic).
+ *
+ * Use: Standard sameness check, based on equality of the @m@
+ * member.
+ */
+
+extern int field_stdsamep(field */*f*/, field */*g*/);
+
/*----- Creating fields ---------------------------------------------------*/
/* --- @field_prime@ --- *