Performs squaring

@param array $x
@return array
@access private
6577
function _square($x = false)
    {
        return count($x) < 2 * self::KARATSUBA_CUTOFF ?
            $this->_trim($this->_baseSquare($x)) :
            $this->_trim($this->_karatsubaSquare($x));
    }
202231
public static List<int[]> getNegativeRanges( double[] x ) {
        int firstNegative = -1;
        int lastNegative = -1;
        List<int[]> rangeList = new ArrayList<int[]>();

        for( int i = 0; i < x.length; i++ ) {
            double xValue = x[i];
            if (firstNegative == -1 && xValue < 0) {
                firstNegative = i;
            } else if (firstNegative != -1 && lastNegative == -1 && xValue > 0) {
                lastNegative = i - 1;
            }

            if (i == x.length - 1 && firstNegative != -1 && lastNegative == -1) {
                // need to close the range with the last value available, even if negative
                lastNegative = i;
            }

            if (firstNegative != -1 && lastNegative != -1) {
                rangeList.add(new int[]{firstNegative, lastNegative});
                firstNegative = -1;
                lastNegative = -1;
            }
        }

        return rangeList;
    }
242819
public function bitwiseXOr($x)
    {
        switch (MATH_BIGINTEGER_MODE) {
            case MATH_BIGINTEGER_MODE_GMP:
                $temp = new BigInteger();
                $temp->value = gmp_xor($this->value, $x->value);
                return $this->protectedNormalize($temp);
            case MATH_BIGINTEGER_MODE_BCMATH:
                $left = $this->toBytes();
                $right = $x->toBytes();
                $length = max(strlen($left), strlen($right));
                $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
                $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);
                return $this->protectedNormalize(new BigInteger($left ^ $right, 256));
        }
        $length = max(count($this->value), count($x->value));
        $result = $this->copy();
        $result->value = array_pad($result->value, $length, 0);
        $x->value = array_pad($x->value, $length, 0);
        for ($i = 0; $i < $length; ++ $i) {
            $result->value[$i] ^= $x->value[$i];
        }
        return $this->protectedNormalize($result);
    }
755166
public function setX($x)
    {
        try {
            $this->x = (float)$x;

            unset($x);
            return 0;
        } catch (\Exception $e) {
            throw $e;
        }
    }
1209183
public static function min(array $xs, $value): array
    {
        return array_map(
            function ($x) use ($value) {
                return min($x, $value);
            },
            $xs
        );
    }
1230187
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.range.element()

        # TODO: this pipes CUDA arrays through NumPy. Write native operator.
        with writable_array(out) as out_arr:
            finite_diff(x.asarray(), axis=self.axis, dx=self.dx,
                        method=self.method, pad_mode=self.pad_mode,
                        pad_const=self.pad_const, out=out_arr)
        return out
448382
public function where_ne($field = '', $x)
	{
		$this->_where_init($field);
		$this->wheres[$field]['$ne'] = $x;
		return $this;
	}
966523
public static function keyToCamel($array)
    {
        $result = [];
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[Strings::case2camel($key)] = self::keyToCamel($value);
            } else {
                $result[Strings::case2camel($key)] = $value;
            }
        }
        return $result;
    }
183472
function safe_intval($x)
    {
        switch (true) {
            case is_int($x):
            // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
            case (php_uname('m') & "\xDF\xDF\xDF") != 'ARM':
                return $x;
        }
        return (fmod($x, 0x80000000) & 0x7FFFFFFF) |
            ((fmod(floor($x / 0x80000000), 2) & 1) << 31);
    }
978857
public static void unitize1(double[] x) {
        double n = norm1(x);

        for (int i = 0; i < x.length; i++) {
            x[i] /= n;
        }
    }
1111563
private double[][] getAugmentedData(double[][] x) {
        double[][] ret = new double[x.length + p][p];
        double padding = c * Math.sqrt(lambda2);
        for (int i = 0; i < x.length; i++) {
            for (int j = 0; j < p; j++) {
                ret[i][j] = c * x[i][j];
            }
        }
        for (int i = x.length; i < ret.length; i++) {
            ret[i][i - x.length] = padding;
        }
        return ret;
    }
151759
public double[] postConvert(double[] X) {
		if (X.length != standardN) {
			throw new IllegalArgumentException("wrong array dimension: " + X.length);
		}
		double[] ret = new double[originalN];
		int cntSplitted = 0;
		for (int i = standardS; i < standardN; i++) {
			if (splittedVariablesList.contains(i - standardS)) {
				// this variable was splitted: x = xPlus-xMinus
				ret[i - standardS] = X[i] - X[standardN + cntSplitted];
				cntSplitted++;
			} else {
				ret[i - standardS] = X[i];
			}
		}
		// this.postconvertedX = ret;
		return ret;
	}
368932
public static function toUnderscore(array $array = [])
    {
        $output = [];
        foreach ($array as $key => $value) {
            $key = StringUtils::toUnderscore($key);
            if (is_array($value)) {
                $value = static::toUnderscore($value);
            }
            $output[$key] = $value;
        }

        return $output;
    }
1208522
public static function fromXYArrays(array $x, array $y, $sample = true, float $meanX = null, float $meanY = null)
    {
        if (empty($x) || empty($y)) {
            throw InvalidArgumentException::arrayCantBeEmpty();
        }

        $n = count($x);
        if ($sample && $n === 1) {
            throw InvalidArgumentException::arraySizeToSmall(2);
        }

        if ($meanX === null) {
            $meanX = Mean::arithmetic($x);
        }

        if ($meanY === null) {
            $meanY = Mean::arithmetic($y);
        }

        $sum = 0.0;
        foreach ($x as $index => $xi) {
            $yi = $y[$index];
            $sum += ($xi - $meanX) * ($yi - $meanY);
        }

        if ($sample) {
            --$n;
        }

        return $sum / $n;
    }
849614
public function encryptBlock($x)
    {
        $y = ''; // 16-byte string

        // place input x into the initial state matrix in column order
        for ($i = 0; $i < 4 * self::$nb; ++$i) {
            // we want integerger division for the second index
                $this->state[$i % 4][($i - $i % self::$nb) / self::$nb] = ord($x[$i]);
        }

        // add round key
        $this->addRoundKey(0);

        for ($i = 1; $i < $this->rounds; ++$i) {
            // substitute bytes
                $this->subBytes();

                // shift rows
                $this->shiftRows();

                // mix columns
                $this->mixColumns();

                // add round key
                $this->addRoundKey($i);
        }

        // substitute bytes
        $this->subBytes();

        // shift rows
        $this->shiftRows();

        // add round key
        $this->addRoundKey($i);

        // place state matrix s into y in column order
        for ($i = 0; $i < 4 * self::$nb; ++$i) {
            $y .= chr($this->state[$i % 4][($i - $i % self::$nb) / self::$nb]);
        }

        return $y;
    }
1044584
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
855597
protected function _getAll($sQ)
    {
        $aReturn = [];
        $rs = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->select($sQ);
        if ($rs != false && $rs->count() > 0) {
            while (!$rs->EOF) {
                $aReturn[] = $rs->fields[0];
                $rs->fetchRow();
            }
        }

        return $aReturn;
    }