Not sure this is the preferable way but one solution might be:

   load 'math/misc/matfacto'
   matrixrank=: #@(] -. 0 #~ #)@(1 {:: lud)

matrixrank _3 ]\ 1 2 3 5 4 6 9 7 8

3

matrixrank _3 ]\ 1 2 3 2 4 6 9 7 8

2


Note that "rank" has lots of alternative meanings in J other than
calculating the matrix rank.


On Fri, Jan 14, 2022 at 8:51 AM Pawel Jakubas <jakubas.pa...@gmail.com>
wrote:

> Dear J enthusiasts,
>
> I am wondering what is the preferable way to determine the rank of a matrix
> in J.
> I would expect here below
>
>    ]m=: 3 3 $ 1 2 3 5 4 6 9 7 8
> 1 2 3
> 5 4 6
> 9 7 8
>   rank m
> 3
>
>    ]m=: 3 3 $ 1 2 3 2 4 6 9 7 8
> 1 2 3
> 2 4 6
> 9 7 8
>   rank m
> 2
>
> Thanks and cheers
> Pawel Jakubas
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to