subtract() public static method

[x₁ - y₁, x₂ - y₂, ... ]
public static subtract ( variadic $arrays ) : array
$arrays variadic Two or more arrays of numbers
return array
示例#1
0
 /**
  * Get the regression residuals
  * eᵢ = yᵢ - ŷᵢ
  * or in matrix form
  * e = (I - H)y
  *
  * @return array
  */
 public function residuals() : array
 {
     return Multi::subtract($this->reg_ys, $this->reg_Yhat);
 }
示例#2
0
 /**
  * Subtract (A - B)
  *
  * A = [a₁, a₂, a₃]
  * B = [b₁, b₂, b₃]
  * A - B = [a₁ - b₁, a₂ - b₂, a₃ - b₃]
  *
  * @param Vector $B
  *
  * @return Vector
  */
 public function subtract(Vector $B) : Vector
 {
     if ($B->getN() !== $this->n) {
         throw new Exception\VectorException('Vectors must be the same length for subtraction');
     }
     $R = Map\Multi::subtract($this->A, $B->getVector());
     return new Vector($R);
 }