Linear Transformations

Scale Transformation

In PHP it can be written as a class LinearTransformation with implementation of linear transformation operations.

 
<?php

// Example 1: 2x2 matrix (scale transformation)
$transformMatrix = [
    [
20],
    [
03]
];

$vector2D = [12];

$transformation2D = new LinearTransformation($transformMatrix);
$result2D $transformation2D->transform($vector2D);

echo 
"2D Transformation Result: [<span id='output-vector'>" implode(", "$result2D) . "</span>]\n";

Chart:


Transformation Matrix ($A$)
Input Vector ($x$)
Output Vector ($Ax$)
0
0

Result: Memory: 0.001 Mb Time running: < 0.001 sec.
2D Transformation Result: [2, 6]