cuex/monoid.h: Monoid Operations
[cuex: Expressions]

Data Structures

struct  cuex_monoid
struct  cuex_monoid_itr

Defines

#define CUEX_MONOID_END   CUEX_LTREE_END

Typedefs

typedef struct cuex_monoidcuex_monoid_t
typedef struct cuex_monoid_itr cuex_monoid_itr_t

Functions

cuoo_type_t cuex_monoid_type ()
cu_bool_t cuex_is_monoid_type (cuex_t t)
cu_bool_t cuex_is_monoid_meta (cuex_meta_t meta)
cu_bool_t cuex_is_any_monoid_nongen (cuex_t x)
cu_bool_t cuex_check_monoid (cuex_t x, cuex_meta_t *mult_out)
cuex_meta_t cuex_monoid_opr (cuex_t x)
cu_bool_t cuex_is_monoid_nongen (cuex_meta_t mult, cuex_t x)
cu_bool_t cuex_is_monoid_identity (cuex_meta_t mult, cuex_t x)
cu_bool_t cuex_is_monoid_composite (cuex_meta_t mult, cuex_t x)
cuex_t cuex_monoid_identity (cuex_meta_t mult)
cuex_t cuex_monoid_from_source (cuex_meta_t mult, cu_ptr_source_t source)
cuex_t cuex_monoid_from_array (cuex_meta_t mult, cuex_t *factor_arr, size_t factor_count)
cuex_t cuex_monoid_product (cuex_meta_t mult, cuex_t x, cuex_t y)
cuex_t cuex_monoid_rightmult (cuex_meta_t mult, cuex_t x, cuex_t y)
cuex_t cuex_monoid_rightmult_source (cuex_meta_t mult, cuex_t x, cu_ptr_source_t source)
cuex_t cuex_monoid_rightmult_array (cuex_meta_t mult, cuex_t x, cuex_t *array, size_t count)
size_t cuex_monoid_length (cuex_meta_t mult, cuex_t x)
cuex_t cuex_monoid_factor_at (cuex_meta_t mult, cuex_t x, ptrdiff_t i)
cuex_t cuex_monoid_factor_slice (cuex_meta_t mult, cuex_t x, ptrdiff_t i, ptrdiff_t j)
cu_ptr_source_t cuex_any_monoid_factor_source (cuex_t e, ptrdiff_t i, ptrdiff_t j)
void cuex_monoid_itr_init_full (cuex_meta_t mult, cuex_monoid_itr_t *itr, cuex_t x)
void cuex_monoid_itr_init_slice (cuex_meta_t mult, cuex_monoid_itr_t *itr, cuex_t x, ptrdiff_t i, ptrdiff_t j)
cuex_t cuex_monoid_itr_get (cuex_monoid_itr_t *itr)
cu_bool_t cuex_monoid_itr_is_end (cuex_monoid_itr_t *itr)

Variables

cuoo_type_t cuexP_monoid_type

Detailed Description

This compound expression type aids in manipulating expressions of associative operators by keeping them in a canonical form. It implements a free monoid where the generators are arbitrary expressions. Further degeneracies, including handling of variables is left the client.


Define Documentation

#define CUEX_MONOID_END   CUEX_LTREE_END

Special value for the end position of slicing operations to indicate slicing to the end.


Function Documentation

cu_ptr_source_t cuex_any_monoid_factor_source ( cuex_t  e,
ptrdiff_t  i,
ptrdiff_t  j 
)

Returns a source which provides the factors i inclusive to j exclusive in the factorisation of x with respect to mult.

cu_bool_t cuex_check_monoid ( cuex_t  x,
cuex_meta_t mult_out 
)

If x is a monoid (according to cuex_is_monoid_nongen), then set *mult_out to the exact operator and return true, else return false.

See also:
cuex_is_monoid_nongen
cuex_is_any_monoid_nongen
cu_bool_t cuex_is_any_monoid_nongen ( cuex_t  x  ) 

True iff a monoid under any operator contains x as a non-generator.

See also:
cuex_check_monoid
cuex_is_monoid_nongen
cu_bool_t cuex_is_monoid_composite ( cuex_meta_t  mult,
cuex_t  x 
)

True iff x is a composite element of the monoid under mult.

cu_bool_t cuex_is_monoid_identity ( cuex_meta_t  mult,
cuex_t  x 
)

True iff x is the identity element of the monoid under mult.

cu_bool_t cuex_is_monoid_meta ( cuex_meta_t  meta  ) 

True iff meta is the meta of a monoid element.

cu_bool_t cuex_is_monoid_nongen ( cuex_meta_t  mult,
cuex_t  x 
)

True iff x is a non-generator element of the monoid under mult. That is, if x is either the identity element or a composite element.

See also:
cuex_is_monoid_nongen
cuex_check_monoid
cu_bool_t cuex_is_monoid_type ( cuex_t  t  ) 

True iff t is the type of a monoid element.

cuex_t cuex_monoid_factor_at ( cuex_meta_t  mult,
cuex_t  x,
ptrdiff_t  i 
)

Factor number i (counting from 0) of the factorisation of x with respect to mult. If i is negative it's taken to be relative to just past the last factor of x.

Precondition:
Ni < N where N = cuex_monoid_length(mult, x)
cuex_t cuex_monoid_factor_slice ( cuex_meta_t  mult,
cuex_t  x,
ptrdiff_t  i,
ptrdiff_t  j 
)

The monoid of factors i inclusive to j exclusive of the factorisation of x, considering the operator mult.

Precondition:
ijcuex_monoid_length(mult, x)
cuex_t cuex_monoid_from_array ( cuex_meta_t  mult,
cuex_t factor_arr,
size_t  factor_count 
)

Returns a mult monoid element of factor_count factors from the array factor_arr.

cuex_t cuex_monoid_from_source ( cuex_meta_t  mult,
cu_ptr_source_t  source 
)

Returns the mult-product of factors drawn from source in order.

cuex_t cuex_monoid_identity ( cuex_meta_t  mult  ) 

The identity element of the monoid induced by mult. This is the same for both unnested or nested cases.

cuex_t cuex_monoid_itr_get ( cuex_monoid_itr_t itr  ) 

Pops the next expression off itr or returns NULL if itr is empty.

void cuex_monoid_itr_init_full ( cuex_meta_t  mult,
cuex_monoid_itr_t itr,
cuex_t  x 
)

Initialises itr for iterating over all mult-factors of x.

void cuex_monoid_itr_init_slice ( cuex_meta_t  mult,
cuex_monoid_itr_t itr,
cuex_t  x,
ptrdiff_t  i,
ptrdiff_t  j 
)

Initialises itr for iterating over mult-factors starting with number i and stopping at number j.

cu_bool_t cuex_monoid_itr_is_end ( cuex_monoid_itr_t itr  ) 

Checks if itr is empty without altering it.

size_t cuex_monoid_length ( cuex_meta_t  mult,
cuex_t  x 
)

The number of factors in the factorisation of x with respect to mult.

cuex_meta_t cuex_monoid_opr ( cuex_t  x  ) 

Provided x is a monoid, returns it's operator. Do not call this without checking if x is a monoid.

cuex_t cuex_monoid_product ( cuex_meta_t  mult,
cuex_t  x,
cuex_t  y 
)

Returns x * y, where * = mult.

cuex_t cuex_monoid_rightmult ( cuex_meta_t  mult,
cuex_t  x,
cuex_t  y 
)

Returns x * y, where * = mult and y is treated as a single factor. If y is itself a monoid, the result is a nested monoid.

cuex_t cuex_monoid_rightmult_array ( cuex_meta_t  mult,
cuex_t  x,
cuex_t array,
size_t  count 
)

The result of repeated application of cuex_monoid_rightmult, starting with x, for of the count expressions of the array as the last argument.

cuex_t cuex_monoid_rightmult_source ( cuex_meta_t  mult,
cuex_t  x,
cu_ptr_source_t  source 
)

The result of repeated application of cuex_monoid_rightmult, starting with x, for each expression drawn from source as the last argument.

cuoo_type_t cuex_monoid_type (  ) 

The object type of elements of monoid compounds.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.