prepare diagonals

@return array
501592
private function diagonals()
    {

        $diagonals = array_fill(0, 2, []);

        $diagonalIndexes = range(0, count($this->board) - 1);

        $diagonalIndexesReverse = array_reverse($diagonalIndexes);

        foreach ($diagonalIndexes as $index => $value) {

            array_push($diagonals[0], $this->board->getValue([$value, $value]));

            array_push($diagonals[1], $this->board->getValue([$value, $diagonalIndexesReverse[$index]]));
        }

        return $diagonals;
    }
472766
public function grid(): array
    {
        return [
            TD::set('id', 'ID')
                ->align(TD::ALIGN_CENTER)
                ->width('100px')
                ->filter('numeric')
                ->sort()
                ->linkPost(),

            TD::set('name', 'Name')
                ->width('250px')
                ->locale()
                ->column('content.name')
                ->filter('text')
                ->sort()
                ->linkPost('name'),

            TD::set('status')
                ->sort(),

            TD::set('phone', 'Phone')
                ->locale()
                ->column('content.phone')
                ->filter('text')
                ->linkPost('phone'),

            TD::set('publish_at', 'Date of publication')
                ->filter('date')
                ->sort()
                ->align(TD::ALIGN_RIGHT)
                ->render(function ($item) {
                    return optional($item->publish_at)->toDateString();
                }),

            TD::set('created_at', 'Date of creation')
                ->filter('date')
                ->align(TD::ALIGN_RIGHT)
                ->sort()
                ->render(function ($item) {
                    return $item->created_at->toDateString();
                }),
        ];
    }
33217
private int getDiagSize(int diagonal) {
        if (diagonal < 0)
            return Math.min(numRows + diagonal, numColumns);
        else
            return Math.min(numRows, numColumns - diagonal);
    }
173059
public function toArray()
	{
		return [
			'distance' => (float)$this->distance,
			'avgSpeed' => (float)$this->averageSpeed,
			'avgPace' => (float)$this->averagePace,
			'minAltitude' => (float)$this->minAltitude,
			'maxAltitude' => (float)$this->maxAltitude,
			'cumulativeElevationGain' => (float)$this->cumulativeElevationGain,
			'cumulativeElevationLoss' => (float)$this->cumulativeElevationLoss,
			'startedAt' => DateTimeHelper::formatDateTime($this->startedAt, phpGPX::$DATETIME_FORMAT, phpGPX::$DATETIME_TIMEZONE_OUTPUT),
			'finishedAt' => DateTimeHelper::formatDateTime($this->finishedAt, phpGPX::$DATETIME_FORMAT, phpGPX::$DATETIME_TIMEZONE_OUTPUT),
			'duration' => (float)$this->duration
		];
	}
376476
public function getDimensionValues()
    {
        $values = [];
        
        foreach ($this->fields as $dim => $field) {
            $values[$dim] = is_numeric($field->dataValue()) ? (int) $field->dataValue() : null;
        }
        
        return $values;
    }
494292
public static Basic1DMatrix diagonal(int size, double diagonal) {
        double[] array = new double[size * size];

        for (int i = 0; i < size; i++) {
            array[i * size + i] = diagonal;
        }

        return new Basic1DMatrix(size, size, array);
    }
1345132
def diagonals(self):
        
        left_top_shifts = map(lambda i: (-(i + 1), -(i + 1)), range(min(
            self.left_distance, self.top_distance)))
        left_bottom_shifts = map(lambda i: (-(i + 1), +(i + 1)), range(min(
            self.left_distance, self.bottom_distance)))
        right_top_shifts = map(lambda i: (+(i + 1), -(i + 1)), range(min(
            self.right_distance, self.top_distance)))
        right_bottom_shifts = map(lambda i: (+(i + 1), +(i + 1)), range(min(
            self.right_distance, self.bottom_distance)))
        return set(chain(
            left_top_shifts, left_bottom_shifts,
            right_top_shifts, right_bottom_shifts))
1034232
public function getLocalPrimaryKeys()
    {
        $cols = [];
        $localCols = $this->getLocalColumnObjects();

        foreach ($localCols as $localCol) {
            if ($localCol->isPrimaryKey()) {
                $cols[] = $localCol;
            }
        }

        return $cols;
    }
467840
protected function prepare_per_region_arrays() {
        $result = array();
        foreach ($this->regions as $region => $notused) {
            $result[$region] = array();
        }
        return $result;
    }
579793
protected function getDimensions()
    {
        $output = $this->exec('mode CON', true);

        if (!is_array($output)) {
            return [];
        }

        $output = implode("\n", $output);

        preg_match_all('/.*:\s*(\d+)/', $output, $matches);

        return (!empty($matches[1])) ? $matches[1] : [];
    }
1197690
public function getMatrix()
    {
        if (func_num_args() > 0) {
            $args = func_get_args();
            $match = implode(',', array_map('gettype', $args));
            switch ($match) {
 
      //A($i0...; $j0...)
      case 'integer,integer':
        list($i0, $j0) = $args;
          $m = $i0 >= 0 ? $this->m - $i0 : trigger_error(ArgumentBoundsException, ERROR);
          $n = $j0 >= 0 ? $this->n - $j0 : trigger_error(ArgumentBoundsException, ERROR);
          $R = new Matrix($m, $n);
 
          for ($i = $i0; $i < $this->m; $i++) {
              for ($j = $j0; $j < $this->n; $j++) {
                  $R->set($i, $j, $this->A[$i][$j]);
              }
          }
 
          return $R;
          break;
 
      //A($i0...$iF; $j0...$jF)
      case 'integer,integer,integer,integer':
       list($i0, $iF, $j0, $jF) = $args;
        $m = (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR);
        $n = (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m+1, $n+1);
 
        for ($i = $i0; $i <= $iF; $i++) {
            for ($j = $j0; $j <= $jF; $j++) {
                $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
            }
        }
 
        return $R;
        break;
 
      //$R = array of row indices; $C = array of column indices
      case 'array,array':
        list($RL, $CL) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
            }
        }
 
        return $R;
        break;
 
      //$RL = array of row indices; $CL = array of column indices
      case 'array,array':
        list($RL, $CL) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
            }
        }
 
        return $R;
        break;
 
      //A($i0...$iF); $CL = array of column indices
      case 'integer,integer,array':
        list($i0, $iF, $CL) = $args;
        $m = (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) ? $iF - $i0 : trigger_error(ArgumentBoundsException, ERROR);
        $n = count($CL) > 0 ? count($CL) : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n);
 
        for ($i = $i0; $i < $iF; $i++) {
            for ($j = 0; $j < $n; $j++) {
                $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
            }
        }
 
        return $R;
        break;
 
      //$RL = array of row indices
      case 'array,integer,integer':
        list($RL, $j0, $jF) = $args;
        $m = count($RL) > 0 ? count($RL) : trigger_error(ArgumentBoundsException, ERROR);
        $n = (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) ? $jF - $j0 : trigger_error(ArgumentBoundsException, ERROR);
        $R = new Matrix($m, $n+1);
 
        for ($i = 0; $i < $m; $i++) {
            for ($j = $j0; $j <= $jF; $j++) {
                $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
            }
        }
 
        return $R;
        break;
      default:
        trigger_error(PolymorphicArgumentException, ERROR);
        break;
      }
        } else {
            trigger_error(PolymorphicArgumentException, ERROR);
        }
    }
300401
public function getPeriodUnits()
    {
        return array(
            'S' => $this->translate->_('Seconds'),
            'N' => $this->translate->_('Minutes'),
            'H' => $this->translate->_('Hours'),
            'D' => $this->translate->_('Days'),
            'W' => $this->translate->_('Weeks'),
            'M' => $this->translate->_('Months'),
            'Q' => $this->translate->_('Quarters'),
            'Y' => $this->translate->_('Years')
        );
    }
441489
public static function antidiagonal(Matrix $matrix)
    {
        if (!$matrix->isSquare()) {
            throw new Exception('Anti-Diagonal can only be extracted from a square matrix');
        }

        $dimensions = $matrix->rows;
        $grid = Builder::createFilledMatrix(0, $dimensions, $dimensions)
            ->toArray();

        for ($i = 0; $i < $dimensions; ++$i) {
            $grid[$i][$dimensions - $i - 1] = $matrix->getValue($i + 1, $dimensions - $i);
        }

        return new Matrix($grid);
    }
877788
def diagonalSize(self):
        """"""
        szs = [a.diagonalSize() for a in self.actors]
        return np.max(szs)
421149
public static double[] getDiagonal(final double[][] m1) {
    final int dim = Math.min(getColumnDimensionality(m1), m1.length);
    final double[] diagonal = new double[dim];
    for(int i = 0; i < dim; i++) {
      diagonal[i] = m1[i][i];
    }
    return diagonal;
  }
59037
public function layout(): array
    {
        return [

            MetricsExample::class,
            ChartLineExample::class,

            Layout::columns([
                ChartPieExample::class,
                ChartBarExample::class,
            ]),

            Layout::tabs([
                'Example Tab Table' => TableExample::class,
                'Example Tab Rows'  => RowExample::class,
            ]),

            Layout::modals([
                'exampleModal' => Layout::rows([
                    Input::make('user.password')
                        ->type('test')
                        ->title(__('Example'))
                        ->placeholder(__('Example')),
                ]),
            ]),

        ];
    }
153893
function diagonal(s, d) {
    if (s.dy == undefined) {
        s.dy = 0;
    }
    if (d.dy == undefined) {
        d.dy = 0;
    }
    let path = `M ${s.x} ${(s.y + s.dy)}
          C ${(s.x + d.x) / 2} ${(s.y + s.dy)},
            ${(s.x + d.x) / 2} ${(d.y + d.dy)},
            ${d.x} ${(d.y + d.dy)}`;
    return path;
}