This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2017:discrete:projects:pnc0 [2017/08/15 19:57] – [sqrt()-less square root approximation (primerega)] wedge | haas:fall2017:discrete:projects:pnc0 [2017/10/15 21:11] (current) – [Programs] wedge | ||
---|---|---|---|
Line 3: | Line 3: | ||
< | < | ||
</ | </ | ||
- | |||
- | ~~TOC~~ | ||
======Project: | ======Project: | ||
Line 18: | Line 16: | ||
* 0.2: added an additional requirement to implementation constraints: | * 0.2: added an additional requirement to implementation constraints: | ||
* 0.3: added new check/ | * 0.3: added new check/ | ||
+ | * 0.4: added further explanation to " | ||
+ | * 0.5: for increased readability, | ||
* revision #: < | * revision #: < | ||
Line 228: | Line 228: | ||
It is your task to write the following prime number variants: | It is your task to write the following prime number variants: | ||
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
====Program Specifications==== | ====Program Specifications==== | ||
Line 354: | Line 354: | ||
The various " | The various " | ||
- | |||
- | The " | ||
- | * qtynorm: a normal quantity run (2-max) | ||
- | * ./primealg 2048 1 2 0 | ||
- | * qtypart: an offset quantity run (24-max) | ||
- | * ./primealg 2048 1 24 0 | ||
- | * rngnorm: a normal range run (2-max) | ||
- | * ./primealg 0 1 2 2048 | ||
- | * rngpart: an offset range run (24-max) | ||
- | * ./primealg 0 1 24 2048 | ||
- | * coop: both qty and upper bounds set (q: 2048, ub: 8192) | ||
- | * ./primealg 2048 1 2 8192 | ||
- | * coop2: | ||
- | * ./primealg 512 1 2 8192 | ||
- | * coop3: | ||
- | * ./primealg 2048 1 24 8192 | ||
- | * noargs: | ||
- | * ./primealg | ||
- | * invargs: insufficient number of arguments provided (invokes error) | ||
- | * ./primealg 128 | ||
- | * invqty: | ||
- | * ./primealg -2 1 | ||
- | * invnary: invalid value given for n-ary (invokes error) | ||
- | * ./primealg 128 2 | ||
- | * invlow: | ||
- | * ./primealg 128 1 1 | ||
- | * invhigh: invalid value given for upper bound (invokes error) | ||
- | * ./primealg 128 1 32 24 | ||
Just another "nice thing" we deserve. | Just another "nice thing" we deserve. | ||
=====Command-Line Arguments===== | =====Command-Line Arguments===== | ||
- | To automate our comparisons, | + | To automate our comparisons, |
====header files==== | ====header files==== | ||
Line 403: | Line 375: | ||
int main(int argc, char **argv) | int main(int argc, char **argv) | ||
</ | </ | ||
+ | |||
+ | There are two very important variables involved here (the types are actually what are important, the names given to the variables are actually quite, variable; you may see other references refer to them as things like " | ||
+ | |||
+ | * int argc: the count (an integer) of tokens given on the command line (program name + arguments) | ||
+ | * < | ||
The arguments are accessible via the argv array, in the order they were specified: | The arguments are accessible via the argv array, in the order they were specified: | ||
Line 411: | Line 388: | ||
* argv[3]: conditionally optional; represents lower bound | * argv[3]: conditionally optional; represents lower bound | ||
* argv[4]: conditionally optional; represents upper bound | * argv[4]: conditionally optional; represents upper bound | ||
+ | |||
+ | Additionally, | ||
+ | |||
+ | ===example=== | ||
+ | For example, if we were to execute the **primereg** program: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | We'd have: | ||
+ | |||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | |||
+ | and let's not forget: | ||
+ | |||
+ | * argc: 5 | ||
+ | |||
+ | With the conditionally optional arguments as part of the program spec, for a valid execution of the program, argc could be a value anywhere from 3 to 5. | ||
====Simple argument checks==== | ====Simple argument checks==== | ||
Line 726: | Line 726: | ||
</ | </ | ||
+ | ===verifyall tests=== | ||
+ | The " | ||
+ | * **qtynorm**: | ||
+ | * **./ | ||
+ | * **qtypart**: | ||
+ | * **./ | ||
+ | * **rngnorm**: | ||
+ | * **./ | ||
+ | * **rngpart**: | ||
+ | * **./ | ||
+ | * **coop**: both qty and upper bounds set (q: 2048, ub: 8192) | ||
+ | * **./ | ||
+ | * **coop2**: both qty and upper bounds set (q: 512, ub: 8192) | ||
+ | * **./ | ||
+ | * **coop3**: both qty and upper bounds set, offset start (24-max, q: 2048, ub: 8192) | ||
+ | * **./ | ||
+ | * **noargs**: | ||
+ | * **./ | ||
+ | * **invargs**: | ||
+ | * **./ | ||
+ | * **invqty**: invalid value for quantity argument given (invokes error) | ||
+ | * **./ | ||
+ | * **invnary**: | ||
+ | * **./ | ||
+ | * **invlow**: invalid value given for lower bound (invokes error) | ||
+ | * **./ | ||
+ | * **invhigh**: | ||
+ | * **./ | ||
+ | |||
+ | If you'd actually to see the output your program' | ||
+ | |||
+ | For example, if you wanted to see the intended output of the **invnary** test, that would be found in: | ||
+ | |||
+ | * **/ | ||
+ | |||
+ | You could easily run your program with the stated arguments for the test, then use **cat** to display the test results and do a visual comparison. | ||
====In general==== | ====In general==== | ||
Analyze the times you see... do they make sense, especially when comparing the algorithm used and the quantity being processed? These are related to some very important core Computer Science considerations we need to be increasingly mindful of as we design our programs and implement our solutions. Algorithmic complexity and algorithmic efficiency will be common themes in all we do. | Analyze the times you see... do they make sense, especially when comparing the algorithm used and the quantity being processed? These are related to some very important core Computer Science considerations we need to be increasingly mindful of as we design our programs and implement our solutions. Algorithmic complexity and algorithmic efficiency will be common themes in all we do. | ||
Line 787: | Line 823: | ||
====Evaluation Criteria==== | ====Evaluation Criteria==== | ||
- | What I will be looking for: | + | Grand total points: |
< | < | ||
390: | 390: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
- | *: | ||
</ | </ | ||
+ | |||
+ | What I will be looking for (for each file): | ||
+ | |||
+ | < | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | *: | ||
+ | </ | ||
+ | |||
+ | As the optimizations improve upon others, some evaluations will be based upon differences between a baseline (in some cases, primereg) and the optimization. |