minors.php 672 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. *
  4. * Function code for the matrix minors() function
  5. *
  6. * @copyright Copyright (c) 2018 Mark Baker (https://github.com/MarkBaker/PHPMatrix)
  7. * @license https://opensource.org/licenses/MIT MIT
  8. */
  9. namespace Matrix;
  10. /**
  11. * Returns the minors of a matrix or an array.
  12. *
  13. * @param Matrix|array $matrix Matrix or an array to treat as a matrix.
  14. * @return Matrix The new matrix
  15. * @throws Exception If argument isn't a valid matrix or array.
  16. */
  17. function minors($matrix)
  18. {
  19. if (!is_object($matrix) || !($matrix instanceof Matrix)) {
  20. $matrix = new Matrix($matrix);
  21. }
  22. return Functions::minors($matrix);
  23. }