Difference between revisions of "Avengers"
(→Assignment 1) |
(→Bruno - Pythagorean Triples) |
||
Line 22: | Line 22: | ||
This algorithm (supposedly) calculates all Pythagorean triple (not primitive Pythagorean triples) values from initial values of the opposed side of a triangle. The algorithm needs some logical improvement to display only values from the starting range, these improvements should not be hard to implement but it still serves the purpose to calculate all Pythagorean triples from the simplest up to the maximum hypotenuse number given by the user. The code has been slightly modified to receive command line parameters, facilitating its execution on UNIX enviroments. | This algorithm (supposedly) calculates all Pythagorean triple (not primitive Pythagorean triples) values from initial values of the opposed side of a triangle. The algorithm needs some logical improvement to display only values from the starting range, these improvements should not be hard to implement but it still serves the purpose to calculate all Pythagorean triples from the simplest up to the maximum hypotenuse number given by the user. The code has been slightly modified to receive command line parameters, facilitating its execution on UNIX enviroments. | ||
+ | |||
+ | The flat profile generated by the program is as follows: | ||
+ | |||
+ | Flat profile: | ||
+ | |||
+ | Each sample counts as 0.01 seconds. | ||
+ | % cumulative self self total | ||
+ | time seconds seconds calls Ts/call Ts/call name | ||
+ | 97.67 5.98 5.98 Triangle::calculateDimensions(double, double, double, int) | ||
+ | 0.00 5.98 0.00 2842 0.00 0.00 Triangle::printDimensions(double, double, double) | ||
+ | 0.00 5.98 0.00 1 0.00 0.00 _GLOBAL__sub_I__ZN8TriangleC2Edddi | ||
+ | |||
+ | We can see that the function calculateDimensions, which is called only once is responsible for almost all of the execution time. | ||
[https://github.com/brucremo/DPS915 Code and Execution Instructions on GitHub] | [https://github.com/brucremo/DPS915 Code and Execution Instructions on GitHub] |
Revision as of 11:49, 15 February 2019
GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary
Contents
Team Avengers
Team Members
- Bruno Alexander Cremonese de Morais, Some responsibility
- Jaideep Sidhu, Some different responsibility
Progress
Assignment 1
Bruno - Pythagorean Triples
Pythagorean Triples by Violet_82
"A Pythagorean triple is a triple of positive integers a, b, and c such that a right triangle exists with legs a,b and hypotenuse c. By the Pythagorean theorem, this is equivalent to finding positive integers a, b, and c satisfying:
a^2+b^2=c^2.
The smallest and best-known Pythagorean triple is (a,b,c)=(3,4,5). The right triangle having these side lengths is sometimes called the 3, 4, 5 triangle. [...]
In addition, one side of every Pythagorean triple is divisible by 3, another by 4, and another by 5. One side may have two of these divisors, as in (8, 15, 17), (7, 24, 25), and (20, 21, 29), or even all three, as in (11, 60, 61)."
Weisstein, Eric W. "Pythagorean Triple." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/PythagoreanTriple.html
This algorithm (supposedly) calculates all Pythagorean triple (not primitive Pythagorean triples) values from initial values of the opposed side of a triangle. The algorithm needs some logical improvement to display only values from the starting range, these improvements should not be hard to implement but it still serves the purpose to calculate all Pythagorean triples from the simplest up to the maximum hypotenuse number given by the user. The code has been slightly modified to receive command line parameters, facilitating its execution on UNIX enviroments.
The flat profile generated by the program is as follows:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total time seconds seconds calls Ts/call Ts/call name 97.67 5.98 5.98 Triangle::calculateDimensions(double, double, double, int) 0.00 5.98 0.00 2842 0.00 0.00 Triangle::printDimensions(double, double, double) 0.00 5.98 0.00 1 0.00 0.00 _GLOBAL__sub_I__ZN8TriangleC2Edddi
We can see that the function calculateDimensions, which is called only once is responsible for almost all of the execution time.
Code and Execution Instructions on GitHub
Jaideep
Subject: