def zero_one(val):
    return 1.0 if is_nonzero(val) else 0.0
Example #2
0
def zero_one(val):
    return 1.0 if is_nonzero(val) else 0.0
Example #3
0
def num_nonzero(coeffs):
    ''' Returns the total number of nonzero in the coefficients. '''
    return sum([1 for coeff_set in coeffs for coeff_line in coeff_set \
                  for coeff in coeff_line if gen.is_nonzero(coeff)])
Example #4
0
def num_nonzero(coeffs):
    ''' Returns the total number of nonzero in the coefficients. '''
    return sum([1 for coeff_set in coeffs for coeff_line in coeff_set \
                  for coeff in coeff_line if gen.is_nonzero(coeff)])