<commit_before># coding: utf-8
# cython: boundscheck=False
# cython: nonecheck=False
# cython: cdivision=True
# cython: wraparound=False
# cython: profile=False

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Third-party
import numpy as np
cimport numpy as np
np.import_array()
import cython
cimport cython

# Project
from .core import PotentialBase, CompositePotential
from ..util import atleast_2d

cdef extern from "math.h":
    double sqrt(double x) nogil
    double fabs(double x) nogil

cdef extern from "stdint.h":
    ctypedef int intptr_t

class CPotentialBase(PotentialBase):
    """
    A base class for representing gravitational potentials with
    value, gradient, etc. functions implemented in C.

    TODO: better description here
    """

    def _value(self, q, t=0.):
        sh = q.shape
        q = np.ascontiguousarray(q.reshape(sh[0],np.prod(sh[1:])).T)
        return self.c_instance.value(q, t=t).reshape(sh[1:])

    def _gradient(self, q, t=0.):<commit_msg>define __all_ so hopefully atleast2d goes away<commit_after># coding: utf-8
# cython: boundscheck=False
# cython: nonecheck=False
# cython: cdivision=True
# cython: wraparound=False
# cython: profile=False

from __future__ import division, print_function

__author__ = "adrn <<EMAIL>>"

# Third-party
import numpy as np
cimport numpy as np
np.import_array()
import cython
cimport cython

# Project
from .core import PotentialBase, CompositePotential
from ..util import atleast_2d

cdef extern from "math.h":
    double sqrt(double x) nogil
    double fabs(double x) nogil

cdef extern from "stdint.h":
    ctypedef int intptr_t

__all__ = ['CPotentialBase']

class CPotentialBase(PotentialBase):
    """
    A base class for representing gravitational potentials with
    value, gradient, etc. functions implemented in C.

    TODO: better description here
    """

    def _value(self, q, t=0.):
        sh = q.shape
        q = np.ascontiguousarray(q.reshape(sh[0],np.prod(sh[1:])).T)
        return self.c_instance.value(q, t=t).reshape(sh[1:])

    def _gradient(self, q, t=0.):
{'fraction_non_alphanumeric': 0.10709186101856259, 'fraction_numerical': 0.007139457401237506, 'mean_word_length': 3.992874109263658, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7633153', 'n_tokens_mistral': 731, 'n_tokens_neox': 709, 'n_words': 207}