Vector-Input-Friendly Kappa MEX Function

    I'd mentioned earlier today that I've rewritten the Matlab MEX Kappa function to take vector inputs for return threshold and Kappa order, and so I've decided to provide it freely as well.  As an example, here's a usage with the adjusted log-return distribution of the S&P 500 tracker SPY.

>> spy = price2ret(fts2mat(fund{spyID}.ts.Adj));
>> kappaCX(spy, -0.02:0.01:0.02, 1:3)
ans =
65.3488 8.4319 0.0157 -0.9023 -0.9839
9.7243 2.3936 0.0079 -0.6870 -0.8741
4.4595 1.3934 0.0056 -0.5720 -0.7959

    You can obtain the new Kappa Ratio function here.

    This has obvious advantages over the past methods when one desires a range of Kappa values over thresholds and returns, as memory usage and calculation expense can be dramatically minimized knowing this in advance.  With each Kappa curve in a row, the transpose of the resulting matrix is also perfectly suited to Matlab's plot function.

    The example above yields the Omega, Sortino, and Kappa-3 values at 5 return thresholds in less than five-thousandths of a second on an average modern laptop computer.  Based on a few quick parameter sweeps, I have estimated on a Core Duo T5450 that there is a constant time per element of the return matrix of just under 2.1 ten-thousandths of a second, meaning that for N return thresholds and M Kappa orders, you should get an upper bound on run time with M*N*2.1*10e-4.    This constant time should obviously vary with hardware, but these results show that this function is well-suited to high-precision Monte Carlo simulations on estimated parameter distributions.