Changeset 0e5a3e in git for Singular/extra.cc
 Timestamp:
 Nov 18, 2009, 3:12:50 PM (14 years ago)
 Branches:
 (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
 Children:
 d1b6cc519b995304348ae07c8a484766256489bb
 Parents:
 d9a6917b7a111a27193ad7f5c53145b48dcaf51c
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/extra.cc
rd9a691 r0e5a3e 159 159 //#include <python_wrapper.h> 160 160 #endif 161 162 #ifdef HAVE_MINOR163 #include "TestMinors.h" // for testing new minor code164 #endif // HAVE_MINOR165 166 #ifdef HAVE_WRAPPERS167 #include "Wrappers.h" // for testing C++ wrappers168 #endif // HAVE_WRAPPERS169 170 161 171 162 void piShowProcList(); … … 2102 2093 else 2103 2094 #endif 2104 /*==================== C++ wrappers ========================*/2105 #ifdef HAVE_WRAPPERS2106 if(strcmp(sys_cmd,"c++wrappers")==0)2107 {2108 if (h == NULL) testWrappers(FALSE); /* wrapper tests, without detailed printout */2109 else if (h>Typ() == INT_CMD)2110 {2111 const int detailedOutput = (const int)(long)h>Data();2112 testWrappers(detailedOutput == 0 ? FALSE : TRUE);2113 /* wrapper tests, with or without detailed printout */2114 }2115 else if ((h>Typ() == POLY_CMD) &&2116 (h>next>Typ() == POLY_CMD))2117 {2118 const poly& p1 = (const poly)h>Data();2119 const poly& p2 = (const poly)h>next>Data();2120 wrapSINGULARPolys(p1, p2);2121 /* wraps the given polys (as elements of the current ring)2122 and displays the created instances of PolyWrapper, then2123 their sum is computed as an instance of PolyWrapper and2124 also displayed */2125 }2126 return FALSE;2127 }2128 else2129 #endif2130 /* HAVE_WRAPPERS */2131 /*==================== new minor code ========================*/2132 #ifdef HAVE_MINOR2133 if(strcmp(sys_cmd,"minors")==0)2134 {2135 if (h == NULL) minorUsageInfo(); /* writes some info to the console2136 on how to use this experimental code */2137 else if (h>Typ() == INT_CMD)2138 {2139 testIntMinors(0); /* no arguments provided:2140 this starts 5 default tests2141 with a random matrix with2142 integer entries;2143 for that, no ring needs to be2144 declared beforehand */2145 }2146 else if ((h>Typ() == MATRIX_CMD) &&2147 (h>next>Typ() == INT_CMD) &&2148 (h>next>next>Typ() == INT_CMD) &&2149 (h>next>next>next>Typ() == INT_CMD) &&2150 (h>next>next>next>next>Typ() == INT_CMD) &&2151 (h>next>next>next>next>next == NULL))2152 {2153 const matrix m = (const matrix)h>Data();2154 const int k = (const int)(long)h>next>Data();2155 const int strategy = (const int)(long)h>next>next>Data();2156 const int cacheEntries = (const int)(long)h>next>next>next>Data();2157 const int cacheWeight = (const int)(long)h>next>next>next>next>Data();2158 ideal iii = testAllPolyMinorsAsIdeal(m, k, strategy, cacheEntries, cacheWeight);2159 /* starts the computation of all (k x k)minors in the2160 provided matrix m (which is assumed to have polynomial2161 entries);2162 when calling this method, a ring must have been declared before;2163 there will be one run using a cache with specified properties */2164 res>rtyp = IDEAL_CMD;2165 res>data = iii;2166 }2167 else if ((h>Typ() == MATRIX_CMD) &&2168 (h>next>Typ() == INT_CMD) &&2169 (h>next>next>Typ() == INT_CMD) &&2170 (h>next>next>next>Typ() == INT_CMD) &&2171 (h>next>next>next>next>Typ() == INT_CMD) &&2172 (h>next>next>next>next>next>Typ() == INT_CMD) &&2173 (h>next>next>next>next>next>next == NULL))2174 {2175 const matrix m = (const matrix)h>Data();2176 const int k = (const int)(long)h>next>Data();2177 const int strategy = (const int)(long)h>next>next>Data();2178 const int cacheEntries = (const int)(long)h>next>next>next>Data();2179 const int cacheWeight = (const int)(long)h>next>next>next>next>Data();2180 const int characteristic = (const int)(long)h>next>next>next>next>next>Data();2181 ideal iii = testAllIntMinorsAsIdeal(m, k, strategy, cacheEntries, cacheWeight, characteristic);2182 /* starts the computation of all (k x k)minors in the2183 provided matrix m (which is assumed to have integer2184 entries);2185 when calling this method, a ring must have been declared before;2186 there will be one run using a cache with specified properties;2187 the resulting minors will be computed modulo the given characteristic */2188 res>rtyp = IDEAL_CMD;2189 res>data = iii;2190 }2191 else if ((h>Typ() == MATRIX_CMD) &&2192 (h>next>Typ() == INT_CMD) &&2193 (h>next>next>Typ() == INT_CMD) &&2194 (h>next>next>next>Typ() == INT_CMD) &&2195 (h>next>next>next>next>Typ() == INT_CMD) &&2196 (h>next>next>next>next>next>Typ() == INT_CMD) &&2197 (h>next>next>next>next>next>next>Typ() == INT_CMD) &&2198 (h>next>next>next>next>next>next>next>Typ() == INT_CMD) &&2199 (h>next>next>next>next>next>next>next>next>Typ() == INT_CMD) &&2200 (h>next>next>next>next>next>next>next>next>next == NULL))2201 {2202 const matrix m = (const matrix)h>Data();2203 const int k = (const int)(long)h>next>Data();2204 const int strategies = (const int)(long)h>next>next>Data();2205 const int cacheEntries = (const int)(long)h>next>next>next>Data();2206 const int cacheWeight = (const int)(long)h>next>next>next>next>Data();2207 const int dumpMinors = (const int)(long)h>next>next>next>next>next>Data();2208 const int dumpResults = (const int)(long)h>next>next>next>next>next>next>Data();2209 const int dumpComplete = (const int)(long)h>next>next>next>next>next>next>next>Data();2210 const int dumpConsole = (const int)(long)h>next>next>next>next>next>next>next>next>Data();2211 testAllPolyMinors(m, k, strategies, cacheEntries, cacheWeight, dumpMinors, dumpResults, dumpComplete, dumpConsole);2212 /* starts the computation of all (k x k)minors in the2213 provided matrix m (which is assumed to have polynomial2214 entries) using a cache with a maximum number of2215 'cacheEntries' entries and a maximum weight of 'cacheWeight'2216 (The weight is the number of cached monomials, counted over2217 all cached polynomials.);2218 when calling this method, a ring must have been declared before;2219 strategy = "310" means that the code is run first without a2220 cache ("0") and then afterwards with the caching strategies2221 "1" and "3" */2222 }2223 else if (h>Typ() == POLY_CMD)2224 { /* for quick tests with a single polynomial */2225 const poly p = (const poly)h>Data();2226 testStuff(p);2227 }2228 return FALSE;2229 }2230 else2231 if(strcmp(sys_cmd,"changeRing")==0)2232 {2233 if ((h>Typ() == INT_CMD) &&2234 (h>next>Typ() == INT_CMD))2235 {2236 const int fc = (const int)(long)h>Data();2237 const int varN = (const int)(long)h>next>Data();2238 {2239 /* The following code creates and returns a ring with characteristic fc,2240 order dp and varN variables with the names "x1", "x2", ..., "x4711"2241 (in the case varN = 4711).2242 The purpose of this rewriting is to eliminate indexed variables,2243 as they may cause problems when generating scripts for Magma,2244 Maple, or Macaulay2. */2245 ring newRing = (ring) omAlloc0Bin(sip_sring_bin);2246 newRing>ch = fc;2247 newRing>N = varN;2248 char h[10];2249 newRing>names = (char **) omAlloc0(varN * sizeof(char_ptr));2250 for (int i = 1; i <= varN; i++)2251 {2252 sprintf(h, "x%d", i);2253 newRing>names[i  1] = omStrDup(h);2254 }2255 newRing>wvhdl = (int **)omAlloc0(2 * sizeof(int_ptr));2256 newRing>order = (int *)omAlloc(2* sizeof(int *));2257 newRing>block0 = (int *)omAlloc0(2 * sizeof(int *));2258 newRing>block1 = (int *)omAlloc0(2 * sizeof(int *));2259 newRing>order[0] = ringorder_dp;2260 newRing>block0[0] = 1;2261 newRing>block1[0] = varN;2262 newRing>order[1] = 0;2263 newRing>OrdSgn = 1;2264 rComplete(newRing);2265 res>rtyp = RING_CMD;2266 res>data = (void *)newRing;2267 return FALSE;2268 }2269 }2270 }2271 else2272 #endif2273 /* HAVE_MINOR */2274 2095 /*==================== generic debug ==================================*/ 2275 2096 #ifdef PDEBUG
Note: See TracChangeset
for help on using the changeset viewer.