Commit 56ca0c83 authored by Andrey Filippov's avatar Andrey Filippov

dding polinomial approximation 2d

parent 6c5510bb
......@@ -23,6 +23,11 @@ class Matrix
return $this->M;
}
public function set($i,$j,$v){
$M[$i][$j] = $v;
}
public function getColumnPackedCopy(){
$rows = sizeof($this->M);
$cols = sizeof($this->M[0]);
......@@ -82,6 +87,9 @@ class Matrix
}
public function plus($B) {
if ($B instanceof Matrix){
$B = $B->get();
}
$R = $this->M;
$rows = sizeof($this->M);
$cols = sizeof($this->M[0]);
......@@ -95,6 +103,21 @@ class Matrix
}
return new Matrix ($R, $this->Tol);
}
public function plusEquals($B){
if ($B instanceof Matrix){
$B = $B->get();
}
$rows = sizeof($this->M);
$cols = sizeof($this->M[0]);
if (($rows != sizeof($B[0])) || ($cols != sizeof($B[0]))){
throw new Exception('Dimensions mismatch.');
}
for ($i = 0; $i < $rows; $i ++) {
for ($j = 0; $j < $cols; $j ++) {
$this->M[$i][$j] += $B[$i][$j];
}
}
}
public function print($debugFile = null, $decimals = 6)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment