Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

% create_partition2.m - tests for solutions to a Diophantine Equation and writes
%               partitions to sequentialy-numbered .mat files.
%   NOTE: Currently limited to partitions of <= xmax.
%   Created by: J. Huntley,  03/23/09.

outfilename = 'partition';
xmin = 1;
xmax = 50;
x = xmin:xmax;

%Create and write partition files.
for jx = xmin:xmax
    % Find all Partitions of 'x'. Returned in cell array, "L".
    [L, callmax, a_new_hold, mult_new_hold] = partitioni8(jx);

    % Load Partitions from cell array, "L", into array 'pp'.
    sL = size(L,2)
    for js = 1:sL
        s = size(L{1,js},2);
        pp(js,1:s) = int8(L{1,js});


    % Construct occurances of each value in each partition in array, 'd'.
    % Array 'd' contains the solutions to the Diophantine Equation.
    spc = size(pp,2)
    spr = size(pp,1)
    for jr = 1:spr
        for jc = 1:spc
            d(jr,jc) = int8(size(find(pp(jr,1:spc) == jc),2));     

    % Save partition and frequency (Diophantine Solution) arrays to .mat
    % files.
    pname = [outfilename num2str(jx)]
    save(pname, 'pp', 'd')
    clear L callmax pp d a_new_hold mult_new_hold;


Contact us