AJgoHthmZZ3. T r i a n g u l a r to M a t r i x o r M a t r i x to T r i a n g u l a r C o n v e r s i o n in A P L full matrix. The variable B is the position of the first blank in C. Line 4 branches to the label V2M (vector to matrix) on fine 15 if the argument X is a vector. Line 5 converts a matrix to a vector by selection. A boolean vector is generated for the selection of elements from the raveled input matrix. The program exits at this point, returning the vector. Lines 6 and 7 determine the shape of the resultant matrix: For a diagonal matrix, this is the number of elements in X; for others, this is an index of the elements of V which contains the length of the input vector X. Line 8 constructs a matrix of pxo~r dimensionality, filling one triangular portion with the input vector values. Line 9 utilizes transpose to fill the other triangular portion. Line 10 exits if the diagonal is to be
/lp/association-for-computing-machinery/triangular-to-matrix-or-matrix-to-triangular-conversion-in-apl-dCjHyUoOcn