Google Summer of Code Week 9: Matrices to Indexed

Posted on July 22, 2019 by Ankit Pandey

See the previous post for Week 8.

For this week, I’ve started with #17299. This pull request is meant to extend support for the MatrixExpr class by allowing for conversion into an Indexed class in which contractions equivalent to the matrix expression are represented.

Conversion to Indexed

The as_indexed method that the pull request introduces is pretty self-explanatory:

A matrix multiplication between two matrix symbols is equivalent to a contraction along the index jj (Since matrix multiplication is equivalent to a contraction along a single index).

Relationship to Codegen

The purpose of the pull request is to allow conversion to help in the generation of code related to some matrix expressions. This is because there’s already an existing infrastructure for code generation through contractions (something that the still-WIP #17170 addresses). The currently work in progress PR is meant to aid in extending code generation to matrix expressions instead of just Indexed objects. This same conversion might also be possible using the Codegen* classes in array_utils, though this way seems to make more sense since it’s entirely possible to use the function for non-codegen related purposes.

Next steps

My plans for this week are to continue working on the pull request and start with the new Matrix Wildcard pull request.