#include "mdd.h" /* * MDD Package * * $Id: mdd_init.c,v 1.18 2005/05/14 17:30:52 fabio Exp $ * * Author: Timothy Kam * * Copyright 1992 by the Regents of the University of California. * * All rights reserved. Permission to use, copy, modify and distribute * this software is hereby granted, provided that the above copyright * notice and this permission notice appear in all copies. This software * is made available as is, with no warranties. */ int integer_get_num_of_digits(int value) { double x; int num_of_digits; if (value > 0) x = log10((double) value); else if (value == 0) x = 0; else fail("mdd_init: internal error, value less than 0\n"); /* * Notice that floor(x) return a double, * so it needs to be cast into an integer using * this following expression. */ num_of_digits = (int) floor(x) + 1; return num_of_digits; } static void mdd_name_variables( array_t *mvar_list, int no_mvars, array_t **mvar_names_ptr) { char *istr; int i; if (*mvar_names_ptr == NIL(array_t)) { /* if no variable names are given, use generic naming */ /* mv_0, mv_1, ... for variable 0, 1, ... */ *mvar_names_ptr = array_alloc(char *, 0); for (i=0; i mvar_list */ for (i=0; i 0) stride = array_fetch(int, mvar_strides, i); else stride = 1; for(j=0; jmvar_list = mvar_list; mdd_hook->bvar_list = bvar_list; /* if some array arguments are NIL */ no_mvars = array_n(mvar_values); free_mvar_names_flag = (mvar_names == NIL(array_t)); mdd_name_variables(mvar_list, no_mvars, &mvar_names); /* create mdd manager */ vertex_sum = 0; for (i=0; imdd = (char *) mdd_hook; current_vertex = 0; if (mvar_strides == NIL(array_t)) { /* if no strides are specified, the variables are not interleaved */ /* i.e. mvar_strides = 1 */ /* must set a flag to know that this array needs to be freed */ free_mvar_strides_flag = TRUE; mvar_strides = array_alloc(int, 0); for (i=0; i 1) { sec_bit_of_mv = mdd_ret_bvar(&after_mv, 1, bvar_list); sec_bit_level = bdd_top_var_level( mgr, sec_bit_of_mv.node ); /* first_bit_of_last_interleaved_mvar */ fol_id = bdd_get_id_from_level( mgr, sec_bit_level - 1 ); } else fol_id = mdd_ret_bvar_id(&after_mv, 0); fol_mv = array_fetch( mvar_type, mvar_list, fol_id ); after_bv_id = mdd_ret_bvar_id(&fol_mv, fol_mv.encode_length - 1); /* if some array arguments are NIL */ no_mvars = array_n(mvar_values); free_mvar_names_flag = (mvar_names == NIL(array_t)); mdd_name_variables(mvar_list, no_mvars, &mvar_names); if (mvar_strides == NIL(array_t)) { /* if no strides are specified, the variables are not interleaved */ /* i.e. mvar_strides = 1 */ /* must set a flag to know that this array needs to be freed */ free_mvar_strides_flag = TRUE; mvar_strides = array_alloc(int, 0); for (i=0; i