Commands to manipulate the internal stack set up by rpnfcn()
Command name Argument
These functions are used to place matrices into the appropriate places in the stack used by rpnfcn(). &tostack() places the matrix x in a new top element of the stack. &enter() copies the current top element of the stack to a new top element in the stack. &swapst() swaps the two top elements of the stack. &rotst() rotates the stack one step down, meaning that the bottom-most element becomes the top element, while all others are shifted one step down.
The commands &tostack() and &enter() both copies the indicated matrix, and for very large matrices the user must thus ensure that Stata has sufficient memory to execute the command. The commands &swapst() and &rotst() on the other hand do not move or copy matrices as such, but rather rearranges their labels (the pointers in the stack) so as to create the desired effect.
Henrik StÝvring, Research Unit of General Practice, University of Southern Denmark. Please email firstname.lastname@example.org if you have comments, questions or observe any problems.
Manual: [M] Mata Reference Manual
Online: help for [M-0] mata, Evaluation of algorithm matrix using RPN, RPN binary operators, RPN distribution functions, RPN functions for integration