Search code examples
matrixjulialinear-algebranumerical-methods

How to generate random matrix of arbitrary rank in Julia?


Is there any way in Julia to generate a random matrix that has some arbitrary/specified rank? For example, is there any function that would allow generating a random 3x3 matrix of rank 2?


Solution

  • This depends a little on what you mean by "random matrix" (i.e. what distribution?), but rand(3,2)*rand(2,3) will produce a random matrix 3x3 matrix of rank 2 with some distribution.