NumPHP\Core\NumArray::getNDim PHP Method

getNDim() public method

Returns the number of axis (dimensions) the NumArray
Since: 1.0.0
public getNDim ( ) : integer
return integer
    public function getNDim()
    {
        return count($this->shape);
    }

Usage Example

コード例 #1
0
ファイル: Reduce.php プロジェクト: buaa556/gongkesheng
 /**
  * Combines all elements of an NumArray at a given axis with the `$callback`
  * function
  *
  * @param NumArray $numArray given NumArray
  * @param callback $callback callback function
  * @param int      $axis     given axis
  *
  * @return NumArray
  *
  * @throws InvalidArgumentException will be thrown, if axis is out of bounds
  *
  * @since 1.0.0
  */
 public static function reduceArray(NumArray $numArray, $callback, $axis)
 {
     if ($axis && $axis >= $numArray->getNDim()) {
         throw new InvalidArgumentException('Axis ' . $axis . ' out of bounds');
     }
     return new NumArray(self::reduceRecursive($numArray->getData(), $callback, $axis));
 }
All Usage Examples Of NumPHP\Core\NumArray::getNDim