Improve dev documentation

This commit is contained in:
Dennis Eichhorn 2017-11-18 15:27:50 +01:00
parent 11500ae4f7
commit cdb490f5b3
6 changed files with 166 additions and 17 deletions

View File

@ -0,0 +1,134 @@
# Matrix
The `Matrix` class implements matrices of the form `m x n`.
```php
$matrix = new Matrix();
$matrix->setMatrix([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
);
```
The implementation implements `ArrayAccess` for direct access and an `Iterator` for iteration.
```php
$matrix[0][2]; // = 3
```
```php
foreach($matrix as $rowId => $row) {
foreach($row as $columnId => $value) {
...
}
}
```
## Addition
The matrix addition supports matrix and scalar addition. The scalar addition adds a scalar to every element in the matrix.
```php
$matrix->add(4);
```
The matrix addition requires both matrices to have the same dimensions and adds every index to the same index in the base matrix.
```php
$matrix->add($matrixB);
```
## Subtraction
The matrix subtraction supports matrix and scalar subtraction. The scalar subtraction subtracts a scalar to every element in the matrix.
```php
$matrix->sub(4);
```
The matrix subtraction requires both matrices to have the same dimensions and subtracts every index to the same index in the base matrix.
```php
$matrix->sub($matrixB);
```
## Multiplication
The matrix multiplication supports matrix/vector and scalar multiplication. The scalar multiplication subtracts a scalar to every element in the matrix.
```php
$matrix->mult(4);
```
The matrix multiplication performs a normal matrix multiplication.
```php
$matrix->mult($matrixB);
```
## Solve
In order to solve `A x = b` the matrix implements `solve` which automatically selects an appropriate algorithm (LU or QR decomposition) to solve the equation.
```php
$matrix->solve($matrixB);
```
## Inverse
The inverse calculates the inverse if possible.
```php
$matrix->inverse();
```
## Transpose
The transpose function transposes the matrix.
```php
$matrix->transpose();
```
## Determinant
The determinant of a matrix is calculated via the `det` function.
```php
$matrix->det();
```
## Diagonalize
The diagonalize function diagonalizes the matrix if possible.
```php
$matrix->diagonalize();
```
## Triangulize
### Upper Triangular
The upper triangular of a matrix can be created via the `upperTriangular` function.
```php
$matrix->upperTriangular();
```
### Lower Triangular
The lower triangular of a matrix can be created via the `lowerTriangular` function.
```php
$matrix->lowerTriangular();
```
## Vector
The `Vector` class is a extension of the `Matrix` class `m x 1` and implements vectors.
## Identity Matrix
The `IdentityMatrix` class is a extension of the `Matrix` class and implements the identity matrix `m x n`.

View File

@ -1,9 +0,0 @@
# Code Quality
## General
## Modules
### Langauge Files
Every provided language element in the language files SHOULD be used at least once by the module itself. Don't provide language elments that are only used by *optional* 3rd party modules.

View File

@ -6,18 +6,15 @@ Code inspections are very important in order to maintain the same code quality t
Tools used for the code inspection are:
* PhpMessDetector
* PhpLoc
* PhpMetrics
* PhpDepend
* PhpCS
* PhpCPD
* PDepend
* PhpUnit (see tests)
* Jasmine (see tests)
* Custom scripts/tools
These tools are all installed by running the `setup.sh` script from the Build repository.
## Configurations
### PhpMessDetector
## External Tools
As external tool scrutinizer is used to automate code inspection and provide insight on issues, bugs, best practices etc.

View File

@ -0,0 +1,28 @@
# Codes
Supported codes are:
* C25
* C39
* C128 (C128a and C128b)
* Codebar
* Datamatrix
* Aztec
* QR
All codes expect the string to encode as parameter, the basic dimensions (width, height) and optionally the orientation for barcodes. The hoirzontal barcode image size will be adjusted automatically based on its length.
```php
$c128b = new C128b('ABcdeFG0123+-!@?', 200, 50);
$c128b->saveToPngFile('path/code.png');
```
The barcodes can be either saved as `png` and `jpeg` or outputted directly.
```php
$c128b = new C128b('ABcdeFG0123+-!@?', 200, 50);
$c128b = $C128a->get();
header ('Content-type: image/png');
imagepng($c128b);
imagedestroy($c128b);
```

View File

View File

@ -1 +0,0 @@
# Dev Environment