Compute order corresponding to a given number of coefficients.

    Parameters
    ----------
    ncoef : int
        Number of coefficients.

    Returns
    -------
    order : int
        Order corresponding to the provided number of coefficients.
495116
def order_fmap(ncoef):
    

    loop = True
    order = 1
    while loop:
        loop = not (ncoef == ncoef_fmap(order))
        if loop:
            order += 1
            if order > NMAX_ORDER:
                print('No. of coefficients: ', ncoef)
                raise ValueError("order > " + str(NMAX_ORDER) +
                                 " not implemented")
    return order
1348414
def reading_order(e1, e2):
    
    b1 = e1.bbox
    b2 = e2.bbox
    if round(b1[y0]) == round(b2[y0]) or round(b1[y1]) == round(b2[y1]):
        return float_cmp(b1[x0], b2[x0])
    return float_cmp(b1[y0], b2[y0])
445130
public static Comparator<LongTuple> comparator(Order order)
    {
        if (order == Order.LEXICOGRAPHICAL)
        {
            return (t0, t1) -> compareLexicographically(t0, t1);
        }
        if (order == Order.COLEXICOGRAPHICAL)
        {
            return (t0, t1) -> compareColexicographically(t0, t1);
        }
        return null;
    }
1086200
def get_ordering_for_column(self, column, direction):
        
        if direction == 0:
            return ()
        if column in self.orderings:
            ordering = self.orderings[column]
        else:
            field = self.get_field(column)
            if field is None:
                return ()
            ordering = column
        if not isinstance(ordering, (tuple, list)):
            ordering = [ordering]
        if direction == 1:
            return ordering
        return [lookup[1:] if lookup[0] == '-' else '-' + lookup
                for lookup in ordering]
297346
def order_by(self, key):
        
        if key is None:
            raise NullArgumentError(u"No key for sorting given")
        kf = [OrderingDirection(key, reverse=False)]
        return SortedEnumerable3(kf, self._data)
53585
def calculate_columns(sequence):
    
    columns = {}

    for row in sequence:
        for key in row.keys():
            if key not in columns:
                columns[key] = len(key)

            value_length = len(str(row[key]))
            if value_length > columns[key]:
                columns[key] = value_length

    return columns
57921
def order_by_line_nos(objs, line_nos):
    
    ordering = sorted(range(len(line_nos)), key=line_nos.__getitem__)
    return [objs[i] for i in ordering]
138632
def oneCancelsAll(
            orders: List[Order], ocaGroup: str, ocaType: int) -> List[Order]:
        
        for o in orders:
            o.ocaGroup = ocaGroup
            o.ocaType = ocaType
        return orders
185035
def order(self, order):
        
        if order is None:
            raise ValueError("Invalid value for `order`, must not be `None`")
        allowed_values = ["ASC", "DESC"]
        if order not in allowed_values:
            raise ValueError(
                "Invalid value for `order` ({0}), must be one of {1}"
                .format(order, allowed_values)
            )

        self._order = order
443264
def f_df_nc(self,x):
        '''
        
        '''
        x = np.atleast_2d(x)
        xx = self.context_manager._expand_vector(x)
        f_nocontext_xx , df_nocontext_xx = self.f_df(xx)
        df_nocontext_xx = df_nocontext_xx[:,np.array(self.context_manager.noncontext_index)]
        return f_nocontext_xx, df_nocontext_xx
806943
def _get_dependency_order(g, node_list):
    """"""
    access_ = accessibility(g)
    deps = dict((k, set(v) - set([k])) for k, v in access_.iteritems())
    nodes = node_list + list(set(g.nodes()) - set(node_list))
    ordered_nodes = []

    while nodes:
        n_ = nodes[0]
        n_deps = deps.get(n_)
        if (n_ in ordered_nodes) or (n_deps is None):
            nodes = nodes[1:]
            continue

        moved = False
        for i, n in enumerate(nodes[1:]):
            if n in n_deps:
                nodes = [nodes[i + 1]] + nodes[:i + 1] + nodes[i + 2:]
                moved = True
                break

        if not moved:
            ordered_nodes.append(n_)
            nodes = nodes[1:]

    return ordered_nodes
941204
def order_table_columns(table: Table, column_names: list) -> Table:
    """"""

    unordered_columns = table.column_names
    index_order = (unordered_columns.index(name) for name in column_names)
    ordered_columns = [table.columns[i] for i in index_order]
    ordered_pkey_names = [column for column in column_names
                          if column in table.primary_key_columns]
    primary_key = PrimaryKey(ordered_pkey_names)

    return Table(table.name, ordered_columns, primary_key, table.schema)
1008361
def order_param(ts, axis=2):
    """"""
    return np.abs(np.exp(1.0j * ts).mean(axis=axis))
852681
def order_param(dts, axis=2):
    """"""
    return np.abs(np.exp(1.0j * dts).mean(axis=axis))
865013
def higher_order_diff(eqs, syms, order=2):
    ''''''

    import numpy

    eqs = list([sympy.sympify(eq) for eq in eqs])
    syms = list([sympy.sympify(s) for s in syms])

    neq = len(eqs)
    p = len(syms)

    D = [numpy.array(eqs)]
    orders = []

    for i in range(1,order+1):

        par = D[i-1]
        mat = numpy.empty([neq] + [p]*i, dtype=object)   #.append( numpy.zeros(orders))
        for ind in non_decreasing_series(p,i):

            ind_parent = ind[:-1]
            k = ind[-1]

            for line in range(neq):

                ii = [line] + ind
                iid = [line] + ind_parent
                eeq = par[ tuple(iid) ]
                mat[tuple(ii)] = eeq.diff(syms[k])

        D.append(mat)

    return D
458505
private static Sort first(String columnName, Sort.Order order) {
        return Sort.on(columnName, order);
    }
954994
def _ordered(generator, *args, **kwargs):
    """"""
    unordered_dict = {k: v for k, v in generator(*args, **kwargs)}
    keys = sorted(list(dict(unordered_dict).keys()))
    result = OrderedDict()
    for key in keys:
        result[key] = unordered_dict[key]

    return result