Returns the indices lists corresponding to all the rows in order.
Generic combination function for factors.
Generic combination function for factors. By default, this is product, but other operations (such as divide that is a valid operation for some semirings) can use this
Fill the contents of this factor by applying a rule to every combination of values.
Returns the list of indices into the variable ranges associated with the first row in the factor.
Fold the given function through the contents of the factor, beginning with the given initial values
Get the value associated with a row.
Get the value associated with a row. The row is identified by an list of indices into the ranges of the variables over which the factor is defined.
Fill the contents of the target by applying the given function to all elements of this factor.
Returns the marginalization of the factor to a variable according to the given addition function.
Returns the marginalization of the factor to a variable according to the given addition function. This involves summing out all other variables.
Given a list of indices corresponding to a row in the factor, returns the list of indices corresponding to the next row.
Given a list of indices corresponding to a row in the factor, returns the list of indices corresponding to the next row. Returns None if the last index list has been reached.
Returns the product of this factor with another factor according to a given multiplication function.
Returns the product of this factor with another factor according to a given multiplication function. The product is associated with all variables in the two inputs, and the value associated with an assignment is the product of the values in the two inputs.
Returns a factor that maps values of the other variables to the value of the given variable that maximizes the entry associated with that value, according to some maximization function.
Returns a factor that maps values of the other variables to the value of the given variable that maximizes the entry associated with that value, according to some maximization function. comparator defines the maximization. It returns true iff its second argument is greater than its first.
The type of element whose value is being recorded. The resulting factor maps values of other variables in this factor to this type.
Set the value associated with a row.
Set the value associated with a row. The row is identified by an list of indices into the ranges of the variables over which the factor is defined.
Returns the summation of the factor over a variable according to an addition function.
Returns the summation of the factor over a variable according to an addition function. The result is associated with all the variables in the input except for the summed over variable and the value for a set of assignments is the sum of the values of the corresponding assignments in the input.
Produce a readable string representation of the factor
General class of factors. A factor is associated with a set of variables and specifies a value for every combination of assignments to those variables. Factors are parameterized by the types of values they contain.