Module: ZDD
- Defined in:
- ext/zdd_so/zdd_so.cpp
Class Method Summary collapse
-
.%(*args) ⇒ Object
##vsop_remainder##.
-
.*(*args) ⇒ Object
##vsop_multiply##.
-
.+(*args) ⇒ Object
##vsop_plus##.
-
.+@ ⇒ Object
##vsop_plus_op##.
-
.-(*args) ⇒ Object
##vsop_minus##.
-
.-@ ⇒ Object
##vsop_minus_op##.
-
./(*args) ⇒ Object
##vsop_quotiment##.
-
.<(*args) ⇒ Object
##vsop_lt##.
-
.<=(*args) ⇒ Object
##vsop_le##.
-
.==(*args) ⇒ Object
##vsop_eq##.
-
.===(*args) ⇒ Object
##vsop_same##.
-
.>(*args) ⇒ Object
##vsop_gt##.
-
.>=(*args) ⇒ Object
##vsop_ge##.
-
.coerce(*args) ⇒ Object
強制変換用.
-
.constant(*args) ⇒ Object
##vsop_constant##.
-
.cost ⇒ Object
##vsop_print_value##.
-
.count ⇒ Object
##vsop_print_count##.
-
.csvout(*args) ⇒ Object
##vsop_csvout##.
-
.delta(*args) ⇒ Object
##vsop_delta##.
-
.density ⇒ Object
##vsop_print_density##.
-
.diff?(*args) ⇒ Boolean
##vsop_diff##.
-
.each ⇒ Object
##vsop_each##.
-
.each_item ⇒ Object
##vsop_each_item##.
-
.export(*args) ⇒ Object
##vsop_print_export##.
-
.freqpatA(*args) ⇒ Object
##vsop_freqpatA##.
-
.freqpatC(*args) ⇒ Object
##vsop_freqpatC##.
-
.freqpatM(*args) ⇒ Object
##vsop_freqpatM##.
-
.hashout ⇒ Object
##vsop_hashout##.
-
.iif(*args) ⇒ Object
##vsop_iif##.
-
.import(*args) ⇒ Object
##vsop_import##.
-
.inspect ⇒ Object
##vsop_to_s##.
-
.items ⇒ Object
##vsop_items##.
-
.itemset(*args) ⇒ Object
##vsop_itemset##.
-
.lcm(*args) ⇒ Object
##vsop_lcm##.
-
.maxcost ⇒ Object
##vsop_print_maxcost##.
-
.maxcover ⇒ Object
##vsop_print_maxcover##.
-
.maxweight ⇒ Object
##vsop_maxval##.
-
.meet(*args) ⇒ Object
##vsop_meet##.
-
.mincost ⇒ Object
##vsop_print_mincost##.
-
.mincover ⇒ Object
##vsop_print_mincover##.
-
.minweight ⇒ Object
##vsop_minval##.
-
.ne?(*args) ⇒ Boolean
##vsop_ne##.
-
.partly ⇒ Object
##vsop_partly##.
-
.permit(*args) ⇒ Object
##vsop_permit##.
-
.permitsym(*args) ⇒ Object
##vsop_permitsym##.
-
.restrict(*args) ⇒ Object
##vsop_restrict##.
-
.same?(*args) ⇒ Boolean
##vsop_same##.
-
.show(*args) ⇒ Object
##vsop_show##.
-
.size ⇒ Object
##vsop_print_size##.
-
.symbol(*args) ⇒ Object
##vsop_symbol##.
-
.symgrp ⇒ Object
##vsop_symgrp##.
-
.termsEQ(*args) ⇒ Object
##vsop_termsEQ##.
-
.termsGE(*args) ⇒ Object
##vsop_termsGE##.
-
.termsGT(*args) ⇒ Object
##vsop_termsGT##.
-
.termsLE(*args) ⇒ Object
##vsop_termsLE##.
-
.termsLT(*args) ⇒ Object
##vsop_termsLT##.
-
.termsNE(*args) ⇒ Object
##vsop_termsNE##.
-
.to_a ⇒ Object
##vsop_to_a##.
-
.to_i ⇒ Object
##vsop_const_to_i##.
-
.to_s ⇒ Object
##vsop_to_s##.
-
.totalsize ⇒ Object
##vsop_print_totalsize##.
-
.totalweight ⇒ Object
##vsop_totalval##.
Class Method Details
.%(*args) ⇒ Object
##vsop_remainder##
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'ext/zdd_so/zdd_so.cpp', line 1087
VALUE vsop_remainder(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
if(*ctoi_modc == 0)
{
yyerror("<WARNING> Divide by zero");
*ctoi_moda = 0;
}
else *ctoi_moda = *ctoi_moda % *ctoi_modc;
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.*(*args) ⇒ Object
##vsop_multiply##
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'ext/zdd_so/zdd_so.cpp', line 1046
VALUE vsop_multiply(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = Product(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.+(*args) ⇒ Object
##vsop_plus##
862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 |
# File 'ext/zdd_so/zdd_so.cpp', line 862
VALUE vsop_plus(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = *ctoi_moda + *ctoi_modc;
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.+@ ⇒ Object
##vsop_plus_op##
849 850 851 852 853 854 855 856 857 858 859 |
# File 'ext/zdd_so/zdd_so.cpp', line 849
VALUE vsop_plus_op(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_modb =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
ctoi_fin = ctoi_modb;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.-(*args) ⇒ Object
##vsop_minus##
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
# File 'ext/zdd_so/zdd_so.cpp', line 880
VALUE vsop_minus(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = *ctoi_moda - *ctoi_modc;
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.-@ ⇒ Object
##vsop_minus_op##
835 836 837 838 839 840 841 842 843 844 845 846 |
# File 'ext/zdd_so/zdd_so.cpp', line 835
VALUE vsop_minus_op(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_modb =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
*ctoi_modb = - *ctoi_modb;
ctoi_fin = ctoi_modb;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
./(*args) ⇒ Object
##vsop_quotiment##
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File 'ext/zdd_so/zdd_so.cpp', line 1064
VALUE vsop_quotiment(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
if(*ctoi_modc == 0)
{
yyerror("<WARNING> Divide by zero");
*ctoi_moda = 0;
}
else *ctoi_moda = *ctoi_moda / *ctoi_modc;
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.<(*args) ⇒ Object
##vsop_lt##
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
# File 'ext/zdd_so/zdd_so.cpp', line 989
VALUE vsop_lt(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_LT(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.<=(*args) ⇒ Object
##vsop_le##
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
# File 'ext/zdd_so/zdd_so.cpp', line 1007
VALUE vsop_le(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_LE(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.==(*args) ⇒ Object
##vsop_eq##
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 |
# File 'ext/zdd_so/zdd_so.cpp', line 917
VALUE vsop_eq(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_EQ(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.===(*args) ⇒ Object
##vsop_same##
2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 |
# File 'ext/zdd_so/zdd_so.cpp', line 2741
VALUE vsop_same(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_modc = value2ctoi(v);
if ( *rmod->cmod == *ctoi_modc){
return Qtrue;
}
else{
return Qfalse;
}
}
|
.>(*args) ⇒ Object
##vsop_gt##
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
# File 'ext/zdd_so/zdd_so.cpp', line 953
VALUE vsop_gt(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_GT(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.>=(*args) ⇒ Object
##vsop_ge##
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
# File 'ext/zdd_so/zdd_so.cpp', line 971
VALUE vsop_ge(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_GE(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.coerce(*args) ⇒ Object
強制変換用
3151 3152 3153 3154 3155 3156 3157 3158 |
# File 'ext/zdd_so/zdd_so.cpp', line 3151
VALUE vsop_coerce(int argc, VALUE *argv, VALUE self){
VALUE v;
Vsop_Ruby* rmod=new Vsop_Ruby;
rb_scan_args(argc, argv,"10",&v);
rmod->cmod =value2ctoi(v);
VALUE rtn_v = Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod);
return rb_ary_new3(2,rtn_v,self);
}
|
.constant(*args) ⇒ Object
##vsop_constant##
2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 |
# File 'ext/zdd_so/zdd_so.cpp', line 2532
VALUE vsop_constant(int argc, VALUE *argv, VALUE self)
{
Vsop_Ruby* rmod=new Vsop_Ruby;
VALUE v;
//引数読み込み
rb_scan_args(argc, argv,"10",&v);
CtoI ctoitmp;
//定数FIXNUM
if(TYPE(v)==T_FIXNUM){
rmod->cmod = int2ctoi(FIX2INT(v));
}
//定数BIGNUM
else if(TYPE(v)==T_BIGNUM){
rmod->cmod = int2ctoi(NUM2INT(v));
}
else{
rb_raise(rb_eRuntimeError,"argument type error (arguments must be FIXNUM or BIGNUM)");
}
VALUE rtn = Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod);
return rtn;
}
|
.cost ⇒ Object
##vsop_print_value##
2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 |
# File 'ext/zdd_so/zdd_so.cpp', line 2837
VALUE vsop_print_value( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
if(OVF.Check()!= 0){
rb_raise(rb_eRuntimeError,"Bit overflow occurred");
}
VALUE rtn = rb_float_new((float)Value(*ctoitmp)/power16);
return rtn;
}
|
.count ⇒ Object
##vsop_print_count##
2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 |
# File 'ext/zdd_so/zdd_so.cpp', line 2790
VALUE vsop_print_count( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> CountTerms();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
rb_raise(rb_eRuntimeError,"06Memory overflow");
}
int slen = ctoitmp->TopDigit() / 3 + 14;
kgAutoPtr2<char> a_ptr;
char *s;
try{
a_ptr.set(new char[slen]);
s = a_ptr.get();
}catch(...){
rb_raise(rb_eRuntimeError,"memory allocation error");
}
ctoitmp -> StrNum10(s);
VALUE rtn = rb_cstr_to_inum(s, 10, Qfalse);
return rtn;
}
|
.csvout(*args) ⇒ Object
##vsop_csvout##
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 |
# File 'ext/zdd_so/zdd_so.cpp', line 1743
VALUE vsop_csvout(int argc, VALUE *argv, VALUE self) {
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
char *str = RSTRING_PTR(v);
ofstream fs;
fs.open(str);
if(fs.is_open()){
CsvoutCtoI(*rmod->cmod,fs);
fs.close();
}
else{
rb_raise(rb_eRuntimeError,"file oepn error");
}
return self;
}
|
.delta(*args) ⇒ Object
##vsop_delta##
2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 |
# File 'ext/zdd_so/zdd_so.cpp', line 2336
VALUE vsop_delta(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_Delta(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.density ⇒ Object
##vsop_print_density##
2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 |
# File 'ext/zdd_so/zdd_so.cpp', line 2816
VALUE vsop_print_density( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> NonZero();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
rb_raise(rb_eRuntimeError,"07Memory overflow");
}
int d = Density(ctoitmp -> GetZBDD(), VTable.Used());
if(d == 0 && *ctoitmp != 0){
rb_raise(rb_eRuntimeError,"Bit underflow occurred");
}
VALUE rtn = rb_float_new((float)d / power30);
return rtn;
}
|
.diff?(*args) ⇒ Boolean
##vsop_diff##
2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 |
# File 'ext/zdd_so/zdd_so.cpp', line 2757
VALUE vsop_diff(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_modc = value2ctoi(v);
if ( *rmod->cmod != *ctoi_modc){
return Qtrue;
}
else{
return Qfalse;
}
}
|
.each ⇒ Object
##vsop_each##
1972 1973 1974 1975 1976 1977 |
# File 'ext/zdd_so/zdd_so.cpp', line 1972
VALUE vsop_each(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI2Array_each(*rmod->cmod,self);
return Qtrue;
}
|
.each_item ⇒ Object
##vsop_each_item##
2277 2278 2279 2280 2281 2282 |
# File 'ext/zdd_so/zdd_so.cpp', line 2277
VALUE vsop_each_item(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI2ItemArray(*rmod->cmod,self);
return Qtrue;
}
|
.export(*args) ⇒ Object
##vsop_print_export##
3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 |
# File 'ext/zdd_so/zdd_so.cpp', line 3031
VALUE vsop_print_export(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
FILE *fp=NULL;
if(argc==1){
VALUE v1;
rb_scan_args(argc, argv,"0*",&v1);
if(TYPE(RARRAY_PTR(v1)[0])==T_STRING){
char *str = RSTRING_PTR(RARRAY_PTR(v1)[0]);
fp = fopen(str, "w");
if(fp == NULL){
rb_raise(rb_eRuntimeError,"Can't open the file");
}
}
else{
rb_raise(rb_eRuntimeError,"argument type error (1st argument must be STRING)");
}
}
else if(argc!=0){
rb_raise(rb_eRuntimeError,"number of argument is 0 or 1 ");
}
int d = ctoitmp -> TopDigit();
ZBDDV v = ZBDDV();
for(int i=0; i<=d; i++){
v += ZBDDV(ctoitmp -> Digit(i).GetZBDD(), i);
}
if(fp){
v.Export(fp);
fclose(fp);
}else{
v.Export();
}
return self;
}
|
.freqpatA(*args) ⇒ Object
##vsop_freqpatA##
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'ext/zdd_so/zdd_so.cpp', line 562
VALUE vsop_freqpatA(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FreqPatA(ctoi_modd->GetInt() );
//*ctoi_moda = ctoi_moda -> ReduceItems(ctoi_moda->TotalValItems().GE_Const(*ctoi_modd)).FreqPatA(ctoi_modd->GetInt());
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.freqpatC(*args) ⇒ Object
##vsop_freqpatC##
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 |
# File 'ext/zdd_so/zdd_so.cpp', line 599
VALUE vsop_freqpatC(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FreqPatC(ctoi_modd->GetInt() );
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.freqpatM(*args) ⇒ Object
##vsop_freqpatM##
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'ext/zdd_so/zdd_so.cpp', line 581
VALUE vsop_freqpatM(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FreqPatM(ctoi_modd->GetInt() );
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.hashout ⇒ Object
##vsop_hashout##
1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 |
# File 'ext/zdd_so/zdd_so.cpp', line 1879
VALUE vsop_hashout(VALUE self){
int rtnflg=0;
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
VALUE hash = HashoutCtoI(*rmod->cmod,&rtnflg);
if(rtnflg==2){
rb_iv_set(self,"@partly", Qtrue );
}
else{
rb_iv_set(self,"@partly", Qfalse);
}
return hash;
}
|
.iif(*args) ⇒ Object
##vsop_iif##
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'ext/zdd_so/zdd_so.cpp', line 1025
VALUE vsop_iif(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v1;
VALUE v2;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"20",&v1,&v2);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v1);
CtoI *ctoi_mode = value2ctoi(v2);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_ITE(*ctoi_moda, *ctoi_modc, *ctoi_mode);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
delete ctoi_mode;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.import(*args) ⇒ Object
##vsop_import##
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
# File 'ext/zdd_so/zdd_so.cpp', line 631
VALUE vsop_import(int argc, VALUE *argv, VALUE self){
VALUE v;
CtoI *ctoi_fin;
/*
VALUE vz = rb_cv_get(self,"@@init_cnt");
int init_cnt_v = NUM2INT(vz);
if(init_cnt_v==0){ BDDV_Init(256, env_nmax);}
init_cnt_v++;
rb_cv_set(self,"@@init_cnt",INT2NUM(init_cnt_v));
*/
if(init_cnt==0){ BDDV_Init(256, env_nmax);}
init_cnt++;
rb_scan_args(argc, argv,"10",&v);
if(TYPE(v)!=T_STRING){
rb_raise(rb_eRuntimeError,"argument type error (1st argument must be STRING)");
}
char *argtmp = RSTRING_PTR(v);
int len;
len = strlen(argtmp);
char *str_c = new char[len+3];
sprintf(str_c,"\"%s\"",argtmp);
int len_c = len+2;
str_c[len_c - 1] = 0;
FILE *fp;
fp = fopen(str_c+1, "r");
if(fp == NULL)
{
yyerror("Can't open the file");
ctoi_fin = new CtoI(0);
}
else
{
ZBDDV v = ZBDDV_Import(fp);
fclose(fp);
if(v != ZBDDV(-1))
{
int t = 1;
char s[32];
while(BDD_LevOfVar(v.Top()) > VTable.Used())
{
sprintf(s, "x%d", t);
while(VTable.GetID(s) != 0)
{
t++;
sprintf(s, "x%d", t);
}
VTable.SetT0(BDD_VarOfLev(t), s);
}
int len = v.Last()+1;
CtoI a = CtoI(0);
for(int i=0; i<len; i++)
a += CtoI(v.GetZBDD(i)).ShiftDigit(i);
ctoi_fin = new CtoI(a);
}
else
{
yyerror("<WARNING> import error");
ctoi_fin = new CtoI(0);
}
}
delete[] str_c;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.inspect ⇒ Object
##vsop_to_s##
2188 2189 2190 2191 2192 2193 |
# File 'ext/zdd_so/zdd_so.cpp', line 2188
VALUE vsop_to_s(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
VALUE str = CtoI2String(*rmod->cmod);
return str;
}
|
.items ⇒ Object
##vsop_items##
440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'ext/zdd_so/zdd_so.cpp', line 440
VALUE vsop_items(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> TotalValItems();
ctoi_fin = ctoi_moda;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.itemset(*args) ⇒ Object
##vsop_itemset##
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 |
# File 'ext/zdd_so/zdd_so.cpp', line 2498
VALUE vsop_itemset(int argc, VALUE *argv, VALUE self)
{
Vsop_Ruby* rmod=new Vsop_Ruby;
VALUE v;
//引数読み込み
rb_scan_args(argc, argv,"10",&v);
if(TYPE(v)!=T_STRING){
rb_raise(rb_eRuntimeError,"argument type error (arguments must be STRING)");
}
char *str = RSTRING_PTR(v);
if (*str =='\0'){
rmod->cmod = int2ctoi(1);
}
else{
rmod->cmod = string2ctoi(str);
}
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod);
}
|
.lcm(*args) ⇒ Object
##vsop_lcm##
2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 |
# File 'ext/zdd_so/zdd_so.cpp', line 2713
VALUE vsop_lcm(int argc, VALUE *argv, VALUE self)
{
VALUE rtnval;
if(argc==3){
rtnval = vsop_lcm_nomal(argc,argv,self);
}
else if(argc==4){
rtnval = vsop_lcm_order(argc,argv,self);
}
else if(argc==5){
VALUE v1,v2,v3,v4,v5;
rb_scan_args(argc, argv,"50",&v1,&v2,&v3,&v4,&v5);
if(TYPE(v4)!=T_STRING || strcmp(RSTRING_PTR(v4),"")==0 ){
rtnval = vsop_lcm_nomal_ub(v1,v2,v3,v5,self);
}
else{
rtnval = vsop_lcm_order_ub(v1,v2,v3,v4,v5,self);
}
}
else{
rb_raise(rb_eRuntimeError,"argument size error ");
}
return rtnval;
}
|
.maxcost ⇒ Object
##vsop_print_maxcost##
2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 |
# File 'ext/zdd_so/zdd_so.cpp', line 2903
VALUE vsop_print_maxcost( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> NonZero();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
rb_raise(rb_eRuntimeError,"09Memory overflow");
}
VALUE rtn;
if(*ctoitmp == 0){
rtn = Qnil;
}
else
{
int c = MaxCost(ctoitmp -> GetZBDD());
rtn = rb_float_new((float)c/power16);
}
return rtn;
}
|
.maxcover ⇒ Object
##vsop_print_maxcover##
2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 |
# File 'ext/zdd_so/zdd_so.cpp', line 2851
VALUE vsop_print_maxcover(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_fin;
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> NonZero();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
ctoi_fin = new CtoI(0);
rb_raise(rb_eRuntimeError,"08Memory overflow");
}
if(*ctoitmp == 0){
ctoi_fin = new CtoI(0);
}
else
{
ZBDD f = ctoitmp -> GetZBDD();
if(MaxCost(f)==0){
ctoi_fin = new CtoI(1);
}
else
{
CtoI ctmp(1);
while(1)
{
int var = f.Top();
if(var == 0) break;
ZBDD f0 = f.OffSet(var);
ZBDD f1 = f.OnSet0(var);
int c1 = MaxCost(f1) + VTable.GetValue(var);
if(MaxCost(f0) < c1)
{
f = f1;
ctmp = ctmp.AffixVar(var);
}
else f = f0;
}
ctoi_fin = new CtoI(ctmp);
}
}
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.maxweight ⇒ Object
##vsop_maxval##
333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'ext/zdd_so/zdd_so.cpp', line 333
VALUE vsop_maxval(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> MaxVal();
ctoi_fin = ctoi_moda;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.meet(*args) ⇒ Object
##vsop_meet##
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 |
# File 'ext/zdd_so/zdd_so.cpp', line 898
VALUE vsop_meet(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_Meet(*ctoi_moda, *ctoi_modc);
//*ctoi_moda = ZBDD_Meet(ctoi_moda->NonZero().GetZBDD(), ctoi_modc->NonZero().GetZBDD());
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.mincost ⇒ Object
##vsop_print_mincost##
2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 |
# File 'ext/zdd_so/zdd_so.cpp', line 2979
VALUE vsop_print_mincost( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> NonZero();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
rb_raise(rb_eRuntimeError,"11Memory overflow");
}
VALUE rtn;
if(*ctoitmp == 0){
rtn = Qnil;
}
else
{
int c = MinCost(ctoitmp -> GetZBDD());
rtn = rb_float_new((float)c/power16);
}
return rtn;
}
|
.mincover ⇒ Object
##vsop_print_mincover##
2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 |
# File 'ext/zdd_so/zdd_so.cpp', line 2928
VALUE vsop_print_mincover( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_fin;
auto_ptr<CtoI> auto_p(new CtoI(*rmod->cmod));
CtoI *ctoitmp = auto_p.get();
*ctoitmp = ctoitmp -> NonZero();
if(*ctoitmp == CtoI_Null())
{
*ctoitmp = 0;
ctoi_fin = new CtoI(0);
rb_raise(rb_eRuntimeError,"10Memory overflow");
}
if(*ctoitmp == 0){
ctoi_fin = new CtoI(0);
}
else
{
ZBDD f = ctoitmp -> GetZBDD();
if(MinCost(f)==0){
ctoi_fin = new CtoI(1);
}
else
{
CtoI ctmp(1);
while(1)
{
int var = f.Top();
if(var == 0) break;
ZBDD f0 = f.OffSet(var);
ZBDD f1 = f.OnSet0(var);
int c1 = MinCost(f1) + VTable.GetValue(var);
if(MinCost(f0) > c1)
{
f = f1;
ctmp = ctmp.AffixVar(var);
}
else f = f0;
}
ctoi_fin = new CtoI(ctmp);
}
}
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.minweight ⇒ Object
##vsop_minval##
347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'ext/zdd_so/zdd_so.cpp', line 347
VALUE vsop_minval(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> MinVal();
ctoi_fin = ctoi_moda;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.ne?(*args) ⇒ Boolean
##vsop_ne##
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 |
# File 'ext/zdd_so/zdd_so.cpp', line 935
VALUE vsop_ne(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modc = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = CtoI_NE(*ctoi_moda, *ctoi_modc);
ctoi_fin = ctoi_moda;
delete ctoi_modc;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.partly ⇒ Object
##vsop_partly##
3146 3147 3148 |
# File 'ext/zdd_so/zdd_so.cpp', line 3146 VALUE vsop_partly(VALUE self){ return rb_iv_get(self,"@partly"); } |
.permit(*args) ⇒ Object
##vsop_permit##
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'ext/zdd_so/zdd_so.cpp', line 404
VALUE vsop_permit(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterPermit(*ctoi_modd);
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.permitsym(*args) ⇒ Object
##vsop_permitsym##
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'ext/zdd_so/zdd_so.cpp', line 422
VALUE vsop_permitsym(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterPermitSym(ctoi_modd->GetInt());
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.restrict(*args) ⇒ Object
##vsop_restrict##
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'ext/zdd_so/zdd_so.cpp', line 386
VALUE vsop_restrict(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterRestrict(*ctoi_modd);
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.same?(*args) ⇒ Boolean
##vsop_same##
2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 |
# File 'ext/zdd_so/zdd_so.cpp', line 2741
VALUE vsop_same(int argc, VALUE *argv,VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_modc = value2ctoi(v);
if ( *rmod->cmod == *ctoi_modc){
return Qtrue;
}
else{
return Qfalse;
}
}
|
.show(*args) ⇒ Object
##vsop_show##
3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 |
# File 'ext/zdd_so/zdd_so.cpp', line 3092
VALUE vsop_show(int argc, VALUE *argv, VALUE self){
// bit,hex,map,rmap,case,decompのみ動くようにする
VALUE rtnval;
if(argc == 0){
rtnval = vsop_print(self);
}
else if(argc == 1) {
VALUE v;
rb_scan_args(argc, argv,"10",&v);
if(TYPE(v)!=T_STRING){
rb_raise(rb_eRuntimeError,"argument type error (1st argument must be STRING)");
}
char *argtmp = RSTRING_PTR(v);
for(size_t i=0;*show_use_para[i][0]!='\0';i++){
if( !strcmp(argtmp,show_use_para[i][0])||
!strcmp(argtmp,show_use_para[i][1])){
rtnval = vsop_print_arg1(self,show_use_para[i][0]);
return rtnval;
}
}
bool output = true;
for(const char *p=*show_notuse_para ;*p!='\0';p++){
if( !strcmp(argtmp,p)){
output=false;
break;
}
}
if(output){
rtnval = vsop_print_arg1(self,argtmp);
return rtnval;
}
rb_raise(rb_eRuntimeError,"Illegal switch(/bit,/hex,/map,/rmap,/case,/decomp)");
}
else if(argc == 2)
{
VALUE v1,v2;
rb_scan_args(argc, argv,"20",&v1,&v2);
char *argtmp = RSTRING_PTR(v1);
for(size_t i=0;*show_use_para[i][0]!='\0';i++){
if( !strcmp(argtmp,show_use_para[i][0])||
!strcmp(argtmp,show_use_para[i][1])){
rtnval = vsop_print_arg2(argc,argv,self);
return rtnval;
}
}
rb_raise(rb_eRuntimeError,"parameter error(/bit,/hex,/map,/rmap,/case,/decomp)");
}
else{
rb_raise(rb_eRuntimeError,"number of argument is 0 or 1 or 2");
}
return rtnval;
}
|
.size ⇒ Object
##vsop_print_size##
2773 2774 2775 2776 2777 2778 |
# File 'ext/zdd_so/zdd_so.cpp', line 2773
VALUE vsop_print_size( VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
int val = rmod->cmod->Size();
return INT2NUM(val);
}
|
.symbol(*args) ⇒ Object
##vsop_symbol##
2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 |
# File 'ext/zdd_so/zdd_so.cpp', line 2430
VALUE vsop_symbol(int argc, VALUE *argv, VALUE self)
{
//引数読み込み
VALUE rtn;
//初回呼び出し時のみBDDの初期化
if(init_cnt==0){ BDDV_Init(256, env_nmax);}
init_cnt++;
if(argc>=1){
int val=power16/2;
char *to ="bottom";
char *str;
VALUE v1,v2,v3;
rb_scan_args(argc, argv,"12",&v1,&v2,&v3);
switch(argc){
case 3:
if(TYPE(v3)!=T_STRING){
rb_raise(rb_eRuntimeError,"argument type error (arguments must be STRING)");
}
to = RSTRING_PTR(v3);
case 2:
if(TYPE(v2)==T_FLOAT){
val = (int)( NUM2DBL(v2)*power16);
}
else if(TYPE(v2)==T_FIXNUM){
val = NUM2INT(v2)*power16;
}
else if(TYPE(v2)==T_NIL){
}
else{
rb_raise(rb_eRuntimeError,"argument type error (arguments must be FLOAT or INT or NIL)");
}
case 1:
if(TYPE(v1)!=T_STRING){
rb_raise(rb_eRuntimeError,"argument type error (arguments must be STRING)");
}
str = RSTRING_PTR(v1);
//数値チェック(アイテムが数値なら警告)
if(env_warning){ num_check(str); }
break;
default:
rb_raise(rb_eRuntimeError,"argument type error");
break;
}
if(*str!='\0'){
int var = VTable.GetID(str);
if(var == 0){
if(!strcmp(to,"top")) { VTable.SetT(str, val);}
else { VTable.SetB(str, val);}
}
}
rtn = Qtrue;
}
else{
int n = VTable.Used();
string str ;
for(int i=n; i>0; i--)
{
int var = BDD_VarOfLev(i);
str += VTable.GetName(var);
str += " ";
}
rtn = rb_str_new2(str.c_str());
}
return rtn;
}
|
.symgrp ⇒ Object
##vsop_symgrp##
617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'ext/zdd_so/zdd_so.cpp', line 617
VALUE vsop_symgrp(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> NonZero().GetZBDD().SymGrp();
ctoi_fin = ctoi_moda;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsEQ(*args) ⇒ Object
##vsop_termsEQ##
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'ext/zdd_so/zdd_so.cpp', line 454
VALUE vsop_termsEQ(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> EQ_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsGE(*args) ⇒ Object
##vsop_termsGE##
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
# File 'ext/zdd_so/zdd_so.cpp', line 508
VALUE vsop_termsGE(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> GE_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsGT(*args) ⇒ Object
##vsop_termsGT##
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'ext/zdd_so/zdd_so.cpp', line 490
VALUE vsop_termsGT(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> GT_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsLE(*args) ⇒ Object
##vsop_termsLE##
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'ext/zdd_so/zdd_so.cpp', line 544
VALUE vsop_termsLE(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> LE_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsLT(*args) ⇒ Object
##vsop_termsLT##
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
# File 'ext/zdd_so/zdd_so.cpp', line 526
VALUE vsop_termsLT(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> LT_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.termsNE(*args) ⇒ Object
##vsop_termsNE##
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
# File 'ext/zdd_so/zdd_so.cpp', line 472
VALUE vsop_termsNE(int argc, VALUE *argv, VALUE self){
Vsop_Ruby* rmod;
VALUE v;
Data_Get_Struct(self,Vsop_Ruby,rmod);
rb_scan_args(argc, argv,"10",&v);
CtoI *ctoi_moda =new CtoI(*rmod->cmod);
CtoI *ctoi_modd = value2ctoi(v);
CtoI *ctoi_fin;
*ctoi_moda = ctoi_moda -> FilterThen(ctoi_moda -> NE_Const(ctoi_modd->GetInt()));
ctoi_fin = ctoi_moda;
delete ctoi_modd;
Vsop_Ruby *rmod_rtn = new Vsop_Ruby;
rmod_rtn->cmod = ctoi_fin;
return Data_Wrap_Struct(rb_class_of(self),0,free_rmod,rmod_rtn);
}
|
.to_a ⇒ Object
##vsop_to_a##
2093 2094 2095 2096 2097 2098 2099 |
# File 'ext/zdd_so/zdd_so.cpp', line 2093
VALUE vsop_to_a(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
VALUE array = CtoI2Array(*rmod->cmod);
return array;
}
|
.to_i ⇒ Object
##vsop_const_to_i##
3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 |
# File 'ext/zdd_so/zdd_so.cpp', line 3161
VALUE vsop_const_to_i(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI a = *(rmod->cmod);
if(a.IsConst()){
if(a.TopItem() > 0) a = a.MaxVal();
int d = a.TopDigit() / 3 + 14;
kgAutoPtr2<char> a_ptr;
char *s;
try{
a_ptr.set(new char[d]);
s = a_ptr.get();
}catch(...){
rb_raise(rb_eRuntimeError,"memory allocation error");
}
int err = a.StrNum10(s);
if (err) { rb_raise(rb_eRuntimeError,"StrNum10 error"); }
return rb_cstr2inum(s,10);
}else{
return Qnil;
}
}
|
.to_s ⇒ Object
##vsop_to_s##
2188 2189 2190 2191 2192 2193 |
# File 'ext/zdd_so/zdd_so.cpp', line 2188
VALUE vsop_to_s(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
VALUE str = CtoI2String(*rmod->cmod);
return str;
}
|
.totalsize ⇒ Object
##vsop_print_totalsize##
2781 2782 2783 2784 2785 2786 2787 |
# File 'ext/zdd_so/zdd_so.cpp', line 2781 VALUE vsop_print_totalsize(VALUE self){ rb_gc(); BDD_GC(); VALUE rtn = INT2NUM(BDD_Used()); return rtn; } |
.totalweight ⇒ Object
##vsop_totalval##
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'ext/zdd_so/zdd_so.cpp', line 361
VALUE vsop_totalval(VALUE self){
Vsop_Ruby* rmod;
Data_Get_Struct(self,Vsop_Ruby,rmod);
CtoI a = rmod->cmod->TotalVal();
if(a.IsConst())
{
if(a.TopItem() > 0) a = a.MaxVal();
int d = a.TopDigit() / 3 + 14;
kgAutoPtr2<char> a_ptr;
char *s;
try{
a_ptr.set(new char[d]);
s = a_ptr.get();
}catch(...){
rb_raise(rb_eRuntimeError,"memory allocation error");
}
int err = a.StrNum10(s);
if (err) { rb_raise(rb_eRuntimeError,"StrNum10 error"); }
return rb_cstr2inum(s,10);
}
return 0;
}
|