Data Structures | Enumerations
gfsmArith.h File Reference

Arithmetic operations on automata. More...

#include <gfsmAutomaton.h>
Include dependency graph for gfsmArith.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfsmArithParams
 Type representing all parameters for a generic automaton arithmetic operation. More...

Enumerations

enum  gfsmArithOp {
  gfsmAONone, gfsmAOExp, gfsmAOLog, gfsmAONoNeg,
  gfsmAOAdd, gfsmAOMult, gfsmAOSRNoNeg, gfsmAOSRPlus,
  gfsmAOSRTimes
}

Functions

Arithmetic (Generic)
gfsmAutomatongfsm_automaton_arith (gfsmAutomaton *fsm, gfsmArithOp op, gfsmWeight arg, gfsmLabelVal lo, gfsmLabelVal hi, gboolean do_arcs, gboolean do_final, gboolean do_zero)
gfsmAutomatongfsm_automaton_arith_state (gfsmAutomaton *fsm, gfsmStateId qid, gfsmArithOp op, gfsmWeight arg, gfsmLabelVal lo, gfsmLabelVal hi, gboolean do_arcs, gboolean do_final, gboolean do_zero)
gfsmAutomatongfsm_automaton_arith_final (gfsmAutomaton *fsm, gfsmArithOp op, gfsmWeight arg, gboolean do_zero)
gfsmWeight gfsm_weight_arith (gfsmSemiring *sr, gfsmArithOp op, gfsmWeight w1, gfsmWeight w2, gboolean do_zero)

Detailed Description

Enumeration Type Documentation

Type representing an elementary arithmetic operation

Enumerator:
gfsmAONone 

No operation: w=w.

gfsmAOExp 

Real Exponentiation: w=exp(w)

gfsmAOLog 

Real Logarithm: w=log(w)

gfsmAONoNeg 

Real Force-positive: w=(w < 0 ? -w : w)

gfsmAOAdd 

Real Addition: w=w+arg.

gfsmAOMult 

Real Multiplication: w=w*arg.

gfsmAOSRNoNeg 

Semiring Force-positve: w=(sr_less(sr_zero,w) ? sr_zero : w)

gfsmAOSRPlus 

Semiring Addition: w=sr_plus(w,arg)

gfsmAOSRTimes 

Semiring Multiplication: w=sr_times(w,arg)

Function Documentation

gfsmAutomaton* gfsm_automaton_arith ( gfsmAutomaton fsm,
gfsmArithOp  op,
gfsmWeight  arg,
gfsmLabelVal  lo,
gfsmLabelVal  hi,
gboolean  do_arcs,
gboolean  do_final,
gboolean  do_zero 
)

Perform a generic arithmetic operation on fsm.

Note
Destructively alters fsm.
Parameters
fsmAutomaton
opOperation arg Argument of operation (if any)
loPerform only for arcs with lower label lo (gfsmNoLabel for any label)
hiPerform only for arcs with upper label hi (gfsmNoLabel for any label)
do_arcsPerform operation on arc weights
do_finalPerform operation on final weights
do_zeroPerform operation on zero weights
Returns
modified fsm
gfsmAutomaton* gfsm_automaton_arith_state ( gfsmAutomaton fsm,
gfsmStateId  qid,
gfsmArithOp  op,
gfsmWeight  arg,
gfsmLabelVal  lo,
gfsmLabelVal  hi,
gboolean  do_arcs,
gboolean  do_final,
gboolean  do_zero 
)

Perform a generic arithmetic operation on state qid in fsm.

Note
Destructively alters fsm.
Parameters
fsmAutomaton
qidState-id in fsm, or gfsmNoState for all states
opOperation arg Argument of operation (if any)
loPerform only for arcs with lower label lo (gfsmNoLabel for any label)
hiPerform only for arcs with upper label hi (gfsmNoLabel for any label)
do_arcsPerform operation on arc weights
do_finalPerform operation on final weights
do_zeroPerform operation on zero weights
Returns
modified fsm
gfsmAutomaton* gfsm_automaton_arith_final ( gfsmAutomaton fsm,
gfsmArithOp  op,
gfsmWeight  arg,
gboolean  do_zero 
)

Perform a generic arithmetic operation on final weights

Returns
params->fsm
gfsmWeight gfsm_weight_arith ( gfsmSemiring sr,
gfsmArithOp  op,
gfsmWeight  w1,
gfsmWeight  w2,
gboolean  do_zero 
)

Perform a generic arithmetic operation on a gfsmWeight.

Returns
result of operation