Talk:Matrix chain multiplication

message: I think it's not justified to say that string concat is O(n+m),
one has to distinguish
* the search for the end token (in O(n), but only READ), and
* the creation of the new string (requiring
:* memory allocation (which might be more expensive than all the rest, depending on implementation (default MEM_CLEAR or so))
:* COPYING of the first and then the second string (READ + WRITE in another memory segment, O(n+m) operations)
On the other hand, if one uses reference counting and allows for segmented string storage, then the concatenation takes virtually no time.
Concerning "memoization", why the heck did this guy not call it memorization ??? (Or memo'ization ?)
And finally, I would be astonished if there was no better ("local") method for optimizing this matrix problem, rather than checking all possible combinations... I'll think about this... MFH 13:43, 24 Mar 2005 (UTC)
replies: text: Greedy algorithms don't work well for this problem, because locally optimal solutions may turn out to force a globally poor solution — not that there aren't decent approximation algorithms based on heuristics. If you click on the memoization link, you'll discover that this is not a misspelling, like everyone always assumes (I wish they'd pick a less confusing word). You're right that different approaches to string concatenation take very different amounts of time. This is mostly irrelevent, since the technique works with any cost function, but the specific cost I give is for a C strcat() call without any reallocation (it's assumed sufficient space is available after the first string). Deco 23:15, 24 Mar 2005 (UTC)
thread_title:  cost of string concatenation 

message: I had a hard time understanding the pseudocode because of the variable 'l', which is defined in the outer-most main loop. The statements "n-l+1" and "i+l-1" appeared to me as "n-1+1" and "i+1-1". (I could not distinguish the 'l' variable from the '1'. In anti-aliased Courier New font, the difference was very small for my eye to see.)
I first thought that these statements may be intended by the writer to indicate that 1 was removed for some reason and added for a different reason (as when a loop is said to run (n-1)+1 times). I then couldn't figure out the reasons, and it took me quite some time to understand that it is an 'l'. (Actually I was already writing in the discussion page to ask how the algorithm could be like that - it would be definitely wrong.)
I wish you could take this into consideration (in this and other articles), and use a variable other than 'l'. In this specific algorithm, the name "len" may be good.
Thanks. --Hosam Aly 19:39, 7 January 2007 (UTC)
thread_title:  Ambiguity due to using variable 'l' 

message: Although this problem is often quoted as a good way to teach dynamic programming, the resulting O(n^3) time complexity is very poor compared to the best known.  O(n log n) time can be achieved by observing that the problem can be reduced to that of finding the minimum weight triangulation of a polygon.
87.194.206.189 (talk) 13:06, 21 December 2008 (UTC)
replies: text: Agreed, I have added a stub for this. kostmo (talk) 22:02, 4 April 2009 (UTC)
thread_title:  No reference to much more efficient ways to solve the problem 

message: PRINT-OPTIMAL-PARENS(s, i, j)
if i=j
   print ′′A′′i ;
else
    print ”(”;
    PRINT-OPTIMAL-PARENS(s, i, s[i, j])
    PRINT-OPTIMAL-PARENS(s, s[i, j]+1, j)
    print ”)”
this is the pseudocode to find final  order of the matrix multiplication but i am having problem in solving the problem manually  —Preceding unsigned comment added by Pathakamit90 (talk • contribs) 02:19, 14 February 2010 (UTC)
thread_title:  final order of the matrix multiplication 

message: This page needs a lot more setup. It might help to say things like multpling an nxm by a mxk n*m*k, and that order matters (before getting into the example) and that this is a common problem. 018 (talk) 19:18, 11 October 2011 (UTC)
thread_title:  setup 

message: If you know of algorithms for these problems would you add them to the article?
Problem #1: When the product of several matrices ABCDE is square, its matrix trace Tr(ABCDE) can be computed faster than with a two step process of first computing the product of the matrices P=ABCDE and then computing the trace of that product Tr(P).  This arises for two reasons:
# Only the diagonal entries of P need to be computed.  For instance if the last two matrices to be multiplied are (ABC), which is v0×v3, and (DE), which is v3×v5, with v0=v5, then the trace of that product can be computed in time O(v0v3) rather than in time O(v0v3v5).
# We can exploit that the matrix trace is preserved under cyclic permutations.  That is, Tr(ABCDE) = Tr(BCDEA) = Tr(CDEAB) = Tr(DEABC) = Tr(EABCD).
Is there an efficient algorithm that simultaneously finds the cyclic permutation and order of matrix multiplications to most efficiently compute Tr(ABCDE)?
Problem #2: When the product of several matrices ABCDE is square, the matrix determinant det(I+ABCDE) can be computed.  We can exploit cyclic permutations as before, using that det(I+ABCDE) = det(I+BCDEA) = det(I+CDEAB) = det(I+DEABC) = det(I+EABCD).  Instead of the time savings with the last matrix multiplication that we had for the matrix trace, we have an extra cost, that of computing the determinant, which depends upon the matrix dimensions of whichever of I+ABCDE, I+BCDEA, I+CDEAB, I+DEABC, I+EABCD we are computing the determinant of in the last step.
Is there an efficient algorithm that simultaneously finds the cyclic permutation and order of matrix multiplications to most efficiently compute det(I+ABCDE)?
Leegrc (talk) 13:19, 28 January 2015 (UTC)
thread_title:  Solving similar problems 

message: Hello fellow Wikipedians,
I have just modified one external link on Matrix chain multiplication. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
*Added archive https://web.archive.org/web/20110722132611/http://ccs.korea.ac.kr/pds/tpds03.pdf to http://ccs.korea.ac.kr/pds/tpds03.pdf
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
Cheers.—InternetArchiveBot (Report bug) 15:40, 21 January 2018 (UTC)
thread_title:  External links modified (January 2018) 

message: Recently, the reference to the original Stanford article was removed. The removed reference contains proofs omitted in the published journal version. The journal version explicitly refers to the Stanford article for details as reference 9 (part 1) and reference 7 (part 2) respectively. That's why I prefer to keep the Stanford article as well.
On the other hand, though the Stanford article is complete, the typesetting of the journal is a lot better, so I prefer to keep the journal versions as well for readability.  — Preceding unsigned comment added by R.J.C.vanHaaften (talk • contribs) 10:43, 28 July 2018 (UTC)
replies: text: Wikipedia policy is to refer only to WP:reliable sources. Generally, technical reports are not considered as reliable sources. Here, referring to the technical report could make sense if the article would mention a detail that is in the technical report and not in the published article. This is not the case. Thus there is no reason for citing the technical report. D.Lazard (talk) 11:56, 28 July 2018 (UTC)
replies: text: I agree to the policy you mention, but I don't understand your assessment. The published article refers to the report, omitting details explicitly (Lemma 1: "Proof. Omitted. See [7] for details."). That's why I retained the report, though I agree on preferring the published article. R.J.C.vanHaaften (talk) 16:33, 28 July 2018 (UTC)
replies: text: The published article suffices for a reader who want not knowing all details. For a reader who want to know all details, it is better to read first the published article, and then follow the links there to the technical report. So, in all cases there is no need to refer, in WP, to the technical report. D.Lazard (talk) 17:32, 28 July 2018 (UTC)
replies: text: Well in this case it turns out one of the omitted proofs is wrong. So I've added the TR back. --Mathnerd314159 (talk) 00:30, 23 April 2022 (UTC)
thread_title:  Removal of reference