Sum elements in vstack array11/3/2022 ![]() ![]() I have reason to think that sometimes (likely MC version dependent) submatrix does not actually create a new matrix of the specified size and contents, but just creates a data sructure pointing to the original matrix together with some access parameters. I am suspicious of your use of submatrix to get the different size matrices. ![]() ![]() With an explicit repetition count in yout timer routine, there is really no point in the implicit factor of three introduced by summing three instances of the sum. #Sum elements in vstack array windowsDepending on what Mathcad has been doing, you may need to shut down Mathcad and restart it, to get an unfragmented address space (well, as unfragmented as Windows ever leaves it). But it is large enough that memory fragmentation becomes an issue. Element by element, without even a predimensioning so that the matrix is constantly being reallocated to larger sizes, is just toooo slow. You really should have a faster way of calculating the original matrix. I'm too idle to determine if there is any real statistical significance. On a whim, I've just increased the number of samples from 17 to 65 (10 s work) from the sheet I was going to post a sluglike run gave mean 0.811 s, stdev 0.089 s for the multi-region and mean 0.873 s, stdev 0.067 s. I have occasionally thought the response to an "Escape" key seems slower when Mathcad is running a program (v multi-region) and that other applications take longer to respond. I have no idea how the Mathcad interpreter works, but there *may* (or may not) be a difference in how it executes within the Whinedows control loop. The nature of the interpreter also has a bearing on the execution process in a multi-tasking environment. >One way or another, program has to be compiled. >An old vintage, that we discussed in the far past. However, the first run indicates that the multi-region calculation took an average(!) of 0.482 s with a stdev of 0.022 s, whereas the functional timer gave a mean of 0.446 s with a stdev of 0.008 s. >Unfortunately, that can't be generalised !īeauty is the eye of the beholder, but I think you'd need to be blind drunk to think the attached program is beautiful (30 seconds to create, 3 minutes to run!). I have a (qualitative) suspicion that Mathcad 'gives up' less time to other Weirdows applications when an algorithm is implemented as a program. >Call me Paranoid, but I'm a bit suspicious of timings that arise from multi-region calculations. Oh, and with N=4000, on one attempt, the worksheet not only crashed Mathcad, it closed all my IE windows and I found that I couldn't soft restart my PC(had to use the power button). I've reduced the matrix size from N=4000 to N=2000 as my machine won't run the timing function for SumMean with N=4000 (hence my suspicion about mean and resources). I hypothesize that this may be a mean function resource issue. However, there are odd peaks in the mean function times. On my Mathcad 11.2a, Pentium III, 256 MB RAM, NT 4.0 PC, I note that Tom's mean function is generally faster than your nice one. On this basis, I've modified your worksheet a little bit and added a timing function to allow slightly more consistent comparative timings. ![]() Note that both solutions are considerably faster than the original double sum method that I was using (28.5 s on machine #1).Ĭould the significant speed differences that we're seeing here be due to changes in the way things are implemented across different versions?Ĭall me Paranoid, but I'm a bit suspicious of timings that arise from multi-region calculations. So, the SumMatrix program is much faster on one of my machines and somewhat faster on the other. I really expected the second machine to be faster.perhaps extra overhead associated with XP vs 2000? It never crashes and even with less physical memory, never gives me "out of memory" errors (while the first computer does). This is my workhorse calculator - nothing installed other than Mathcad, Matlab, and some numerical packages. My second machine is a Dell P4 also at 2.4 GHz, but with only 512 MB of RAM. I tend to get lots of Mathcad crashes and "unknown error" messages on this machine. I'm running Mathcad 2001 under Windows 2000. I have two computers - one is a Gateway P4 at 2.4 GHz with 1 GB of RAM. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |