NumPHP\Core\NumArray::getTranspose PHP Метод

getTranspose() публичный Метод

Returns the transposed NumArray
С версии: 1.0.0
public getTranspose ( ) : NumArray
Результат NumArray
    public function getTranspose()
    {
        if ($this->inCache(Transpose::CACHE_KEY_TRANSPOSE)) {
            return $this->getCache(Transpose::CACHE_KEY_TRANSPOSE);
        }
        $transpose = new NumArray(Transpose::getTranspose($this->data, $this->getShape()));
        $this->setCache(Transpose::CACHE_KEY_TRANSPOSE, $transpose);
        return $this->getTranspose();
    }

Usage Example

Пример #1
0
 /**
  * Tests caching of NumArray::getTranspose
  */
 public function testTransposeCache()
 {
     $numArray = new NumArray(5);
     $numArray->setCache(NumArray\Transpose::CACHE_KEY_TRANSPOSE, 8);
     $this->assertSame(8, $numArray->getTranspose());
 }