#include <stdio.h>
#include <gsl/gsl_linalg.h>
////////////////////////////////////////////////////////////
// Solve Ax = b with LU and cholesky
int main(int argc, char **argv)
{
printf("=========== tst2 ===========\n");
double a_data[] = { 2,1,1,3,2,
1,2,2,1,1,
1,2,9,1,5,
3,1,1,7,1,
2,1,5,1,8 };
double b_data[] = { -2,4,3,-5,1 };
gsl_vector *x = gsl_vector_alloc (5);
gsl_permutation * p = gsl_permutation_alloc (5);
gsl_matrix_view m
= gsl_matrix_view_array(a_data, 5, 5);
gsl_vector_view b
= gsl_vector_view_array(b_data, 5);
int s;
gsl_linalg_LU_decomp (&m.matrix, p, &s);
gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x);
printf ("x = \n");
gsl_vector_fprintf(stdout, x, "%g");
double a2_data[] = { 2,1,1,3,2,
1,2,2,1,1,
1,2,9,1,5,
3,1,1,7,1,
2,1,5,1,8 };
double b2_data[] = { -2,4,3,-5,1 };
gsl_matrix_view m2 = gsl_matrix_view_array(a2_data, 5, 5);
gsl_vector_view b2 = gsl_vector_view_array(b2_data, 5);
gsl_linalg_cholesky_decomp(&m2.matrix);
gsl_linalg_cholesky_solve(&m2.matrix, &b2.vector, x);
printf ("x = \n");
gsl_vector_fprintf(stdout, x, "%g");
gsl_permutation_free (p);
gsl_vector_free(x);
}
没有合适的资源?快使用搜索试试~ 我知道了~
gsl-1.13-windows-binaries.zip
共243个文件
h:217个
lib:8个
pdb:8个
5星 · 超过95%的资源 需积分: 9 61 下载量 148 浏览量
2012-09-06
11:40:29
上传
评论
收藏 9.68MB ZIP 举报
温馨提示
免安装GSL库,不懂的可以参照我的博文 http://hi.baidu.com/yu_xian_guo/item/f2efdf2a3fc45bbdb73263e7
资源推荐
资源详情
资源评论
收起资源包目录
gsl-1.13-windows-binaries.zip (243个子文件)
BUGS 22KB
ChangeLog 27KB
COPYING 34KB
example.cpp 1KB
gsl_cblas.h 33KB
gsl_blas.h 21KB
gsl_linalg.h 20KB
gsl_matrix_complex_long_double.h 15KB
gsl_sf_bessel.h 14KB
gsl_matrix_complex_float.h 13KB
gsl_matrix_long_double.h 13KB
gsl_eigen.h 13KB
gsl_matrix_ushort.h 12KB
gsl_matrix_complex_double.h 12KB
gsl_matrix_uchar.h 12KB
gsl_matrix_ulong.h 12KB
gsl_matrix_short.h 12KB
gsl_matrix_float.h 12KB
gsl_matrix_uint.h 12KB
gsl_matrix_long.h 12KB
gsl_matrix_char.h 12KB
gsl_matrix_int.h 11KB
gsl_matrix_double.h 11KB
gsl_vector_complex_long_double.h 10KB
gsl_integration.h 9KB
gsl_vector_complex_float.h 9KB
gsl_randist.h 8KB
gsl_sf_legendre.h 8KB
gsl_vector_long_double.h 8KB
gsl_vector_complex_double.h 8KB
gsl_odeiv.h 8KB
gsl_sf_gamma.h 8KB
gsl_vector_ushort.h 8KB
gsl_statistics_long_double.h 7KB
gsl_vector_ulong.h 7KB
gsl_vector_uchar.h 7KB
gsl_vector_uint.h 7KB
gsl_vector_float.h 7KB
gsl_vector_short.h 7KB
gsl_cdf.h 7KB
gsl_vector_long.h 7KB
gsl_vector_char.h 7KB
gsl_vector_int.h 7KB
gsl_const_mksa.h 7KB
gsl_rng.h 7KB
gsl_const_mks.h 7KB
gsl_statistics_float.h 7KB
gsl_interp.h 7KB
gsl_multimin.h 7KB
gsl_const_cgsm.h 7KB
gsl_vector_double.h 7KB
gsl_statistics_double.h 6KB
gsl_const_cgs.h 6KB
gsl_multiroots.h 6KB
gsl_complex_math.h 6KB
gsl_errno.h 6KB
gsl_histogram2d.h 6KB
gsl_multifit_nlin.h 6KB
gsl_sum.h 5KB
gsl_fft_complex_float.h 5KB
gsl_poly.h 5KB
gsl_statistics_ushort.h 5KB
gsl_statistics_uchar.h 5KB
gsl_statistics_ulong.h 5KB
gsl_statistics_uint.h 5KB
gsl_fft_complex.h 5KB
gsl_statistics_short.h 4KB
gsl_statistics_long.h 4KB
gsl_statistics_char.h 4KB
gsl_sf_hyperg.h 4KB
gsl_chebyshev.h 4KB
gsl_statistics_int.h 4KB
gsl_sf_coulomb.h 4KB
gsl_sf_expint.h 4KB
gsl_math.h 4KB
gsl_wavelet2d.h 4KB
gsl_sf_ellint.h 4KB
gsl_sf_dilog.h 4KB
gsl_sf_coupling.h 4KB
gsl_histogram.h 4KB
gsl_min.h 4KB
gsl_sf_trig.h 4KB
gsl_sf_mathieu.h 4KB
gsl_sf_exp.h 4KB
gsl_machine.h 4KB
gsl_roots.h 4KB
gsl_sf_airy.h 4KB
gsl_bspline.h 3KB
gsl_sf_fermi_dirac.h 3KB
gsl_complex.h 3KB
gsl_permutation.h 3KB
gsl_multifit.h 3KB
gsl_fft_halfcomplex_float.h 3KB
gsl_monte_vegas.h 3KB
gsl_wavelet.h 3KB
gsl_fft_halfcomplex.h 3KB
gsl_siman.h 3KB
gsl_sf_zeta.h 3KB
gsl_combination.h 3KB
gsl_spline.h 3KB
共 243 条
- 1
- 2
- 3
资源评论
- weixiaomm2013-06-05不错,有用,很好很强大
- luckywizard2013-12-18不错,gsl很强大,值得拥有!
- jude20132014-12-13刚好要用到~谢谢~
- amuxz2014-04-12是很好用,但并没有像博客里说的那样,有PDF啊..
yuxianguo_chn
- 粉丝: 64
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功