, given a certain access method. The mentioned access method is provided by a concrete implementation of {@link Address} which is passed to constructors.Doing so, it is possible to access the same underlying unidimensional data storage in various different ways, which allows us obtain another Matrix (see method {@link Matrix#range(int,int,int,int) and alike}) from an existing Matrix without any need of copying the underlying data. Certain operations benefit a lot from such approach, like {@link Matrix#transpose()} whichpresents constant execution time.
The price we have to pay for such flexibility and benefits is that an access method is necessary, which means that a the bytecode may potentially need a dereference to a class which contain the concrete implementation of method op(int row, int col)
. In order to keep this cost at minimum, implementation of access method keep indexes at hand whenever possible, in order to being able to calculate the actual unidimensional index as fast as possible. This additional dereference impacts performance more or less in the same ways dereference impacts performance when a bidimensional array (double[][]
) is employed. Contrary to the bidimensional implementation, our implementation can potentially benefit from bytecode inlining, which means that calculation of the unidimensional index can be performed potentially faster than calculation of address location when a bidimensional array (double[][]
) is used as underlying storage.
Assignment operations
opr method this right result --- ---------- ------- -------- ------ = assign Matrix Matrix (1) += addAssign Matrix Matrix this -= subAssign Matrix Matrix this *= mulAssign Matrix scalar this /= divAssign Matrix scalar this
Algebraic products
opr method this right result --- ---------- ------- -------- ------ + add Matrix Matrix Matrix - sub Matrix Matrix Matrix - negative Matrix this * mul Matrix scalar Matrix / div Matrix scalar Matrix
Vectorial products
method this right result -------------- ------- -------- ------ mul Matrix Array Array mul Matrix Matrix Matrix
Decompositions
method this right result -------------- ------- -------- ------ lu Matrix LUDecomposition qr Matrix QRDecomposition cholensky Matrix CholeskyDecomposition svd Matrix SingularValueDecomposition eigenvalue Matrix EigenvalueDecomposition
Element iterators
method this right result ------------ ------- -------- ------ rowIterator Matrix RowIterator columnIterator Matrix ColumnIterator
Miscellaneous
method this right result -------------- ------- -------- ------ transpose Matrix Matrix diagonal Matrix Array determinant Matrix double inverse Matrix Matrix solve Matrix Matrix swap Matrix Matrix this range Matrix Matrix Matrix
(1): clone()
(2): Unary + is equivalent to: array.clone()
(3): Unary ? is equivalent to: array.clone().mulAssign(-1)
@note This class is not thread-safe
@author Richard Gomes