This file contains 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
/** | |
* This is the full example code for the StackOverflow answer here: http://stackoverflow.com/a/25339704/841830 | |
* | |
* @copyright Darren Cook, 2014. MIT License. | |
*/ | |
#include <stdio.h> | |
#include <iostream> | |
#include <future> | |
#include <random> |
This file contains 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
library(xts) | |
tmp1=dget("tmp1.txt") | |
tmp2=dget("tmp2.txt") | |
ccf(drop(tmp1),drop(tmp2)) #Weird? | |
tmp2=tail(tmp2,50) | |
tmp1=tail(tmp1,50) | |
ccf(drop(tmp1),drop(tmp2)) #Plausible | |
This file contains 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 <iostream> | |
#include <boost/tr1/random.hpp> | |
//#include <tr1/random.hpp> //If your compiler supports it | |
//#include <random> //If using c++11; then the "tr1::" prefixes can be removed. | |
using namespace std; | |
//Random number generator can be global. Use a mutex if program is multi-threaded. | |
tr1::mt19937 random_generator; |
This file contains 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 <boost/asio.hpp> | |
#include <boost/shared_ptr.hpp> | |
#include <boost/thread.hpp> | |
#include <boost/thread/mutex.hpp> | |
#include <boost/bind.hpp> | |
#include <iostream> | |
boost::mutex global_stream_lock; | |
void WorkerThread( boost::shared_ptr< boost::asio::io_service > io_service ) |
This file contains 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 <boost/asio.hpp> | |
#include <boost/shared_ptr.hpp> | |
#include <boost/thread.hpp> | |
#include <boost/thread/mutex.hpp> | |
#include <boost/bind.hpp> | |
#include <iostream> | |
boost::mutex global_stream_lock; | |
void WorkerThread( boost::shared_ptr< boost::asio::io_service > io_service ) |
This file contains 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 <boost/asio.hpp> | |
#include <boost/shared_ptr.hpp> | |
#include <boost/thread.hpp> | |
#include <boost/thread/mutex.hpp> | |
#include <boost/bind.hpp> | |
#include <iostream> | |
boost::mutex global_stream_lock; | |
void WorkerThread( boost::shared_ptr< boost::asio::io_service > io_service ) |