Hello everyone!

I hope that you are all having a good week.

I am currently trying to generate a certain number of matrices with random elements, by the range between 0 and 1, where the elements by the main diagonal are zero and the total sum of the elements by row is equal to 1.

My first attempt is the following one:

set i /i1*i10/
j nodes / j1*j10 /

l Loops /l1*l4/;

alias (j,q)

alias (i,t)

;

execseed = 1 + gmillisec(jnow);

parameter d(l,i,j)

;

loop(l,

loop((i,j),d(l,i,j)=uniform(0,1));

loop(i,

loop(j,

if(sameas(i,j),d(l,i,j)=0)

);

);

);

It seems that I am getting there; however, I cannot figure out how to write the necessary code that defines the sum of the elements by column equal to one. Would you please help me with that? I would highly appreciate any help.

Thank you very much.

Best,

Alberto Franco Solís

University of Extremadura, Spain.