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
| #include <cstdint> // for std::uint32_t | |
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <iostream> // for std::cout, std::endl | |
| #define __AVX2_AVAILABLE__ | |
| #include "SIMDInstructionSet.h" | |
| #include "Xoshiro256Plus.h" | |
| namespace { | |
| inline double mcpi(); |
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
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <iostream> // for std::cout, std::endl | |
| #include <utility> // for std::make_pair, std::pair | |
| #define __AVX2_AVAILABLE__ | |
| #include "SIMDInstructionSet.h" | |
| #include "Xoshiro256Plus.h" | |
| namespace { | |
| inline double mcpi(); |
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
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <iostream> // for std::cout, std::endl | |
| #include <random> // for std::mt19937, std::uniform_real_distribution | |
| namespace { | |
| inline double mcpi(); | |
| } | |
| int main() |
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
| #include <cstdlib> // for std::rand, std::srand | |
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <iostream> // for std::cout, std::endl | |
| namespace { | |
| inline double mcpi(); | |
| } | |
| int main() |
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
| #include <cstdint> // for std::int32_t | |
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <iostream> // for std::cout, std::endl | |
| #include <utility> // for std::make_pair, std::pair | |
| #define USE_MOD 1 | |
| namespace { | |
| inline std::pair<std::int32_t, double> LCGs(std::int32_t seed); |
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
| #include <cstdint> // for std::int32_t | |
| #include <iomanip> // for std::setprecision | |
| #include <iostream> // for std::cout, std::endl | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield | |
| #include <utility> // for std::make_pair, std::pair | |
| #define USE_MOD 0 | |
| namespace { | |
| std::pair<std::int32_t, double> LCGs(std::int32_t seed); |
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
| program main | |
| implicit none | |
| real(8) :: x, v | |
| real(8),allocatable :: xt(:), vt(:) | |
| real(8) :: mass, k, dt | |
| integer :: i, it, nt, clock_rate | |
| integer, dimension(5) :: cp | |
| real(8) :: elapsed_time | |
| mass = 1d0 |
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
| #include <chrono> // for std::chrono | |
| #include <fstream> // for std::ofstream | |
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield, std::scientific | |
| #include <iostream> // for std::cout | |
| #include <utility> // for std::make_pair, std::pair | |
| #include <vector> // for std::vector | |
| namespace { | |
| std::pair<double, double> Runge_Kutta_4th(double x, double v, double dt, double mass, double k); |
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
| #include <chrono> // for std::chrono | |
| #include <fstream> // for std::ofstream | |
| #include <iomanip> // for std::setprecision | |
| #include <ios> // for std::ios::fixed, std::ios::floatfield, std::scientific | |
| #include <iostream> // for std::cout | |
| #include <utility> // for std::make_pair, std::pair | |
| #include <vector> // for std::vector | |
| namespace { | |
| std::pair<double, double> Runge_Kutta_4th(double x, double v, double dt, double mass, double k); |
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
| use std::fs::File; | |
| use std::io::Write; | |
| fn main() { | |
| let mass = 1.0; | |
| let k = 1.0; | |
| let dt = 1e-2; | |
| let nt = 100000000; | |
| let mut xt = vec![0.0; nt + 1]; |