romeric / Fastor

A lightweight high performance tensor algebra framework for modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How should I understood "Compile time operation minimisation such as graph optimisation, greedy matrix-chain products and nearly symbolic manipulations to reduce the complexity of evaluation of BLAS or non-BLAS type expressions by orders of magnitude"

Realtyxxx opened this issue · comments

I'm learning the Fastor by interest, AndI want to know what is "greedy matrix-chain products "

commented

Suppose you have

d = A * B * c

where A and B are matrices and c and d are vectors. If you multiply from left to right that is A->B->c you end up doing a matrix-matrix multiplication A*B which is costly. If you multiply from right-to-left A<-B-<c then the matrix-vector product B*c is computed first as an intermediate matrix e = B*c and finally we get d=A*e which is another matrix-vector product. So we reduce matrix-matrix multiplication to matrix-vector multiplication which is certainly faster.
This is greedy-matrix chain product in a nutshell. Obviously, Fastor is capable of reducing the cost of much more complicated expressions.