Post Reply 
Little explorations with HP calculators (no Prime)
03-31-2017, 08:33 PM (This post was last modified: 03-31-2017 08:34 PM by pier4r.)
Post: #93
RE: Little explorations with the HP calculators
Ok, with the help of the "profiling subprogram" (1) I found the most time consuming function. With flag -3 and -105 set (so, no exact mode) each call lasts for an (eyeballed) average of 3 seconds. There are 480 calls to this function, that requires a total of 24 minutes. There is other code to execute, but the time spent on the rest of the code is less than the one used for this function.

What the function does is the following.
- Given this matrix
- produce a random value between 1 and 7225, call it curProbV
- from the first row to the last row of the matrix, check if curProbV is smaller that the element in the first column (I thought I could start from the bottom, but since curProbV is random, it would not matter).
- if you find that the value is smaller, take the third element in the row and return it.

I do use some algebraic notation to avoid having problems to read in the code that what I do is reading a matrix. Could be that this extend the execution of the function to 3 seconds?

The rpl code is the following

    @program to extract the variance out of the built matrix
    @output, the variance of the strength points out of the matrix

    0 @curProbV
    0 @tmpV
    @external inputs
    @local var
      \<-maxSumProbV RAND * 1 + IP 'curProbV' STO
        @ we get a random number that has to be compared with the probability sums
      1 'tmpV' STO
        @with tmpV we will use it as a counter
      \<-uFmatchingProbFound CF
        \<-uFmatchingProbFound FC?
        tmpV \<-numProbV \<=
          curProbV '\<-mVarProb(tmpV, \<-colSumProb)' EVAL \<=
          @ found a probability sum bigger than the actual random value.
          \<-uFmatchingProbFound SF
          1 'tmpV' STO+
      '\<-mVarProb(tmpV, \<-colVar)' EVAL


    @profiling single blocks. This code is called as the profiled function.
    'getVarFunc' TEVAL
    @savings TEVAL values
    'timings' STO+
    " @breakline
    'timings' STO+
    @leaving the original value on the stack.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Little explorations with the HP calculators - pier4r - 03-31-2017 08:33 PM

User(s) browsing this thread: 1 Guest(s)