 Open source cross-platform software of geometry, analysis and simulation - Yves Biton

Home Introduction

# MathGraph32 version 7.2 : Possibility of sorting the cells of a matrix

publication Wednesday 2 March 2022.

7.2.1 version of MathGraph32 brings up the two new functions to be applied on matrices : If A is a matrix of n lines and p columns, function sortbyrow(A, k) returns a new matrix of n lines and p columns formed with the columns of matrix A sorted by increasing order of the cells of the line number k of matrix A (for k ranging between 1 and n). If A is a matrix of n lines and p columns, function sortbycol(A, k) returns a new matrix of n lines and p columns formed with the lines of matrix A sorted by increasing order of the cells of the coloumn number k of matrix A (for k ranging between 1 and p).

Here is an exemple : if A is the matrix $\left( \begin{array}{l} 5 & 1 & 2 \\ 2 & 3 & 1 \\ 1 & 2 & 5 \end{array} \right)$

The matricial calculation B = sortbyrow(A,2) will return matrix $\left( \begin{array}{l} 2 & 5 & 1 \\ 1 & 2 & 3 \\ 5 & 1 & 2 \end{array} \right)$

And matricial calculation C = sortbycol(A,3) will return matrix $\left( \begin{array}{l} 2 & 3 & 1 \\ 5 & 1 & 2 \\ 1 & 2 & 5 \end{array} \right)$