Fix tabs to white spaces

This commit is contained in:
Dennis Eichhorn 2017-10-27 18:20:52 +02:00
parent 77e662bd0b
commit e4833b6e58
8 changed files with 99 additions and 99 deletions

View File

@ -87,15 +87,15 @@ class LUDecomposition
$L = [[]]; $L = [[]];
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i > $j) { if ($i > $j) {
$L[$i][$j] = $this->LU[$i][$j]; $L[$i][$j] = $this->LU[$i][$j];
} elseif ($i == $j) { } elseif ($i == $j) {
$L[$i][$j] = 1.0; $L[$i][$j] = 1.0;
} else { } else {
$L[$i][$j] = 0.0; $L[$i][$j] = 0.0;
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
@ -109,14 +109,14 @@ class LUDecomposition
$U = [[]]; $U = [[]];
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i <= $j) { if ($i <= $j) {
$U[$i][$j] = $this->LU[$i][$j]; $U[$i][$j] = $this->LU[$i][$j];
} else { } else {
$U[$i][$j] = 0.0; $U[$i][$j] = 0.0;
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setMatrix($U); $matrix->setMatrix($U);
@ -132,9 +132,9 @@ class LUDecomposition
public function isNonsingular() : bool public function isNonsingular() : bool
{ {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->LU[$j][$j] == 0) { if ($this->LU[$j][$j] == 0) {
return false; return false;
} }
} }
return true; return true;

View File

@ -27,56 +27,56 @@ class QRDecomposition
public function __construct(Matrix $M) public function __construct(Matrix $M)
{ {
// Initialize. // Initialize.
$this->QR = $M->toArray(); $this->QR = $M->toArray();
$this->m = $M->getRowDimension(); $this->m = $M->getRowDimension();
$this->n = $M->getColumnDimension(); $this->n = $M->getColumnDimension();
// Main loop. // Main loop.
for ($k = 0; $k < $this->n; ++$k) { for ($k = 0; $k < $this->n; ++$k) {
// Compute 2-norm of k-th column without under/overflow. // Compute 2-norm of k-th column without under/overflow.
$nrm = 0.0; $nrm = 0.0;
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$nrm = hypo($nrm, $this->QR[$i][$k]); $nrm = hypo($nrm, $this->QR[$i][$k]);
} }
if ($nrm != 0.0) { if ($nrm != 0.0) {
// Form k-th Householder vector. // Form k-th Householder vector.
if ($this->QR[$k][$k] < 0) { if ($this->QR[$k][$k] < 0) {
$nrm = -$nrm; $nrm = -$nrm;
} }
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$this->QR[$i][$k] /= $nrm; $this->QR[$i][$k] /= $nrm;
} }
$this->QR[$k][$k] += 1.0; $this->QR[$k][$k] += 1.0;
// Apply transformation to remaining columns. // Apply transformation to remaining columns.
for ($j = $k+1; $j < $this->n; ++$j) { for ($j = $k+1; $j < $this->n; ++$j) {
$s = 0.0; $s = 0.0;
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$s += $this->QR[$i][$k] * $this->QR[$i][$j]; $s += $this->QR[$i][$k] * $this->QR[$i][$j];
} }
$s = -$s/$this->QR[$k][$k]; $s = -$s/$this->QR[$k][$k];
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$this->QR[$i][$j] += $s * $this->QR[$i][$k]; $this->QR[$i][$j] += $s * $this->QR[$i][$k];
} }
} }
} }
$this->Rdiag[$k] = -$nrm; $this->Rdiag[$k] = -$nrm;
} }
} }
public function isFullRank() : bool public function isFullRank() : bool
{ {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($this->Rdiag[$j] == 0) { if ($this->Rdiag[$j] == 0) {
return false; return false;
} }
} }
return true; return true;
} }
public function getH() public function getH()
@ -84,13 +84,13 @@ class QRDecomposition
$H = [[]]; $H = [[]];
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) { if ($i >= $j) {
$H[$i][$j] = $this->QR[$i][$j]; $H[$i][$j] = $this->QR[$i][$j];
} else { } else {
$H[$i][$j] = 0.0; $H[$i][$j] = 0.0;
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
@ -104,15 +104,15 @@ class QRDecomposition
$R = [[]]; $R = [[]];
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) { if ($i < $j) {
$R[$i][$j] = $this->QR[$i][$j]; $R[$i][$j] = $this->QR[$i][$j];
} elseif ($i == $j) { } elseif ($i == $j) {
$R[$i][$j] = $this->Rdiag[$i]; $R[$i][$j] = $this->Rdiag[$i];
} else { } else {
$R[$i][$j] = 0.0; $R[$i][$j] = 0.0;
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
@ -126,24 +126,24 @@ class QRDecomposition
$Q = [[]]; $Q = [[]];
for ($k = $this->n-1; $k >= 0; --$k) { for ($k = $this->n-1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0; $Q[$i][$k] = 0.0;
} }
$Q[$k][$k] = 1.0; $Q[$k][$k] = 1.0;
for ($j = $k; $j < $this->n; ++$j) { for ($j = $k; $j < $this->n; ++$j) {
if ($this->QR[$k][$k] != 0) { if ($this->QR[$k][$k] != 0) {
$s = 0.0; $s = 0.0;
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$s += $this->QR[$i][$k] * $Q[$i][$j]; $s += $this->QR[$i][$k] * $Q[$i][$j];
} }
$s = -$s/$this->QR[$k][$k]; $s = -$s/$this->QR[$k][$k];
for ($i = $k; $i < $this->m; ++$i) { for ($i = $k; $i < $this->m; ++$i) {
$Q[$i][$j] += $s * $this->QR[$i][$k]; $Q[$i][$j] += $s * $this->QR[$i][$k];
} }
} }
} }
} }
$matrix = new Matrix(); $matrix = new Matrix();
$matrix->setArray($Q); $matrix->setArray($Q);

View File

@ -26,7 +26,7 @@ namespace phpOMS\Math\Optimization;
*/ */
interface GeneticAlgorithmInterface interface GeneticAlgorithmInterface
{ {
public function mutate($a); public function mutate($a);
public function unfitness($a, $b); public function unfitness($a, $b);
} }

View File

@ -28,10 +28,10 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class RequestMethod extends Enum abstract class RequestMethod extends Enum
{ {
/* public */ const GET = 'GET'; /* GET */ /* public */ const GET = 'GET'; /* GET */
/* public */ const POST = 'POST'; /* POST */ /* public */ const POST = 'POST'; /* POST */
/* public */ const PUT = 'PUT'; /* PUT */ /* public */ const PUT = 'PUT'; /* PUT */
/* public */ const DELETE = 'DELETE'; /* DELETE */ /* public */ const DELETE = 'DELETE'; /* DELETE */
/* public */ const HEAD = 'HEAD'; /* HEAD */ /* public */ const HEAD = 'HEAD'; /* HEAD */
/* public */ const TRACE = 'TRACE'; /* TRACE */ /* public */ const TRACE = 'TRACE'; /* TRACE */
} }

View File

@ -227,7 +227,7 @@ class Tree extends Graph
$this->preOrder($neighbor, $callback); $this->preOrder($neighbor, $callback);
} }
} }
/** /**
* Perform action on tree in post-order. * Perform action on tree in post-order.
* *
@ -240,7 +240,7 @@ class Tree extends Graph
if (count($this->nodes) === 0) { if (count($this->nodes) === 0) {
return; return;
} }
$neighbors = $this->getNeighbors($node); $neighbors = $this->getNeighbors($node);
foreach ($neighbors as $neighbor) { foreach ($neighbors as $neighbor) {

View File

@ -30,8 +30,8 @@ use phpOMS\Stdlib\Base\Enum;
*/ */
abstract class ContentPutMode extends Enum abstract class ContentPutMode extends Enum
{ {
/* public */ const APPEND = 1; /* public */ const APPEND = 1;
/* public */ const PREPEND = 2; /* public */ const PREPEND = 2;
/* public */ const REPLACE = 4; /* public */ const REPLACE = 4;
/* public */ const CREATE = 8; /* public */ const CREATE = 8;
} }

View File

@ -99,7 +99,7 @@ class Currency
{ {
if (!isset(self::$ecbCurrencies)) { if (!isset(self::$ecbCurrencies)) {
$request = new Request(new Http('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')); $request = new Request(new Http('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'));
$request->setMethod(RequestMethod::GET); $request->setMethod(RequestMethod::GET);
$xml = new \SimpleXMLElement(Rest::request($request)); $xml = new \SimpleXMLElement(Rest::request($request));

View File

@ -29,9 +29,9 @@ use phpOMS\Utils\EDI\Edifact\Components\BGM;
*/ */
class INVOIC class INVOIC
{ {
private $unh = null; private $unh = null;
private $bgm = null; private $bgm = null;
public function __construct() public function __construct()
{ {