@ -527,29 +527,30 @@ module NonNegativeNonTopPolynomial = struct
degree . When calculating the degree , it ignores symbols of function pointer , so they are
degree . When calculating the degree , it ignores symbols of function pointer , so they are
addressed as if zero cost . * )
addressed as if zero cost . * )
let degree_with_term { poly ; autoreleasepool_trace } =
let degree_with_term { poly ; autoreleasepool_trace } =
let rec degree_with_term_poly ( { terms } as poly ) =
let rec degree_with_term_poly { const ; terms } =
if is_zero_degree_poly poly then ( Degree . zero , true , poly )
let degree_terms =
else
M . fold
M . fold
( fun t p cur_max ->
( fun t p cur_max ->
let degree_term =
match ( t , degree_with_term_poly p ) with
match ( t , degree_with_term_poly p ) with
(* It ignores function pointers when calculating degree of polynomial, since their
| NonNegativeBoundWithDegreeKind b , ( d , false , p' ) ->
semantics is different to the other symbolic values . For example , when a function
( Degree . succ ( NonNegativeBoundWithDegreeKind . degree_kind b ) d
has a complexity of | fptr | where fptr is a function pointer , it does not make sense
, false
to say the function has a linear complexity . * )
, mult_symb_poly p' t )
| FuncPtr _ , _ ->
| FuncPtr _ , ( _ , _ , p' ) | _ , ( _ , true , p' ) ->
cur_max
(* It ignores function pointers when calculating degree of polynomial, since their
| _ , ( _ , p' ) when is_zero_poly p' ->
semantics is different to the other symbolic values . For example , when a
cur_max
function has a complexity of | fptr | where fptr is a function pointer , it does
| NonNegativeBoundWithDegreeKind b , ( d , p' ) ->
not make sense to say the function has a linear complexity . * )
let d' = Degree . succ ( NonNegativeBoundWithDegreeKind . degree_kind b ) d in
( Degree . zero , true , mult_symb_poly p' t )
if Degree . compare d' ( fst cur_max ) > 0 then ( d' , mult_symb_poly p' t ) else cur_max
in
)
if [ % compare : Degree . t * bool * poly ] degree_term cur_max > 0 then degree_term
terms ( Degree . zero , zero_poly )
else cur_max )
in
terms ( Degree . zero , false , one_poly )
if is_zero_poly ( snd degree_terms ) then
if NonNegativeInt . is_zero const then ( Degree . zero , zero_poly ) else ( Degree . zero , one_poly )
else degree_terms
in
in
let d , _ , poly = degree_with_term_poly poly in
let d , poly = degree_with_term_poly poly in
( d , { poly ; autoreleasepool_trace } )
( d , { poly ; autoreleasepool_trace } )