Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Matlab でランダム順列行列 (サイズ 1000 x 1000 など) をシミュレートする簡単な方法はありますか? このような行列の独立和の固有値分布を調べたいと思います。
前もって感謝します!
次のようにランダム順列行列を生成できます。
ユニティ マトリックスを作成します。
A = eye( N ); %// N is the size of your matrix
の値が大きい場合は、疎行列Nを使用することをお勧めします。
N
A = speye( N ); % create sparse identity matrix
ランダム順列を生成します。
idx = randperm(1:N);
ベクトル インデックスを使用して、行を適切に再配置します。
A = A(idx, :);
出来上がり!