numpy 1.22.4 Pypi GitHub Homepage
Other Docs
BackRef
_multi_dot_matrix_chain_order(arrays, return_costs=False)

The optimal order array is then used by :None:None:`_multi_dot()` to do the multiplication.

Also return the cost matrix if :None:None:`return_costs` is :None:None:`True`

The implementation CLOSELY follows Cormen, "Introduction to Algorithms", Chapter 15.2, p. 370-378. Note that Cormen uses 1-based indices.

cost[i, j] = min([

cost[prefix] + cost[suffix] + cost_mult(prefix, suffix) for k in range(i, j)])

Return a np.array that encodes the optimal order of mutiplications.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.linalg.linalg._multi_dot_three

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/linalg/linalg.py#2749
type: <class 'function'>
Commit: