cvs: pear /Math_Matrix Matrix2x2.php Matrix3x3.php

From: Date: Fri, 24 May 2002 18:35:54 +0000
Subject: cvs: pear /Math_Matrix Matrix2x2.php Matrix3x3.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4075@lists.php.net to get a copy of this message
jmcastagnetto Fri May 24 14:35:54 2002 EDT Added files: /pear/Math_Matrix Matrix2x2.php Matrix3x3.php Log: Added 2x2 and 3x3 matrix classes Index: pear/Math_Matrix/Matrix2x2.php +++ pear/Math_Matrix/Matrix2x2.php <?php class Math_Matrix2x2 extends Math_Matrix {/*{{{*/ function Math_Matrix2x2($data = null) {/*{{{*/ $this->Math_Matrix($data); }/*}}}*/ function setData($data) {/*{{{*/ if (is_array($data) && count($data) == count($data[0]) && count($data) == 2) parent::setData($data); else PEAR::raiseError('Invalid data, cannot create/modify 2x2 matrix'); }/*}}}*/ function determinant() {/*{{{*/ if ($this->isEmpty()) return PEAR::raiseError('Matrix has not been populated'); else return ( $this->getElement(0,0) * $this->getElement(1,1) - $this->getElement(1,0) * $this->getElement(0,1) ); }/*}}}*/ }/*}}}*/ // vim: ts=4:sw=4:et: // vim6: fdl=1: ?> Index: pear/Math_Matrix/Matrix3x3.php +++ pear/Math_Matrix/Matrix3x3.php <?php class Math_Matrix3x3 extends Math_Matrix {/*{{{*/ function Math_Matrix3x3($data = null) {/*{{{*/ $this->Math_Matrix($data); }/*}}}*/ function setData($data) {/*{{{*/ if (is_array($data) && count($data) == count($data[0]) && count($data) == 3) parent::setData($data); else PEAR::raiseError('Invalid data, cannot create/modify 3x3 matrix'); }/*}}}*/ function determinant() {/*{{{*/ if ($this->isEmpty()) return PEAR::raiseError('Matrix has not been populated'); else return ( $this->geElement(0,0) * $this->getElement(1,1) * $this->getElement(2,2) - $this->geElement(0,0) * $this->getElement(2,1) * $this->getElement(1,2) + $this->geElement(1,0) * $this->getElement(2,1) * $this->getElement(0,2) - $this->geElement(1,0) * $this->getElement(0,1) * $this->getElement(2,2) + $this->geElement(2,0) * $this->getElement(0,1) * $this->getElement(1,2) - $this->geElement(2,0) * $this->getElement(1,1) * $this->getElement(0,2) ); }/*}}}*/ }/*}}}*/ // vim: ts=4:sw=4:et: // vim6: fdl=1: ?>

« previous php.pear.cvs (#4075) next »