lessthanoptimal / ejml

A fast and easy to use linear algebra library written in Java for dense, sparse, real, and complex matrices.
https://ejml.org
565 stars 118 forks source link

X^T X. for DDRM? #146

Closed tr8dr closed 3 years ago

tr8dr commented 3 years ago

I've been scouring the various dense matrix helper classes but have not come across a class with specializations for computing the Gramian matrix X^T X. This form occurs in OLS and many other scenarios. Doing a X.transpose.mult(X) would be super expensive for a rectangular X of large size (where rows >> columns), whereas the product is a much smaller result.

Does this exist somewhere in the code and I have not come across it?

lessthanoptimal commented 3 years ago

CommonOps_DDRM.multTransA(A,B,C) is probably what you want to use.

tr8dr commented 3 years ago

thx!