Recommend this page to a friend! |
Classes of Abed Nego Ragil Putra | PHP Inventory Management System with Scanner | vendor/markbaker/matrix/README.md | Download |
|
DownloadPHPMatrixPHP Class for handling Matrices Matrix Transform This library currently provides the following operations: - addition - direct sum - subtraction - multiplication - division (using [A].[B]<sup>-1</sup>)
together with functions for - adjoint - antidiagonal - cofactors - determinant - diagonal - identity - inverse - minors - trace - transpose TO DO- power() - EigenValues - EigenVectors - Decomposition UsageTo create a new Matrix object, provide an array as the constructor argument
The
Will create a matrix of 5 rows and 3 columns, filled with a
will create a 3x3 identity matrix. Matrix objects are immutable: whenever you call a method or pass a grid to a function that returns a matrix value, a new Matrix object will be returned, and the original will remain unchanged. This also allows you to chain multiple methods as you would for a fluent interface (as long as they are methods that will return a Matrix result). Performing Mathematical OperationsTo perform mathematical operations with Matrices, you can call the appropriate method against a matrix value, passing other values as arguments
or pass all values to the appropriate function
You can pass in the arguments as Matrix objects, or as arrays. If you want to perform the same operation against multiple values (e.g. to add three or more matrices), then you can pass multiple arguments to any of the operations. Using functionsWhen calling any of the available functions for a matrix value, you can either call the relevant method for the Matrix object
or you can call the function as you would in procedural code, passing the Matrix object as an argument
When called procedurally using the function, you can pass in the argument as a Matrix object, or as an array.
As an alternative, it is also possible to call the method directly from the
Used this way, methods must be called statically, and the argument must be the Matrix object, and cannot be an array. |