Transforms the content of float array to an integer array.

@param array $floatArray An array containing float values.
@return array An array containing integer values.
506972
static public function floatArrayToInteger($floatArray)
    {
        $integerArray = array();
        foreach ($floatArray as $f) {
            $integerArray[] = (is_null($f) === false) ? intval($f) : null;
        }

        return $integerArray;
    }
86238
protected function normalizeResult($resultArray)
    {
        $countArr = count($resultArray);
        if ($countArr > 10) {
            $resultArray = array_slice($resultArray, 0, 10);
        }
        else if ($countArr < 10) {
            for ($i = $countArr; $i < self::DEFAULT_RESULT_NUMBER; $i++)
                $resultArray[$i] = self::DEFAULT_PAD_ENTRY;
        }
        return $resultArray;
    }
696609
public function translateArray(array $array)
    {
        $result = array();

        foreach ($array as $key => $value) {
            // Group translation
            if (is_array($value)) {
                $key = $this->translate($key);

                // If group is not created yet, create it
                if (!isset($result[$key])){
                    $result[$key] = array();
                }

                foreach($value as $index => $inner) {
                    $result[$key][$index] = $this->translate($inner);
                }
                
            } else if (is_scalar($value)) {
                $result[$key] = $this->translate($value);
            } else {
                throw new InvalidArgumentException('Invalid array supplied');
            }
        }

        return $result;
    }
728670
public function mGet(array $keyArray)
    {
        $result = [];
        foreach ($keyArray as $key) {
            $v = $this->get($key);
            if (null != $v) {
                $result[$key] = $v;
            }
        }

        return $result;
    }
615300
public static float[][] toFloat(int[][] array) {
        float[][] n = new float[array.length][array[0].length];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                n[i][j] = (float) array[i][j];
            }
        }
        return n;
    }
269632
private function arrayFlatten(array $array)
    {
        $flat = array();
        foreach ($array as $arg) {
            switch (gettype($arg)) {
                case 'array':
                    $flat = array_merge($flat, $arg);
                    break;

                default:
                    $flat[] = $arg;
                    break;
            }
        }

        return $flat;
    }
1262612
public static function valuesWithType(array $inputArray, string $type): array
    {
        $newArray = [];
        foreach ($inputArray as $key => $value) {
            if (is_scalar($value)) {
                $newValue = $value;
                settype($newValue, $type);
                $newArray[$key] = $newValue;
            }
        }

        return $newArray;
    }
1370190
public static function castArrayToFloatArray($array, $recursion = true, $unsigned = false)
    {
        foreach ($array as $key => $value) {
            if (is_array($value) && $recursion) {
                $array[$key] = self::castArrayToFloatArray($value, $recursion, $unsigned);
            } elseif (!is_array($value)) {
                $array[$key] = (float) $value;

                if ($unsigned) {
                    $array[$key] = abs($array[$key]);
                }
            }
        }

        return $array;
    }
229772
public static function getFloat(array $array, $key, float $default = 0.0) : float
    {
        $key = (string) $key;

        if ($array[$key] ?? 0) {
            return (float) $array[$key];
        }

        return $default;
    }
880218
public function flattenArray($array)
    {
        $result = [];
        foreach (array_dot($array) as $key => $value) {
            $splitKey = explode('.', $key);
            $newKey = $this->createArrayKey($splitKey);
            $result = array_merge($result, [$newKey => $value]);
        }

        return $result;
    }
1137926
public static int[][] toInt(double[][] array) {
        int[][] n = new int[array.length][array[0].length];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                n[i][j] = (int) array[i][j];
            }
        }
        return n;
    }
750533
public function split(float $ratio = 0.5) : array
    {
        if ($ratio <= 0 or $ratio >= 1) {
            throw new InvalidArgumentException('Split ratio must be strictly'
            . " between 0 and 1, $ratio given.");
        }

        $n = (int) ($ratio * $this->numRows());

        $leftSamples = array_slice($this->samples, 0, $n);
        $leftLabels = array_slice($this->labels, 0, $n);

        $rightSamples = array_slice($this->samples, $n);
        $rightLabels = array_slice($this->labels, $n);

        return [
            self::quick($leftSamples, $leftLabels),
            self::quick($rightSamples, $rightLabels),
        ];
    }
176880
public static function toInteger($array, $default = null)
	{
		if (is_array($array))
		{
			$array = array_map('intval', $array);
		}
		else
		{
			if ($default === null)
			{
				$array = array();
			}
			elseif (is_array($default))
			{
				$array = self::toInteger($default, null);
			}
			else
			{
				$array = array((int) $default);
			}
		}

		return $array;
	}
863000
public static function sumOfSquares(array $numbers): float
    {
        if (count($numbers) === 0) {
            throw new InvalidArgumentException('The array has zero elements');
        }

        $mean = Mean::arithmetic($numbers);

        return array_sum(array_map(
            function ($val) use ($mean) {
                return ($val - $mean) ** 2;
            },
            $numbers
        ));
    }
1367879
private static function getValueList(array $array): array
    {
        foreach ($array as $i => $attr)
            $array[$i] = (is_array($attr) ? self::getValueList($attr) : self::getValue($attr));

        return $array;
    }
1286050
private static function objectToArray(array $array): array
    {
        foreach ($array as $key => &$value) {
            if (is_object($value) || is_array($value)) {
                $value = self::objectToArray((array) $value);
            }
        }

        return (array) $array;
    }
70213
private function getArray(Array_ $array)
    {
        $return = [];

        foreach ($array->items as $item) {
            if ($item->key === null) {
                $return[] = $this->getValue($item->value);
            } else {
                $return[$this->getValue($item->key)] = $this->getValue($item->value);
            }
        }

        return $return;
    }