def meantensor(sample, normalized=False):
    """Estimates the mean tensor :math:`\\boldsymbol{k}` of a randomly chosen
    sample of :math:`n` specimens by using the equation (11) of
    `Jelínek (1978) <https://doi.org/10.1007/BF01613632>`_ after being
    normalized the specimens through the ``normalizeTensors`` function.

    Parameters:
        sample (`numpy.ndarray`): :math:`(n \\times 6)` array that
            contains the values of the tensors after being imported with the
            ``extractdata`` function.
        normalize (`bool`): Logical variable to indicate if the tensors in
            the ``sample`` variable are already normalized by using the
            equation (11) of
            (`Jelínek (1978) <https://doi.org/10.1007/BF01613632>`_). ``False``
            is the default value. In the case they are not normalized,
            they will be.

    Returns:
        Three elements are returned; they are described below.

            - **meanTensorVect** (`numpy.ndarray`): Mean tensor in vector                form.
            - **meanTensorMtx** (`numpy.ndarray`): Mean tensor in matrix                form.
            - **numTensors** (`int`): Number of tensors.

    Examples:
        >>> from jelinekstat.tools import dataFromFile
        >>> from jelinekstat.jelinekstat import meantensor
        >>> sample, numTensors = dataFromFile('inputDataExample.txt')
        >>> meanTensorVect, meanTensorMtx, numTensors = meantensor(
                sample, normalized=False)
        >>> meanTensorVect
        array([ 1.02533293,  1.01891542,  0.95575165, -0.01714126, -0.03435001,
        >>>    -0.03794001])
        >>> meanTensorMtx
        array([[ 1.02533293, -0.01714126, -0.03794001],
               [-0.01714126,  1.01891542, -0.03435001],
               [-0.03794001, -0.03435001,  0.95575165]])
        >>> numTensors
        8
    """
    import numpy as np
    from jelinekstat.tools import tensorvect2matrixform
    sample = sample.T
    numTensors = np.shape(sample)[1]
    tensorsList = list()
    normalizedTensorsList = list()
    for i in range(numTensors):
        T = sample[:, (i)]
        tensorsList.append(T)
        if normalized:
            normalizedTensorsList.append(T)
        else:
            inv1 = sum(T[0:3]) / 3
            normalizedTensorsList.append(T / inv1)
    meanTensorVect = np.mean(normalizedTensorsList, axis=0)
    meanTensorMtx = tensorvect2matrixform(meanTensorVect)
    return meanTensorVect, meanTensorMtx, numTensors
