|
|
5#

楼主 |
发表于 2010-7-2 16:14:25
|
只看该作者
Re: 请教高手:如何把下三角矩阵转为对称矩阵?
写着玩的,9.2可用
[code:3hjgfunz]proc fcmp outlib=work.func.quot;
subroutine symmetric_matrix(in_ds $,out_ds $);
array in[1] /nosymbols;
array var[1] /nosymbols;
rc=read_array(in_ds,in);
n=dim(in);
call dynamic_array(var,n,n);
call transpose(in,var);
do i=1 to n;
do j=1 to n;
if i>j then var[i,j]=in[i,j];
end;
end;
rc=write_array(out_ds,var);
endsub;
run;
data a;
input x1-x3;
datalines;
1 . .
2 1 .
3 4 1
;
options cmplib=work.func;
data _null_;
call symmetric_matrix('a','b');
run;[/code:3hjgfunz] |
|