algebramix_doc 0.3
|
00001 00002 #include <numerix/integer.hpp> 00003 #include <basix/vector.hpp> 00004 #include <basix/tuple.hpp> 00005 #include <basix/alias.hpp> 00006 #include <basix/glue.hpp> 00007 00008 namespace mmx { 00009 static vector<integer> 00010 GLUE_1 (const tuple<integer> &arg_1) { 00011 return vector<integer > (as_vector (arg_1)); 00012 } 00013 00014 static vector<integer> 00015 GLUE_2 (const tuple<integer> &arg_1) { 00016 return vector<integer > (as_vector (arg_1)); 00017 } 00018 00019 static iterator<generic> 00020 GLUE_3 (const vector<integer> &arg_1) { 00021 return as<iterator<generic> > (iterate (arg_1)); 00022 } 00023 00024 static int 00025 GLUE_4 (const vector<integer> &arg_1) { 00026 return N (arg_1); 00027 } 00028 00029 static integer 00030 GLUE_5 (const vector<integer> &arg_1, const int &arg_2) { 00031 return arg_1[arg_2]; 00032 } 00033 00034 static alias<integer> 00035 GLUE_6 (const alias<vector<integer> > &arg_1, const int &arg_2) { 00036 return alias_access<integer > (arg_1, arg_2); 00037 } 00038 00039 static vector<integer> 00040 GLUE_7 (const vector<integer> &arg_1, const int &arg_2, const int &arg_3) { 00041 return range (arg_1, arg_2, arg_3); 00042 } 00043 00044 static vector<integer> 00045 GLUE_8 (const vector<integer> &arg_1) { 00046 return reverse (arg_1); 00047 } 00048 00049 static vector<integer> 00050 GLUE_9 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00051 return append (arg_1, arg_2); 00052 } 00053 00054 static alias<vector<integer> > 00055 GLUE_10 (const alias<vector<integer> > &arg_1, const vector<integer> &arg_2) { 00056 return alias_write (arg_1, arg_2); 00057 } 00058 00059 static vector<integer> 00060 GLUE_11 (const integer &arg_1, const vector<integer> &arg_2) { 00061 return cons (arg_1, arg_2); 00062 } 00063 00064 static integer 00065 GLUE_12 (const vector<integer> &arg_1) { 00066 return car (arg_1); 00067 } 00068 00069 static vector<integer> 00070 GLUE_13 (const vector<integer> &arg_1) { 00071 return cdr (arg_1); 00072 } 00073 00074 static bool 00075 GLUE_14 (const vector<integer> &arg_1) { 00076 return is_nil (arg_1); 00077 } 00078 00079 static bool 00080 GLUE_15 (const vector<integer> &arg_1) { 00081 return is_atom (arg_1); 00082 } 00083 00084 static vector<integer> 00085 GLUE_16 (const vector<integer> &arg_1, const integer &arg_2) { 00086 return insert (arg_1, arg_2); 00087 } 00088 00089 static int 00090 GLUE_17 (const vector<integer> &arg_1, const integer &arg_2) { 00091 return find (arg_1, arg_2); 00092 } 00093 00094 static bool 00095 GLUE_18 (const vector<integer> &arg_1, const integer &arg_2) { 00096 return contains (arg_1, arg_2); 00097 } 00098 00099 static vector<integer> 00100 GLUE_19 (const vector<integer> &arg_1) { 00101 return -arg_1; 00102 } 00103 00104 static vector<integer> 00105 GLUE_20 (const vector<integer> &arg_1) { 00106 return square (arg_1); 00107 } 00108 00109 static vector<integer> 00110 GLUE_21 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00111 return arg_1 + arg_2; 00112 } 00113 00114 static vector<integer> 00115 GLUE_22 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00116 return arg_1 - arg_2; 00117 } 00118 00119 static vector<integer> 00120 GLUE_23 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00121 return arg_1 * arg_2; 00122 } 00123 00124 static vector<integer> 00125 GLUE_24 (const integer &arg_1, const vector<integer> &arg_2) { 00126 return arg_1 + arg_2; 00127 } 00128 00129 static vector<integer> 00130 GLUE_25 (const vector<integer> &arg_1, const integer &arg_2) { 00131 return arg_1 + arg_2; 00132 } 00133 00134 static vector<integer> 00135 GLUE_26 (const integer &arg_1, const vector<integer> &arg_2) { 00136 return arg_1 - arg_2; 00137 } 00138 00139 static vector<integer> 00140 GLUE_27 (const vector<integer> &arg_1, const integer &arg_2) { 00141 return arg_1 - arg_2; 00142 } 00143 00144 static vector<integer> 00145 GLUE_28 (const integer &arg_1, const vector<integer> &arg_2) { 00146 return arg_1 * arg_2; 00147 } 00148 00149 static vector<integer> 00150 GLUE_29 (const vector<integer> &arg_1, const integer &arg_2) { 00151 return arg_1 * arg_2; 00152 } 00153 00154 static integer 00155 GLUE_30 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00156 return dot (arg_1, arg_2); 00157 } 00158 00159 static integer 00160 GLUE_31 (const vector<integer> &arg_1) { 00161 return big_mul (arg_1); 00162 } 00163 00164 static integer 00165 GLUE_32 (const vector<integer> &arg_1) { 00166 return big_add (arg_1); 00167 } 00168 00169 static bool 00170 GLUE_33 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00171 return arg_1 <= arg_2; 00172 } 00173 00174 static bool 00175 GLUE_34 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00176 return arg_1 >= arg_2; 00177 } 00178 00179 static bool 00180 GLUE_35 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00181 return arg_1 < arg_2; 00182 } 00183 00184 static bool 00185 GLUE_36 (const vector<integer> &arg_1, const vector<integer> &arg_2) { 00186 return arg_1 > arg_2; 00187 } 00188 00189 static vector<generic> 00190 GLUE_37 (const vector<integer> &arg_1) { 00191 return as<vector<generic> > (arg_1); 00192 } 00193 00194 void 00195 glue_vector_integer () { 00196 static bool done = false; 00197 if (done) return; 00198 done = true; 00199 call_glue (string ("glue_integer")); 00200 call_glue (string ("glue_vector_generic")); 00201 define_type<vector<integer> > (gen (lit ("Vector"), lit ("Integer"))); 00202 define ("vector", GLUE_1); 00203 define ("[]", GLUE_2); 00204 define_converter (":>", GLUE_3, PENALTY_CAST); 00205 define ("#", GLUE_4); 00206 define (".[]", GLUE_5); 00207 define (".[]", GLUE_6); 00208 define (".[]", GLUE_7); 00209 define ("reverse", GLUE_8); 00210 define ("><", GLUE_9); 00211 define ("<<", GLUE_10); 00212 define ("cons", GLUE_11); 00213 define ("car", GLUE_12); 00214 define ("cdr", GLUE_13); 00215 define ("nil?", GLUE_14); 00216 define ("atom?", GLUE_15); 00217 define ("insert", GLUE_16); 00218 define ("find", GLUE_17); 00219 define ("contains?", GLUE_18); 00220 define ("-", GLUE_19); 00221 define ("square", GLUE_20); 00222 define ("+", GLUE_21); 00223 define ("-", GLUE_22); 00224 define ("*", GLUE_23); 00225 define ("+", GLUE_24); 00226 define ("+", GLUE_25); 00227 define ("-", GLUE_26); 00228 define ("-", GLUE_27); 00229 define ("*", GLUE_28); 00230 define ("*", GLUE_29); 00231 define ("dot", GLUE_30); 00232 define ("big_mul", GLUE_31); 00233 define ("big_add", GLUE_32); 00234 define ("<=", GLUE_33); 00235 define (">=", GLUE_34); 00236 define ("<", GLUE_35); 00237 define (">", GLUE_36); 00238 define_converter (":>", GLUE_37, PENALTY_PROMOTE_GENERIC); 00239 } 00240 }