This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
N, L = 1e8, 10 | |
print("Here's your crappy estimation of pi: {}".format((sum(exp(-(random.rand(N)*2*L-L)**2))*2*L/N)**2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* I threw together this set of classes to work on Hackerrank's stuff at a fairly low level. Of | |
* course, you are provided with several libraries to do this for you, such as Weka, which makes | |
* life quite a bit easier than setting up your own feature matrix. But for those who want to | |
* have the simple stuff such as naive QR using Gram-Schmidt, back-substitution, and school-book | |
* matrix multiplication, this will work. Even for fairly large datasets within Hackerrank | |
* the performance is fast enough to give a very wide margin of extra time. Enjoy! | |
* | |
* Guille (@Guillean) | |
*/ |
NewerOlder