The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: Billy | November 7, 2010 @ 3:12pm
C++ Code
[
Download
]
//this is actually autocovariance float autocovariance(vector <vector<float> > &G, int h, float avg) { float ss = 0; //loop through the paths for(int i=0; i< G.size()-h; i++) { for(int j=0; j<G[i].size(); j++) { //ss = ss + (G[i][h+t] - avg) * (G[i][h] - avg); //cout << j << endl; //cout << (G[i+h][j] - avg) << endl; ss = ss + (G[i+h][j] - avg) * (G[i][j] - avg); } } ss = ss/(float)( (G.size()-h) * G[0].size() ); return ss; } float error(vector< vector<float> > &G, float avg) { float ss=0; /* for(int h=1; h<G.size(); h++) { ss = ss + autocorrelation(G, h, avg); } ss = 2*ss + autocorrelation(G, 0, avg); */ ss = autocovariance(G, 0, avg); //sqrt( abs(ss)/(float)(G.size() * G[0].size()) ); ss = sqrt(autocovariance(G, 0, avg)); return ss; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.52 / 8
42 Votes
http://codebin.yi.org/937
page generated in 0.01 seconds