Evaluate the estimated pdf on a set of points.

@param array $points 1-D array of points on to which we will map the kde

@return array
776735
public function evaluate(array $points)
    {
        $count = count($this->dataset);

        $bigger = count($points) > $count;

        if ($bigger) {
            $range = $count - 1;
        } else {
            $range = count($points) - 1;
        }

        $result = array_fill(0, count($points), 0);

        // loop over points
        foreach (range(0, $range) as $i) {
            if ($bigger) {
                $dataValue = $this->dataset[$i];
                $diff = array_map(function ($point) use ($dataValue) {
                    return $dataValue - $point;
                }, $points);
            } else {
                $diff = array_map(function ($v) use ($points, $i) {
                    return $v - $points[$i];
                }, $this->dataset);
            }

            // dot product (consider dedicated function)
            $invCov = $this->invCov;
            $tDiff = array_map(function ($v) use ($invCov) {
                return $invCov * $v;
            }, $diff);

            // multiply the two arrays
            $multiplied = [];

            foreach ($diff as $index => $value) {
                $multiplied[$index] = $diff[$index] * $tDiff[$index];
            }

            // numpy sum does nothing with our 2d array in PHP
            // $energy = array_sum(diff * tdiff, axis=0) / 2.0
            $energy = array_map(function ($v) {
                return exp(-($v / 2));
            }, $multiplied);

            if ($bigger) {
                $sum = $result;

                foreach ($sum as $index => $value) {
                    $sum[$index] = $sum[$index] + $energy[$index];
                }
                $result = $sum;
            } else {
                $result[$i] = array_sum($energy);
            }
        }

        $result = array_map(function ($v) {
            return $v / $this->normFactor;
        }, $result);

        return $result;
    }
968295
public function fold(int $k = 10) : array
    {
        if ($k < 2) {
            throw new InvalidArgumentException('Cannot create less than'
                . " 2 folds, $k given.");
        }

        $n = (int) floor($this->numRows() / $k);

        $folds = [];

        for ($i = 0; $i < $k; $i++) {
            $offset = $i * $n;

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

            $folds[] = self::quick($samples, $labels);
        }

        return $folds;
    }
150357
private function getLocationChoices(array $locations): array
    {
        $locationIds = array_column($locations, 'id');

        return array_combine($locationIds, array_fill_keys($locationIds, false));
    }
268951
public function collect(Map $map, array $points = [])
    {
        foreach ($this->markerCollector->collect($map) as $marker) {
            if ($marker->hasIcon()) {
                $icon = $marker->getIcon();

                if ($icon->hasAnchor()) {
                    $points = $this->collectValue($icon->getAnchor(), $points);
                }

                if ($icon->hasOrigin()) {
                    $points = $this->collectValue($icon->getOrigin(), $points);
                }
            }
        }

        return $points;
    }
880518
private function decodeEmailAddresses(array $addresses): array
    {
        $return = [];
        foreach ($addresses as $address) {
            if (isset($address->mailbox)) {
                $return[] = $this->decodeEmailAddress($address);
            }
        }

        return $return;
    }
1214381
protected function getValues(array $values)
    {
        $array = [];

        $versionedKeys = array_merge(
            $this->model->getVersionedAttributeNames(),
            [$this->model->getLatestVersionColumn(), $this->model->getVersionColumn(), $this->model->getVersionKeyName()]
        );

        foreach ($values as $key => $value) {
            if (! $this->isVersionedKey($key, $versionedKeys)) {
                $array[$key] = $value;
            }
        }

        return $array;
    }
596533
private function getLocations($locations)
    {
        $array=[];
        foreach ($locations as $location) { /* @var \Core\Entity\LocationInterface $location */
            array_push(
                $array,
                [
                    '@type' => 'Place',
                    'address' => [
                        '@type' => 'PostalAddress',
                        'streetAddress' => $location->getStreetname() .' '.$location->getStreetnumber(),
                        'postalCode' => $location->getPostalCode(),
                        'addressLocality' => $location->getCity(),
                        'addressCountry' => $location->getCountry(),
                        'addressRegion' => $location->getRegion(),
                    ]
                ]
            );
        }
        return $array;
    }
1080539
private function formatOutputLocationArray($locations)
    {
        $formattedResponse = [];

        /**
         * @var LocationInterface $location
         */
        foreach ($locations as $location) {
            $formattedResponse[] = $this->formatOutputLocation($location);
        }

        return $formattedResponse;
    }
201848
protected function validateMultiPointValue($points)
    {
        if ($points instanceof GeometryInterface) {
            $points = $points->toArray();
        }

        foreach ($points as &$point) {
            $point = $this->validatePointValue($point);
        }

        return $points;
    }
937115
private function getSortedEndpoints($endpoints)
    {
        ksort($endpoints);

        $sorted = array();
        foreach ($endpoints as $key => $val) {
            $this->ins($sorted, explode('.', $key), $val);
        }
        
        return $sorted;
    }
1340011
private function readPoints($count)
    {
        $points = array();

        for ($i = 0; $i < $count; $i++) {
            $points[] = $this->point();
        }

        return $points;
    }
1369649
public function evaluate($values)
    {
        $returnValue = (bool) false;

        
        $returnValue = true;
        
		$values = is_array($values) ? $values : array($values);
		foreach ($values as $value) {
			if ($this->hasOption('min') && mb_strlen($value) < $this->getOption('min')) {
				if ($this->hasOption('allowEmpty') &&  $this->getOption('allowEmpty') && empty($value)) {
					continue;
				} else {
					$returnValue = false;
					break;
				}
			}
			if ($this->hasOption('max') && mb_strlen($value) > $this->getOption('max')) {
				$returnValue = false;
				break;
			}
		}
        

        return (bool) $returnValue;
    }
1064618
public function prepareProjection(array $fields) : array
    {
        $preparedFields = [];

        foreach ($fields as $key => $value) {
            $preparedFields[$this->prepareFieldName($key)] = $value;
        }

        return $preparedFields;
    }
1328161
public function getPoints()
	{
		/** @var Point[] $points */
		$points = [];

		$points = array_merge($points, $this->points);

		if (phpGPX::$SORT_BY_TIMESTAMP && !empty($points)) {
			usort($points, array('phpGPX\Helpers\DateTimeHelper', 'comparePointsByTimestamp'));
		}

		return $points;
	}
868649
public function process(array $values)
    {
        $results = [];

        foreach ($values as $value) {
            list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',',
                $value, true, 2);
            $results[] = $this->getSolrRootlineForPageId($rootPageUid,
                $mountPoint);
        }

        return $results;
    }
158640
static public function fromArrays(array $keys, array $values) {
    if (count($keys) !== count($values)) {
      throw new SimpleOrderedMapException(
        'Length of keys and values does not match');
    }
    $map = new SimpleOrderedMap();
    $map->keys = array_values($keys);
    $map->values = array_values($values);
    return $map;
  }
906404
public function compareYCoord(Point $point, $precision = 1000)
    {
        return $this->compare($this->y, $point->y, $precision);
    }