全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1300 0
2012-03-30
The Cholesky decomposition can be used in a data step by defined it within fcmp. Also see https://bbs.pinggu.org/thread-1129334-1-1.html

proc fcmp outlib=sasuser.funcs.temp;;
     subroutine Choleskydecom (mat[*,*],lmat[*,*] );
      outargs lmat;
      call chol(mat, lmat);
      endsub;
run;
quit;

options cmplib=sasuser.funcs;

data _null_;
  array a(5,5) _temporary_   (
0.9858668         0.9832139         0.8740793         0.9125018         0.8980966,
0.9832139         2.0058248         2.0107842         2.0543280         2.0244553,
0.8740793         2.0107842        99.1966824        99.1846182        99.0462248,
0.9125018         2.0543280        99.1846182       100.1625760       100.0319877,
0.8980966         2.0244553        99.0462248       100.0319877       100.8799631
                             );
  array b(5,5) _temporary_ ;
  call Choleskydecom (a, b);

  do i=1 to dim1(b);
    do j=1 to dim2(b);
      pos=1+13*j;
      put b[j,i] @pos @;
    end;
    put;
  end;
run;

***check with iml;

proc iml;
a={ 0.9858668         0.9832139         0.8740793         0.9125018         0.8980966,
0.9832139         2.0058248         2.0107842         2.0543280         2.0244553,
0.8740793         2.0107842        99.1966824        99.1846182        99.0462248,
0.9125018         2.0543280        99.1846182       100.1625760       100.0319877,
0.8980966         2.0244553        99.0462248       100.0319877       100.8799631
    };
b=root(a);
print b;
quit;



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群