本文整理匯總了PHP中Matrix::norm1方法的典型用法代碼示例。如果您正苦於以下問題:PHP Matrix::norm1方法的具體用法?PHP Matrix::norm1怎麽用?PHP Matrix::norm1使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Matrix
的用法示例。
在下文中一共展示了Matrix::norm1方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: TestMatrix
//.........這裏部分代碼省略.........
* Array-like methods:
* minus
* minusEquals
* plus
* plusEquals
* arrayLeftDivide
* arrayLeftDivideEquals
* arrayRightDivide
* arrayRightDivideEquals
* arrayTimes
* arrayTimesEquals
* uminus
*/
print "<p>Testing array-like methods...</p>";
/**
* I/O methods:
* read
* print
* serializable:
* writeObject
* readObject
*/
print "<p>Testing I/O methods...</p>";
/**
* Test linear algebra methods
*/
echo "<p>Testing linear algebra methods...<p>";
$A = new Matrix($columnwise, 3);
if ($this->checkMatrices($A->transpose(), $T)) {
$this->try_success("Transpose check...");
} else {
$errorCount = $this->try_failure($errorCount, "Transpose check...", "Matrices are not equal");
}
if ($this->checkScalars($A->norm1(), $columnsummax)) {
$this->try_success("Maximum column sum...");
} else {
$errorCount = $this->try_failure($errorCount, "Maximum column sum...", "Incorrect: " . $A->norm1() . " != " . $columnsummax);
}
if ($this->checkScalars($A->normInf(), $rowsummax)) {
$this->try_success("Maximum row sum...");
} else {
$errorCount = $this->try_failure($errorCount, "Maximum row sum...", "Incorrect: " . $A->normInf() . " != " . $rowsummax);
}
if ($this->checkScalars($A->normF(), sqrt($sumofsquares))) {
$this->try_success("Frobenius norm...");
} else {
$errorCount = $this->try_failure($errorCount, "Frobenius norm...", "Incorrect:" . $A->normF() . " != " . sqrt($sumofsquares));
}
if ($this->checkScalars($A->trace(), $sumofdiagonals)) {
$this->try_success("Matrix trace...");
} else {
$errorCount = $this->try_failure($errorCount, "Matrix trace...", "Incorrect: " . $A->trace() . " != " . $sumofdiagonals);
}
$B = $A->getMatrix(0, $A->getRowDimension(), 0, $A->getRowDimension());
if ($B->det() == 0) {
$this->try_success("Matrix determinant...");
} else {
$errorCount = $this->try_failure($errorCount, "Matrix determinant...", "Incorrect: " . $B->det() . " != " . 0);
}
$A = new Matrix($columnwise, 3);
$SQ = new Matrix($square);
if ($this->checkMatrices($SQ, $A->times($A->transpose()))) {
$this->try_success("times(Matrix)...");
} else {
$errorCount = $this->try_failure($errorCount, "times(Matrix)...", "Unable to multiply matrices");
$SQ->toHTML();