pairwise distribution function for 1D waves
tbk2109
function test_distribution_function()
wave test
make/o/n=(numpnts(test)^2), test_DF
variable i, j
for(i=0;i<numpnts(test);i+=1)
for(j=0;j<numpnts(test);j+=1)
test_df[i*numpnts(test)+j] = test[i] - test[j]
endfor
endfor
end
wave test
make/o/n=(numpnts(test)^2), test_DF
variable i, j
for(i=0;i<numpnts(test);i+=1)
for(j=0;j<numpnts(test);j+=1)
test_df[i*numpnts(test)+j] = test[i] - test[j]
endfor
endfor
end
Note that, despite my unfortunate naming choice, "test_DF" is not the actual distribution function. A histogram of test_DF gives the correct distribution function.
March 19, 2015 at 03:28 pm - Permalink
Without it I'd write something like
Make/O/N=128 test = p
variable numRows = numpnts(test)
Make/O/N=(numRows, numRows) test_DF = test[p] - test[q]
Redimension/N=(numRows * numRows) test_DF
end
March 20, 2015 at 02:32 am - Permalink