| 809 | |
| 810 | |
| 811 | MatrixQuadrantInds getTruncatedMatrixQuadrantInds(qindex numRows, qindex numCols) { |
| 812 | |
| 813 | MatrixQuadrantInds inds; |
| 814 | |
| 815 | // find maximum size of matrix quadrants according to user-truncatins. |
| 816 | // Choose right & lower first so that When num=odd, extra left & upper elem is shown |
| 817 | qindex maxNumRightCols = global_maxNumPrintedCols / 2; // floors |
| 818 | qindex maxNumLeftCols = global_maxNumPrintedCols - maxNumRightCols; |
| 819 | qindex maxNumLowerRows = global_maxNumPrintedRows / 2; // floors |
| 820 | qindex maxNumUpperRows = global_maxNumPrintedRows - maxNumLowerRows; |
| 821 | |
| 822 | // may be ignored (and will unimportantly underflow when not truncating) |
| 823 | inds.rightStartCol = numCols - maxNumRightCols; |
| 824 | inds.lowerStartRow = numRows - maxNumLowerRows; |
| 825 | |
| 826 | // decide among four possible quadrant population configurations; |
| 827 | // this code can be significantly shortened but we leave it explicit |
| 828 | // for clarity, and so that *NumRows=0 <=> *NumCols=0 |
| 829 | |
| 830 | if (numRows <= global_maxNumPrintedRows && numCols <= global_maxNumPrintedCols) { |
| 831 | |
| 832 | // upper left contains entire matrix |
| 833 | inds.numUpperLeftRows = numRows; inds.numUpperLeftCols = numCols; |
| 834 | |
| 835 | } else if (numRows <= global_maxNumPrintedRows) { |
| 836 | |
| 837 | // matrix divided into upper left and upper right (bottoms empty) |
| 838 | inds.numUpperLeftRows = numRows; inds.numUpperLeftCols = maxNumLeftCols; |
| 839 | inds.numUpperRightRows = numRows; inds.numUpperRightCols = maxNumRightCols; |
| 840 | |
| 841 | } else if (numCols <= global_maxNumPrintedCols) { |
| 842 | |
| 843 | // matrix divided into upper left and lower left (rights empty) |
| 844 | inds.numUpperLeftRows = maxNumUpperRows; inds.numUpperLeftCols = numCols; |
| 845 | inds.numLowerLeftRows = maxNumLowerRows; inds.numLowerLeftCols = numCols; |
| 846 | |
| 847 | } else { |
| 848 | |
| 849 | // matrix divided into into four quadrants |
| 850 | inds.numUpperLeftRows = maxNumUpperRows; inds.numUpperLeftCols = maxNumLeftCols; |
| 851 | inds.numUpperRightRows = maxNumUpperRows; inds.numUpperRightCols = maxNumRightCols; |
| 852 | inds.numLowerLeftRows = maxNumLowerRows; inds.numLowerLeftCols = maxNumLeftCols; |
| 853 | inds.numLowerRightRows = maxNumLowerRows; inds.numLowerRightCols = maxNumRightCols; |
| 854 | } |
| 855 | |
| 856 | return inds; |
| 857 | } |
| 858 | |
| 859 | |
| 860 |
no outgoing calls
no test coverage detected