2.6.3 Spur Weight

Use the following functions to query or set spur weight denoted by W[i] in relative probability function formulas mentioned in Relative Probability Function Types.

Function: int qsmm_get_actor_spur_weight (qsmm_actor_t actor, int spur_type, double *weight_p)
Function: int qsmm_set_actor_spur_weight (qsmm_actor_t actor, int spur_type, double weight)

If weight_p is not NULL, qsmm_get_actor_spur_weight sets *weight_p equal to weight for a spur_type of an actor. The value of *weight_p obtained in this way is always finite. The function qsmm_set_actor_spur_weight sets weight for a spur_type of an actor to weight. Spur types have zero-based indices. If the actor is the large one, the functions query or set weight for a spur_type of a small actor associated with the large actor.

On success, the functions return a non-negative value. If weight is not finite (applicable only to qsmm_set_actor_spur_weight), or spur_type is negative or greater than or equal to the number of spur types specified in the field nspur of qsmm_actor_desc_s structure when creating the actor, the functions return negative error code QSMM_ERR_INVAL.

On creating a small actor, the function qsmm_actor_create initializes weights for all spur types of the small actor to 1. On creating a large actor, qsmm_actor_create initializes weights for all spur types of an associated small actor to 1 divided by the number of spur types specified in the field nspur of qsmm_actor_desc_s structure passed to qsmm_actor_create.