The Museum of HP Calculators

HP Forum Archive 20

 WP 34S matrix operationsMessage #1 Posted by Paul Dale on 10 Oct 2011, 5:16 a.m. I've added a number of matrix routines to the library/matrix.wp34s file. This along with Marcus's matrix editor is about half a flash region. We'd like to provide a full region of matrix functions if possible. My question is then "What extra functions should go in?" Suggestions are welcome, suggestions with code are better :-) These aren't going to be held to the same standard as the internal user code commands -- wreck the stack, use the lettered registers and flags and generally have fun. I am aware of these functions but thought I'd see what people wanted before diving in and doing the ones I find interesting (and probably completely useless). The existing functions in user code are: M.1 - Create an identity matrix from a descriptor in X. No stack damage, L changed. M.0 - Create an zero matrix from a descriptor in X. No stack damage, L changed. ATR - Return the sum of the absolute values of the matrix diagonal. TR - Return the trace of the matrix. M- - Matrix subtraction. M+ - Matrix addition. M.y - Multiply matrix by scalar. FNM - Frobenius norm. RNM - Row norm. CNM - Column norm. MFD - Find element in matrix. M^ - Find the maximum element in matrix. Mv - Find the minimum element in a matrix. Yes, these need better documentation. These are implemented internally and documented reasonably in doc/matrix.txt: M.TRN - Matrix transpose in-situ. M.times - Matrix multiply. M.+times - Matrix addition & scalar multiplication. M.R<-> - Matrix row swap. M.Rtimes - Multiply row by scalar. M.R+times - Multiply a row by a scalar and add to another row. M.IJ - Convert a register index to row/column indices. M.REG - Convert row/column indices to a register index. M.ALL - Return a loop index to iterate over the entire matrix. M.DIAG - Return a loop index to iterate over the diagonal of the matrix. M.ROW - Return a loop index to iterate over a row of the matrix. M.COL - Return a loop index to iterate over a column of the matrix. M.ROW? - Extract the row count from a matrix descriptor. M.COL? - Extract the column count from a matrix descriptor. M.SQR? - Check if a matrix descriptor is for a square matrix & execute the next step if not. M.COPY - Copy a matrix to another location. M.DET - Calculate the determinant of a matrix. M.LIN - Solve a system of linear equations. M.INV - Invert a matrix in-situ. This seems like a fairly good selection of operations. Their names might change, but the functions are very unlikely to. - Pauli

 Re: WP 34S matrix operationsMessage #2 Posted by Miguel Toro on 10 Oct 2011, 7:57 a.m.,in response to message #1 by Paul Dale May I suggest my little editor? Code is already there :-) Regards, Miguel

 Re: WP 34S matrix operationsMessage #3 Posted by Paul Dale on 10 Oct 2011, 8:06 a.m.,in response to message #2 by Miguel Toro I did think about this one but didn't act. I'll put it in. - Pauli

 Re: WP 34S matrix operationsMessage #4 Posted by Paul Dale on 10 Oct 2011, 8:15 a.m.,in response to message #2 by Miguel Toro And done. - Pauli

 Re: WP 34S matrix operationsMessage #5 Posted by Carey on 11 Oct 2011, 3:45 a.m.,in response to message #1 by Paul Dale Please forgive if the following matrix functions were previously considered or require too many resources, but useful would be: ```* eigenvalues * eigenvectors * singular value decomposition (svd) * singular values ``` Regards, Carey

 Re: WP 34S matrix operationsMessage #6 Posted by Paul Dale on 11 Oct 2011, 3:50 a.m.,in response to message #5 by Carey All of these are under consideration, although I've coded none of them. I'm not sure how to deal with complex results, at least at the moment. - Pauli

Go back to the main exhibit hall