semiring types & operations More...
Go to the source code of this file.
Data Structures | |
struct | gfsmSemiring |
struct to represent a builtin semi-ring for gfsm arc weights More... | |
struct | gfsmUserSemiring |
User-defined semirings for gfsm operations. More... |
Typedefs | |
typedef gboolean(* | gfsmSRUnaryPredicate )(gfsmSemiring *sr, gfsmWeight x) |
typedef gboolean(* | gfsmSRBinaryPredicate )(gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
Type for user-defined semiring binary predicates (i.e. equal) */. | |
typedef gfsmWeight(* | gfsmSRUnaryOp )(gfsmSemiring *sr, gfsmWeight x) |
Type for user-defined semiring unary operations */. | |
typedef gfsmWeight(* | gfsmSRBinaryOp )(gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
Type for user-defined semiring binary operations */. |
Enumerations | |
enum | gfsmSRType { gfsmSRTUnknown = 0, gfsmSRTBoolean = 1, gfsmSRTLog = 2, gfsmSRTReal = 3, gfsmSRTTrivial = 4, gfsmSRTTropical = 5, gfsmSRTPLog = 6, gfsmSRTArctic = 7, gfsmSRTFuzzy = 8, gfsmSRTProb = 9, gfsmSRTUser = 256 } |
Functions | |
Constructors etc. | |
static gfsmSemiring * | gfsm_semiring_new (gfsmSRType type) |
void | gfsm_semiring_init (gfsmSemiring *sr, gfsmSRType type) |
static gfsmUserSemiring * | gfsm_user_semiring_new (gfsmSRBinaryPredicate equal_func, gfsmSRBinaryPredicate less_func, gfsmSRBinaryOp plus_func, gfsmSRBinaryOp times_func) |
static gfsmSemiring * | gfsm_semiring_copy (gfsmSemiring *sr) |
static void | gfsm_semiring_free (gfsmSemiring *sr) |
String utilities | |
gfsmSRType | gfsm_sr_name_to_type (const char *name) |
gchar * | gfsm_sr_type_to_name (gfsmSRType type) |
General utilities | |
static gfsmWeight | gfsm_log_add (gfsmWeight x, gfsmWeight y) |
General Accessors & Operations | |
#define | GFSM_SR_STAR_N_DEFAULT 8 |
static gfsmSRType | gfsm_sr_type (const gfsmSemiring *sr) |
static gfsmWeight | gfsm_sr_zero (gfsmSemiring *sr) |
static gfsmWeight | gfsm_sr_one (gfsmSemiring *sr) |
static gboolean | gfsm_sr_equal (gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
static gboolean | gfsm_sr_less (gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
gint | gfsm_sr_compare (gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
static gfsmWeight | gfsm_sr_plus (gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
static gfsmWeight | gfsm_sr_times (gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
static gfsmWeight | gfsm_sr_inv_l (gfsmSemiring *sr, gfsmWeight x) |
static gfsmWeight | gfsm_sr_pow (gfsmSemiring *sr, gfsmWeight x, gfsmWeight n) |
gfsmWeight | gfsm_sr_pow_n (gfsmSemiring *sr, gfsmWeight x, gint n) |
static gfsmWeight | gfsm_sr_star (gfsmSemiring *sr, gfsmWeight x) |
gfsmWeight | gfsm_sr_star_n (gfsmSemiring *sr, gfsmWeight x, guint n) |
#define GFSM_SR_STAR_N_DEFAULT 8 |
star-closure: n-approximation
typedef gboolean(* gfsmSRUnaryPredicate)(gfsmSemiring *sr, gfsmWeight x) |
Type for user-defined semiring unary predicates (i.e. member)
typedef gboolean(* gfsmSRBinaryPredicate)(gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
typedef gfsmWeight(* gfsmSRUnaryOp)(gfsmSemiring *sr, gfsmWeight x) |
typedef gfsmWeight(* gfsmSRBinaryOp)(gfsmSemiring *sr, gfsmWeight x, gfsmWeight y) |
enum gfsmSRType |
Builtin semiring types
|
inlinestatic |
Create, initialize (for builtin types), and return new semiring of type type
void gfsm_semiring_init | ( | gfsmSemiring * | sr, |
gfsmSRType | type | ||
) |
Initialize and return a builtin semiring
|
inlinestatic |
Initialize and return a semiring
|
inlinestatic |
Copy a semiring
|
inlinestatic |
Destroy a gfsmSemiring
|
inlinestatic |
Get type of a gfsmSemiring sr; returns gfsmSRTUnknown for sr==NULL
|
inlinestatic |
Get 'zero' element of the gfsmSemiring* sr
|
inlinestatic |
Get 'one' element of the gfsmSemiring* sr
|
inlinestatic |
Check equality of elements x and y with respect to gfsmSemiring* sr
|
inlinestatic |
Check semiring element order
gint gfsm_sr_compare | ( | gfsmSemiring * | sr, |
gfsmWeight | x, | ||
gfsmWeight | y | ||
) |
3-way comparison for semiring values
|
inlinestatic |
Semiring addition
|
inlinestatic |
Semiring multiplication
|
inlinestatic |
Left-multiplication inverse: inv_l(x) s.t. inv_l(x)*x = x (not for all semirings)
|
inlinestatic |
Semiring power operation: x^0=1; x^(n+1)=(x^n)*x, (n a natural number)
gfsmWeight gfsm_sr_pow_n | ( | gfsmSemiring * | sr, |
gfsmWeight | x, | ||
gint | n | ||
) |
power operation: n-approximation
|
inlinestatic |
Semiring star-closure: x* = 1 + x + (x*x) + (x*x*x) + (x*x*x*x) + ...
gfsmWeight gfsm_sr_star_n | ( | gfsmSemiring * | sr, |
gfsmWeight | x, | ||
guint | n | ||
) |
gfsmSRType gfsm_sr_name_to_type | ( | const char * | name | ) |
Convert symbolic name of a semiring to a gfsmSRType
gchar* gfsm_sr_type_to_name | ( | gfsmSRType | type | ) |
Convert a gfsmSRType to a (constant) symbolic name
|
inlinestatic |
stable log addition.