Element Functions

Elements of groups, rings and fields are stored in the element_t data type. Variables of this type must be initialized before use, and should be cleared after they are no longer needed.

The element_ functions must be used with caution. Just as division by zero does not make sense for integers, some operations may not make sense for particular elements. For example, in a ring, one cannot in general invert elements.

Another caveat is that many of these functions assume their arguments come from the same ring, group or field. No implicit type casting is performed.

Because of the way PBC is designed, checking that elements from different algberaic structures have not been mistakenly mixed is not easy to do at compile-time. Instead, runtime checks are performed if PBC_DEBUG is defined before the PBC header file is included:

#define PBC_DEBUG
#include <pbc.h>

This feature impairs performance so should be disabled in the final build.