<commit_before>"""
This is an implementation of the Linear Fascicle Evaluation (LiFE) algorithm
described in:

<NAME>., <NAME>. and <NAME>. (2014). Validation
and statistical inference in living connectomes. Nature Methods

"""
import numpy as np
import scipy.sparse as sps
import scipy.linalg as la

from dipy.reconst.base import ReconstModel, ReconstFit
from dipy.core.onetime import ResetMixin, auto_attr
import dipy.core.sphere as dps
from dipy.tracking.utils import unique_rows, move_streamlines, transform_sl
import dipy.reconst.dti as dti
import dipy.sims.voxel as sims
from dipy.tracking.vox2track import _voxel2fiber
import dipy.data as dpd


def gradient(f, *varargs):
    """
    Return the gradient of an N-dimensional array.

    The gradient is computed using central differences in the interior
    and first differences at the boundaries. The returned gradient hence has
    the same shape as the input array.

    Parameters<commit_msg>DOC: More detail in the reference.<commit_after>"""
This is an implementation of the Linear Fascicle Evaluation (LiFE) algorithm
described in:

<NAME>., <NAME>. and <NAME>. (2014). Validation
and statistical inference in living connectomes. Nature Methods 11:
1058-1063. doi:10.1038/nmeth.3098
"""
import numpy as np
import scipy.sparse as sps
import scipy.linalg as la

from dipy.reconst.base import ReconstModel, ReconstFit
from dipy.core.onetime import ResetMixin, auto_attr
import dipy.core.sphere as dps
from dipy.tracking.utils import unique_rows, move_streamlines, transform_sl
import dipy.reconst.dti as dti
import dipy.sims.voxel as sims
from dipy.tracking.vox2track import _voxel2fiber
import dipy.data as dpd


def gradient(f, *varargs):
    """
    Return the gradient of an N-dimensional array.

    The gradient is computed using central differences in the interior
    and first differences at the boundaries. The returned gradient hence has
    the same shape as the input array.

    Parameters
{'fraction_non_alphanumeric': 0.06466395112016293, 'fraction_numerical': 0.016293279022403257, 'mean_word_length': 4.458333333333333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3998317', 'n_tokens_mistral': 622, 'n_tokens_neox': 571, 'n_words': 237}