def _get_legen_lut_fast(x, lut, block=None):
 n_interp = (lut.shape[0] - 1.0)
 mm = (x * (n_interp / 2.0))
 mm += (0.5 * n_interp)
 idx = np.round(mm).astype(int)
 if (block is None):
  vals = lut[idx]
 else:
  vals = lut[idx, :, block]
 return vals

def _get_legen_lut_fast ( x , lut , block = None ) : n_interp = ( lut . shape [ 0 ] - 1.0 ) mm = ( x * ( n_interp / 2.0 ) ) mm += ( 0.5 * n_interp ) idx = np . round ( mm ) . astype ( int ) if ( block is None ) : vals = lut [ idx ] else : vals = lut [ idx , : , block ] return vals
return legendre coefficients for given x values in -1<=x<=1 .