Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhufei Chu committed Sep 18, 2024
1 parent 6e0f1d8 commit 264c1e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions docs/stp_compute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,19 @@ this as matrix chain STP computation.

Sequence
^^^^^^^^^^^^^^^^^^^^^
The matrix are multiplied one by one in sequence. For example, we have 4
matrices :math:`A`, :math:`B`, :math:`C`, and :math:`D`. The parenthesis of
the matrix chain is
The matrix chain STP is calculated by sequential order. For example, we have 4
matrices :math:`A`, :math:`B`, :math:`C`, and :math:`D`. The parenthesized
expression of the matrix chain multiplication is as follows:

.. math::
ABCD = (((AB)C)D).
Dynamic Programming
^^^^^^^^^^^^^^^^^^^^^
As the computation complexity is distinct if we use different parenthesis
method, we also propose a dynamic programming method for matrix chain STP
computation. We may have an optimal parenthesis for the matrix chain as
Since the computational complexity varies depending on the method of
parenthesizing, we also propose a dynamic programming approach for matrix
chain STP computation. This approach allows us to determine the optimal
parenthesization of the matrix chain.

.. math::
ABCD = ((AB)(CD)).
Expand Down
2 changes: 1 addition & 1 deletion examples/stp_multi_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main()
std::vector<std::string> input_names{ "x_1", "x_2", "x_3", "x_4", "x_5", "x_6", "x_7", "x_8", "x_9", "x_10", "x_11", "x_12" };
auto mc = stp::expr_normalize_to_chain( expr, input_names );

auto mat1 = stp::matrix_chain_multiply_by_multi_thread( mc, 2, false, true);
auto mat1 = stp::matrix_chain_multiply_by_multi_thread( mc, 1, false, true);
auto mat2 = stp::matrix_chain_multiply_by_multi_thread( mc, 2, true, true);

assert(mat1 == mat2);
Expand Down
1 change: 1 addition & 0 deletions include/stp/stp_multi_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
\file stp_multi_thread.hpp
\brief header file for stp multi thread calculation
\author Zhufei Chu
\author Ruibing Zhang
*/

#pragma once
Expand Down

0 comments on commit 264c1e5

Please sign in to comment.