Algorithm-RandomMatrixGeneration

 view release on metacpan or  search on metacpan

GPL.txt  view on Meta::CPAN

apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding

README  view on Meta::CPAN


        The algorithm we have used here: For each cell while traversing the
        matrix in in row-major interpretation. 1. Generate random number
        using the steps given below. 2. Reduce row and column marginals by
        value of generated value. End for. Done.

        Random number generation algorithm: for each cell C(i,j) { # Find
        the range (min, max) for the random number generation max =
        MIN(row_marg[i], col_marg[j])

            # If max !=0 then decide the min.
            # To decide min value sum together the col_marginals for all
            # the columns past the current column - this sum gives the total
            # of the column marginals yet to be satisfied beyond the current col.
            # Subtract this sum from the current row_marginal to compute
            # the lower bound on the random number. We do this because if we
            # do not set this lower bound and thus a number smaller than this
            # bound is generated then we will have a situation where satisfying
            # both row_marginal and column marginals will be impossible.

            if(max != 0)
            {

lib/Algorithm/RandomMatrixGeneration.pm  view on Meta::CPAN

			my $min = 0;
			if($max != 0)
			{
				# sum-up the col_marginals for all the columns beyond the current column
				$rem_col_marg = 0;
				for(my $k=$j+1; $k<=$m; $k++)
				{
					$rem_col_marg = $rem_col_marg + $tmp_cmar[$k];
				}
				
				# based on the row_marg and the sum_of_col_marg decide the value for min
				$min = $tmp_rmar[$i] - $rem_col_marg;

				if($signValues eq "positive")
				{
					if($min < 0)
					{
						$min = 0;
					}
				}
			}

lib/Algorithm/RandomMatrixGeneration.pm  view on Meta::CPAN

    2. Reduce row and column marginals by value of generated value.
End for.
Done.

Random number generation algorithm:
for each cell C(i,j)
{
    # Find the range (min, max) for the random number generation
    max = MIN(row_marg[i], col_marg[j])

    # If max !=0 then decide the min.
    # To decide min value sum together the col_marginals for all
    # the columns past the current column - this sum gives the total
    # of the column marginals yet to be satisfied beyond the current col.
    # Subtract this sum from the current row_marginal to compute
    # the lower bound on the random number. We do this because if we
    # do not set this lower bound and thus a number smaller than this
    # bound is generated then we will have a situation where satisfying
    # both row_marginal and column marginals will be impossible.

    if(max != 0)
    {



( run in 0.955 second using v1.01-cache-2.11-cpan-de7293f3b23 )