RandCondMat

버전 1.0.0.0 (2.21 KB) 작성자: Ofek Shilon
Generates a random square matrix of given size, condition number, and optionally - norm.
다운로드 수: 1.2K
업데이트 날짜: 2006/8/17

라이선스 없음

A = RANDCONDMAT(n, cond, options)
Generates a random n x n matrix with the condition number equal to cond.

A = RANDCONDMAT(...,'symmetric')
Generates a symmetric A.

A = RANDCONDMAT(...,'positive')
Generates a positive definite (either symmetric or not) A.

A = RANDCONDMAT(...,'norm', nrm)
Forces A's matrix norm to equal nrm. Defaults to 1.

This utility can be useful in various tests of numerical algorithms. Example:

n=100;
nchecks = 100
t=zeros(nchecks,1);
er=zeros(nchecks,1);

for i=1:nchecks;
cnd = 30*i;
A = RandCondMat(n,cnd,'symmetric','positive');
b= rand(n,1);
tic; x = pcg(A,b); t(i)=toc;
er(i) = norm(b - A*x);
end
plot ([er,1000*t]); legend('absolute error','time (ms)')

REMARK:
Do not make any assumptions about the distribution of the drawn matrices - specifically, it is not uniform with respect to the induced Lebesgue measure in R^(n^2). The most that can be said is that any matrix in a specified category (e.g., symmetric+positive) is reacheble in principle, using the implemented algorithms.

인용 양식

Ofek Shilon (2024). RandCondMat (https://www.mathworks.com/matlabcentral/fileexchange/11782-randcondmat), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2006a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

warning remarks added, support for positive + non-symmetric restored (using a different algorithm).