Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

create_partition3.m
% create_partition3.m - tests for solutions to a Diophantine Equation and writes
%               partitions to sequentialy-numbered .mat files.
%
%   NOTE: Currently limited to partitions of <= nmax.
%
%   Created by: J. Huntley,  10/24/11.
%

outfilename = 'partitionX';
nmin = 1;
nmax = 60;
n = nmin:nmax;

%Create and write partition files.
for jn = nmin:nmax
    jn
    % Find all Partitions of 'n'. Returned in cell array, "L".
    [L, callmax, a_new_hold, mult_new_hold] = partitioni8(jn);

    % Load Partitions from cell array, "L", into array 'pp'.
    sL1 = size(L,1)
    sL2 = size(L,2)
    for js = 1:sL2
        s2 = size(L{1,js},2);
        pp(js,1:s2) = int8(L{1,js});
    end
    
    %pp
    
    sa1 = size(a_new_hold,1)
    sa2 = size(a_new_hold,2)
    for js = 1:sa2
        s2 = size(a_new_hold{1,js},2);
        aa(js,1:s2) = int8(a_new_hold{js});
        mm(js,1:s2) = int8(mult_new_hold{js});
    end
    
    %aa 
    %mm
    cm = int8(callmax); 
    

    % 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));     
        end
    end

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


    

Contact us