def broadcast_dimensions(argpairs, numblocks, sentinels=(1, (1,)), consolidate=None):
 L = concat([zip(inds, dims) for ((x, inds), (x, dims)) in join(first, argpairs, first, numblocks.items())])
 g = groupby(0, L)
 g = dict(((k, set([d for (i, d) in v])) for (k, v) in g.items()))
 g2 = dict(((k, ((v - set(sentinels)) if (len(v) > 1) else v)) for (k, v) in g.items()))
 if consolidate:
  return valmap(consolidate, g2)
 if (g2 and (not (set(map(len, g2.values())) == set([1])))):
  raise ValueError(('Shapes do not align %s' % g))
 return valmap(first, g2)

def broadcast_dimensions ( argpairs , numblocks , sentinels = ( 1 , ( 1 , ) ) , consolidate = None ) : L = concat ( [ zip ( inds , dims ) for ( ( x , inds ) , ( x , dims ) ) in join ( first , argpairs , first , numblocks . items ( ) ) ] ) g = groupby ( 0 , L ) g = dict ( ( ( k , set ( [ d for ( i , d ) in v ] ) ) for ( k , v ) in g . items ( ) ) ) g2 = dict ( ( ( k , ( ( v - set ( sentinels ) ) if ( len ( v ) > 1 ) else v ) ) for ( k , v ) in g . items ( ) ) ) if consolidate : return valmap ( consolidate , g2 ) if ( g2 and ( not ( set ( map ( len , g2 . values ( ) ) ) == set ( [ 1 ] ) ) ) ) : raise ValueError ( ( 'Shapes do not align %s' % g ) ) return valmap ( first , g2 )
find block dimensions from arguments parameters argpairs: iterable name .