1. 01 Jan, 2011 2 commits
    • Moe Jette's avatar
      Patch from Gerrit: 02_hostlist_get_base_depends_on_dims.diff · c029193b
      Moe Jette authored
      hostlist: let hostlist_get_base() depend on current dimensions
      
      This patch saves one call to slurmdb_setup_cluster_dims(): exploiting
      that the dimensions for which hostlist_get_base() is called are known
      in all contexts in which the function is used.
      c029193b
    • Moe Jette's avatar
      patch from Gerrit: 01_hostlist_parse_int_into_array.diff · 5d19de3b
      Moe Jette authored
      hostlist: shorter conversion
      
      This replaces the hostlist_parse_int_to_array() routine with a simpler and 
      equivalent routine. I was wondering what the algorithm does, when suddenly
      the flow became simpler.
      
      Problem: we want to create an array 'out' of 'dims' dimensions where
               out[i], 0 <= i < dims, has the coefficients a_j of the polynomial
      
      	 a_(dims-1) * B^(dims-1) + ... + a_1 * B + a_0
      
      	 where B is the base of the polynomial 'in' and
      	    a_0        = out[dims - 1]
      	    a_1        = out[dims - 2]
      	    ...
      	    a_(dims-1) = a[0]
      
      Using the Horner Scheme, 'in' is represented as
       * dims = 1:                                   a_0 = out[0]
       * dims = 2:                        a_1  * B + a_0 = out[0] * B + out[1]
       * dims = 3:            (a_2  * B + a_1) * B + a_0 
       * dims = 4: ((a_3 * B + a_2) * B + a_1) * B + a_0
         ...
       * dims = n: ((a_(n-1) * B + a_(n-2)) * B ... + a_1) * B + a_0
      
      We can get a_0 = out[dims-1] as "in % B" and then derive a_1, a_2, ... by
      first dividing by B, and then repeating the process.
      
      If in is 0, all 'dims' coefficients are 0, if it is negative, all coefficients
      are negative.
      5d19de3b
  2. 29 Dec, 2010 4 commits
  3. 28 Dec, 2010 15 commits
  4. 27 Dec, 2010 10 commits
  5. 22 Dec, 2010 9 commits