红联Linux门户
Linux帮助

在suse 10.1编译程序时发生的奇怪事情

发布时间:2007-07-09 00:35:31来源:红联作者:Agreed
我在编译 ex11.cpp ( which will be given at the end) 的时候,使用编译命令
./a11 (whose content will be given later) 会出一堆的错误,但是使用 a12 (最后给出)不会出错。
二者的差别是
tlu@linux-1482:~/proj/mpi/epetra> diff a12 a11
a11
< -lblas \
< -lcblas \
a12
> -lblas -lcblas \

看在作编译命令的时候, -lblas -lcblas 在 suse linux 下要写在一起。

这样的事情在 Fedora Core 6 的机器没有出现。


a11 把分成两行写 出现的错误如下:
/usr/local/lib/liblapack.a(sgeev.o): In function `sgeev_':
sgeev.f:(.text+0x141a): undefined reference to `srot_'
sgeev.f:(.text+0x180a): undefined reference to `srot_'
/usr/local/lib/liblapack.a(sgeevx.o): In function `sgeevx_':
sgeevx.f:(.text+0x1712): undefined reference to `srot_'
sgeevx.f:(.text+0x1b7d): undefined reference to `srot_'
/usr/local/lib/liblapack.a(sgetri.o): In function `sgetri_':
sgetri.f:(.text+0x3b6): undefined reference to `sswap_'
sgetri.f:(.text+0x40d): undefined reference to `sswap_'
sgetri.f:(.text+0x45d): undefined reference to `sswap_'
sgetri.f:(.text+0x4a7): undefined reference to `sswap_'
sgetri.f:(.text+0x78c): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(sgglse.o): In function `sgglse_':
sgglse.f:(.text+0x7b7): undefined reference to `strmv_'
/usr/local/lib/liblapack.a(slahqr.o): In function `slahqr_':
slahqr.f:(.text+0x161e): undefined reference to `srot_'
slahqr.f:(.text+0x1695): undefined reference to `srot_'
slahqr.f:(.text+0x1702): undefined reference to `srot_'
/usr/local/lib/liblapack.a(slahr2.o): In function `slahr2_':
slahr2.f:(.text+0x495): undefined reference to `strmv_'
slahr2.f:(.text+0x67a): undefined reference to `strmv_'
slahr2.f:(.text+0x7be): undefined reference to `strmv_'
slahr2.f:(.text+0x912): undefined reference to `strmv_'
slahr2.f:(.text+0xd27): undefined reference to `strmv_'
/usr/local/lib/liblapack.a(slarf.o): In function `slarf_':
slarf.f:(.text+0x149): undefined reference to `sger_'
/usr/local/lib/liblapack.a(slatrs.o): In function `slatrs_':
slatrs.f:(.text+0x1760): undefined reference to `strsv_'
/usr/local/lib/liblapack.a(sporfs.o): In function `sporfs_':
sporfs.f:(.text+0x4db): undefined reference to `ssymv_'
/usr/local/lib/liblapack.a(spotrs.o): In function `spotrs_':
spotrs.f:(.text+0x154): undefined reference to `strsm_'
spotrs.f:(.text+0x1c0): undefined reference to `strsm_'
spotrs.f:(.text+0x2b5): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(sspgv.o): In function `sspgv_':
sspgv.f:(.text+0x312): undefined reference to `stpsv_'
sspgv.f:(.text+0x374): undefined reference to `stpsv_'
sspgv.f:(.text+0x3c5): undefined reference to `stpsv_'
sspgv.f:(.text+0x460): undefined reference to `stpmv_'
sspgv.f:(.text+0x4cc): undefined reference to `stpmv_'
sspgv.f:(.text+0x513): undefined reference to `stpmv_'
sspgv.f:(.text+0x574): undefined reference to `stpsv_'
sspgv.f:(.text+0x5d4): undefined reference to `stpmv_'
/usr/local/lib/liblapack.a(ssptrd.o): In function `ssptrd_':
ssptrd.f:(.text+0x164): undefined reference to `sspmv_'
ssptrd.f:(.text+0x209): undefined reference to `sspr2_'
ssptrd.f:(.text+0x3c8): undefined reference to `sspmv_'
ssptrd.f:(.text+0x4a8): undefined reference to `sspr2_'
/usr/local/lib/liblapack.a(ssyevx.o): In function `ssyevx_':
ssyevx.f:(.text+0x14d7): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(ssygv.o): In function `ssygv_':
ssygv.f:(.text+0x448): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(ssytrd.o): In function `ssytrd_':
ssytrd.f:(.text+0x3ae): undefined reference to `ssyr2k_'
ssytrd.f:(.text+0x62b): undefined reference to `ssyr2k_'
/usr/local/lib/liblapack.a(stgsja.o): In function `stgsja_':
stgsja.f:(.text+0x669): undefined reference to `srot_'
stgsja.f:(.text+0x6f2): undefined reference to `srot_'
stgsja.f:(.text+0x753): undefined reference to `srot_'
stgsja.f:(.text+0xa30): undefined reference to `srot_'
stgsja.f:(.text+0xb06): undefined reference to `srot_'
/usr/local/lib/liblapack.a(stgsja.o):stgsja.f:(.text+0xb8a): more undefined references to `srot_' follow
/usr/local/lib/liblapack.a(strtri.o): In function `strtri_':
strtri.f:(.text+0x4cb): undefined reference to `strsm_'
strtri.f:(.text+0x761): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(strtrs.o): In function `strtrs_':
strtrs.f:(.text+0x2f1): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(dgeev.o): In function `dgeev_':
dgeev.f:(.text+0x1393): undefined reference to `drot_'
dgeev.f:(.text+0x1776): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dgeevx.o): In function `dgeevx_':
dgeevx.f:(.text+0x16d4): undefined reference to `drot_'
dgeevx.f:(.text+0x1b38): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dgetri.o): In function `dgetri_':
dgetri.f:(.text+0x3ac): undefined reference to `dswap_'
dgetri.f:(.text+0x403): undefined reference to `dswap_'
dgetri.f:(.text+0x453): undefined reference to `dswap_'
dgetri.f:(.text+0x49d): undefined reference to `dswap_'
dgetri.f:(.text+0x77d): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(dgglse.o): In function `dgglse_':
dgglse.f:(.text+0x7b4): undefined reference to `dtrmv_'
/usr/local/lib/liblapack.a(dlahqr.o): In function `dlahqr_':
dlahqr.f:(.text+0x16e5): undefined reference to `drot_'
dlahqr.f:(.text+0x175c): undefined reference to `drot_'
dlahqr.f:(.text+0x17c9): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dlahr2.o): In function `dlahr2_':
dlahr2.f:(.text+0x4a3): undefined reference to `dtrmv_'
dlahr2.f:(.text+0x695): undefined reference to `dtrmv_'
dlahr2.f:(.text+0x7d8): undefined reference to `dtrmv_'
dlahr2.f:(.text+0x926): undefined reference to `dtrmv_'
dlahr2.f:(.text+0xd48): undefined reference to `dtrmv_'
/usr/local/lib/liblapack.a(dlarf.o): In function `dlarf_':
dlarf.f:(.text+0x151): undefined reference to `dger_'
/usr/local/lib/liblapack.a(dlarft.o): In function `dlarft_':
dlarft.f:(.text+0x376): undefined reference to `dtrmv_'
dlarft.f:(.text+0x7b1): undefined reference to `dtrmv_'
/usr/local/lib/liblapack.a(dlatrs.o): In function `dlatrs_':
dlatrs.f:(.text+0x17d9): undefined reference to `dtrsv_'
/usr/local/lib/liblapack.a(dporfs.o): In function `dporfs_':
dporfs.f:(.text+0x4de): undefined reference to `dsymv_'
/usr/local/lib/liblapack.a(dpotrs.o): In function `dpotrs_':
dpotrs.f:(.text+0x154): undefined reference to `dtrsm_'
dpotrs.f:(.text+0x1c0): undefined reference to `dtrsm_'
dpotrs.f:(.text+0x2b5): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(dspgv.o): In function `dspgv_':
dspgv.f:(.text+0x312): undefined reference to `dtpsv_'
dspgv.f:(.text+0x374): undefined reference to `dtpsv_'
dspgv.f:(.text+0x3c5): undefined reference to `dtpsv_'
dspgv.f:(.text+0x460): undefined reference to `dtpmv_'
dspgv.f:(.text+0x4cc): undefined reference to `dtpmv_'
dspgv.f:(.text+0x513): undefined reference to `dtpmv_'
dspgv.f:(.text+0x574): undefined reference to `dtpsv_'
dspgv.f:(.text+0x5d4): undefined reference to `dtpmv_'
/usr/local/lib/liblapack.a(dsptrd.o): In function `dsptrd_':
dsptrd.f:(.text+0x174): undefined reference to `dspmv_'
dsptrd.f:(.text+0x21a): undefined reference to `dspr2_'
dsptrd.f:(.text+0x3df): undefined reference to `dspmv_'
dsptrd.f:(.text+0x4c0): undefined reference to `dspr2_'
/usr/local/lib/liblapack.a(dsyevx.o): In function `dsyevx_':
dsyevx.f:(.text+0x14ca): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dsygv.o): In function `dsygv_':
dsygv.f:(.text+0x448): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(dsytrd.o): In function `dsytrd_':
dsytrd.f:(.text+0x3b1): undefined reference to `dsyr2k_'
dsytrd.f:(.text+0x62e): undefined reference to `dsyr2k_'
/usr/local/lib/liblapack.a(dtgsja.o): In function `dtgsja_':
dtgsja.f:(.text+0x66e): undefined reference to `drot_'
dtgsja.f:(.text+0x6f7): undefined reference to `drot_'
dtgsja.f:(.text+0x758): undefined reference to `drot_'
dtgsja.f:(.text+0xa40): undefined reference to `drot_'
dtgsja.f:(.text+0xb10): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dtgsja.o):dtgsja.f:(.text+0xb99): more undefined references to `drot_' follow
/usr/local/lib/liblapack.a(dtrtri.o): In function `dtrtri_':
dtrtri.f:(.text+0x4cb): undefined reference to `dtrsm_'
dtrtri.f:(.text+0x761): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(dtrtrs.o): In function `dtrtrs_':
dtrtrs.f:(.text+0x2f3): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(sbdsqr.o): In function `sbdsqr_':
sbdsqr.f:(.text+0x7cb): undefined reference to `sswap_'
sbdsqr.f:(.text+0x82d): undefined reference to `sswap_'
sbdsqr.f:(.text+0x87c): undefined reference to `sswap_'
sbdsqr.f:(.text+0xcec): undefined reference to `sswap_'
sbdsqr.f:(.text+0xd34): undefined reference to `sswap_'
sbdsqr.f:(.text+0x1af5): undefined reference to `srot_'
sbdsqr.f:(.text+0x1b5d): undefined reference to `srot_'
sbdsqr.f:(.text+0x1ba0): undefined reference to `srot_'
/usr/local/lib/liblapack.a(sstedc.o): In function `sstedc_':
sstedc.f:(.text+0xd83): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(ssteqr.o): In function `ssteqr_':
ssteqr.f:(.text+0x1206): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(dbdsqr.o): In function `dbdsqr_':
dbdsqr.f:(.text+0x802): undefined reference to `dswap_'
dbdsqr.f:(.text+0x864): undefined reference to `dswap_'
dbdsqr.f:(.text+0x8b3): undefined reference to `dswap_'
dbdsqr.f:(.text+0xd8a): undefined reference to `dswap_'
dbdsqr.f:(.text+0xdd2): undefined reference to `dswap_'
dbdsqr.f:(.text+0x1c92): undefined reference to `drot_'
dbdsqr.f:(.text+0x1cfa): undefined reference to `drot_'
dbdsqr.f:(.text+0x1d3d): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dstedc.o): In function `dstedc_':
dstedc.f:(.text+0xd54): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dsteqr.o): In function `dsteqr_':
dsteqr.f:(.text+0x12e7): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(sgebak.o): In function `sgebak_':
sgebak.f:(.text+0x536): undefined reference to `sswap_'
sgebak.f:(.text+0x5ae): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(sgebal.o): In function `sgebal_':
sgebal.f:(.text+0x3ff): undefined reference to `sswap_'
sgebal.f:(.text+0x44d): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(sgeqpf.o): In function `sgeqpf_':
sgeqpf.f:(.text+0x168): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(sgeqpf.o):sgeqpf.f:(.text+0x3b5): more undefined references to `sswap_' follow
/usr/local/lib/liblapack.a(slaexc.o): In function `slaexc_':
slaexc.f:(.text+0x822): undefined reference to `srot_'
slaexc.f:(.text+0x895): undefined reference to `srot_'
slaexc.f:(.text+0xc94): undefined reference to `srot_'
slaexc.f:(.text+0x1363): undefined reference to `srot_'
slaexc.f:(.text+0x13c7): undefined reference to `srot_'
/usr/local/lib/liblapack.a(slaexc.o):slaexc.f:(.text+0x142e): more undefined references to `srot_' follow
/usr/local/lib/liblapack.a(slarft.o): In function `slarft_':
slarft.f:(.text+0x35d): undefined reference to `strmv_'
slarft.f:(.text+0x764): undefined reference to `strmv_'
/usr/local/lib/liblapack.a(slarfx.o): In function `slarfx_':
slarfx.f:(.text+0x164): undefined reference to `sger_'
/usr/local/lib/liblapack.a(slasy2.o): In function `slasy2_':
slasy2.f:(.text+0x545): undefined reference to `sswap_'
slasy2.f:(.text+0x5c2): undefined reference to `sswap_'
/usr/local/lib/liblapack.a(slatrd.o): In function `slatrd_':
slatrd.f:(.text+0x33c): undefined reference to `ssymv_'
slatrd.f:(.text+0x6e7): undefined reference to `ssymv_'
/usr/local/lib/liblapack.a(spptrf.o): In function `spptrf_':
spptrf.f:(.text+0x179): undefined reference to `stpsv_'
spptrf.f:(.text+0x2f2): undefined reference to `sspr_'
/usr/local/lib/liblapack.a(sspgst.o): In function `sspgst_':
sspgst.f:(.text+0x16a): undefined reference to `stpmv_'
sspgst.f:(.text+0x1f7): undefined reference to `sspr2_'
sspgst.f:(.text+0x3f1): undefined reference to `sspmv_'
sspgst.f:(.text+0x448): undefined reference to `stpmv_'
sspgst.f:(.text+0x520): undefined reference to `stpsv_'
sspgst.f:(.text+0x580): undefined reference to `sspmv_'
sspgst.f:(.text+0x7a1): undefined reference to `sspr2_'
sspgst.f:(.text+0x82b): undefined reference to `stpsv_'
/usr/local/lib/liblapack.a(ssygst.o): In function `ssygst_':
ssygst.f:(.text+0x4c5): undefined reference to `ssyr2k_'
ssygst.f:(.text+0x83f): undefined reference to `ssyr2k_'
ssygst.f:(.text+0xb95): undefined reference to `strsm_'
ssygst.f:(.text+0xd1d): undefined reference to `ssyr2k_'
ssygst.f:(.text+0xe9d): undefined reference to `strsm_'
ssygst.f:(.text+0x105c): undefined reference to `strsm_'
ssygst.f:(.text+0x11b0): undefined reference to `ssyr2k_'
ssygst.f:(.text+0x1307): undefined reference to `strsm_'
/usr/local/lib/liblapack.a(ssytd2.o): In function `ssytd2_':
ssytd2.f:(.text+0x1a4): undefined reference to `ssymv_'
ssytd2.f:(.text+0x272): undefined reference to `ssyr2_'
ssytd2.f:(.text+0x49c): undefined reference to `ssymv_'
ssytd2.f:(.text+0x5cb): undefined reference to `ssyr2_'
/usr/local/lib/liblapack.a(strti2.o): In function `strti2_':
strti2.f:(.text+0x159): undefined reference to `strmv_'
strti2.f:(.text+0x1f6): undefined reference to `strmv_'
strti2.f:(.text+0x30a): undefined reference to `strmv_'
/usr/local/lib/liblapack.a(dgebak.o): In function `dgebak_':
dgebak.f:(.text+0x539): undefined reference to `dswap_'
dgebak.f:(.text+0x5b1): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dgebal.o): In function `dgebal_':
dgebal.f:(.text+0x431): undefined reference to `dswap_'
dgebal.f:(.text+0x47f): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dgeqpf.o): In function `dgeqpf_':
dgeqpf.f:(.text+0x159): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dgeqpf.o):dgeqpf.f:(.text+0x47b): more undefined references to `dswap_' follow
/usr/local/lib/liblapack.a(dlaexc.o): In function `dlaexc_':
dlaexc.f:(.text+0x81c): undefined reference to `drot_'
dlaexc.f:(.text+0x88f): undefined reference to `drot_'
dlaexc.f:(.text+0xcbd): undefined reference to `drot_'
dlaexc.f:(.text+0x13d1): undefined reference to `drot_'
dlaexc.f:(.text+0x1435): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dlaexc.o):dlaexc.f:(.text+0x149d): more undefined references to `drot_' follow
/usr/local/lib/liblapack.a(dlarfx.o): In function `dlarfx_':
dlarfx.f:(.text+0x16f): undefined reference to `dger_'
/usr/local/lib/liblapack.a(dlasy2.o): In function `dlasy2_':
dlasy2.f:(.text+0x5a5): undefined reference to `dswap_'
dlasy2.f:(.text+0x61d): undefined reference to `dswap_'
/usr/local/lib/liblapack.a(dlatrd.o): In function `dlatrd_':
dlatrd.f:(.text+0x342): undefined reference to `dsymv_'
dlatrd.f:(.text+0x6ef): undefined reference to `dsymv_'
/usr/local/lib/liblapack.a(dpptrf.o): In function `dpptrf_':
dpptrf.f:(.text+0x16f): undefined reference to `dtpsv_'
dpptrf.f:(.text+0x2fb): undefined reference to `dspr_'
/usr/local/lib/liblapack.a(dspgst.o): In function `dspgst_':
dspgst.f:(.text+0x16e): undefined reference to `dtpmv_'
dspgst.f:(.text+0x201): undefined reference to `dspr2_'
dspgst.f:(.text+0x40d): undefined reference to `dspmv_'
dspgst.f:(.text+0x464): undefined reference to `dtpmv_'
dspgst.f:(.text+0x53f): undefined reference to `dtpsv_'
dspgst.f:(.text+0x59f): undefined reference to `dspmv_'
dspgst.f:(.text+0x7d0): undefined reference to `dspr2_'
dspgst.f:(.text+0x85d): undefined reference to `dtpsv_'
/usr/local/lib/liblapack.a(dsygst.o): In function `dsygst_':
dsygst.f:(.text+0x4c5): undefined reference to `dsyr2k_'
dsygst.f:(.text+0x83f): undefined reference to `dsyr2k_'
dsygst.f:(.text+0xb95): undefined reference to `dtrsm_'
dsygst.f:(.text+0xd1d): undefined reference to `dsyr2k_'
dsygst.f:(.text+0xe9d): undefined reference to `dtrsm_'
dsygst.f:(.text+0x105c): undefined reference to `dtrsm_'
dsygst.f:(.text+0x11b0): undefined reference to `dsyr2k_'
dsygst.f:(.text+0x1307): undefined reference to `dtrsm_'
/usr/local/lib/liblapack.a(dsytd2.o): In function `dsytd2_':
dsytd2.f:(.text+0x1a9): undefined reference to `dsymv_'
dsytd2.f:(.text+0x278): undefined reference to `dsyr2_'
dsytd2.f:(.text+0x4a2): undefined reference to `dsymv_'
dsytd2.f:(.text+0x5d8): undefined reference to `dsyr2_'
/usr/local/lib/liblapack.a(dtrti2.o): In function `dtrti2_':
dtrti2.f:(.text+0x15e): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x209): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x32e): undefined reference to `dtrmv_'
/usr/local/lib/liblapack.a(slaed2.o): In function `slaed2_':
slaed2.f:(.text+0x1229): undefined reference to `srot_'
/usr/local/lib/liblapack.a(slaed8.o): In function `slaed8_':
slaed8.f:(.text+0x12bc): undefined reference to `srot_'
/usr/local/lib/liblapack.a(slaeda.o): In function `slaeda_':
slaeda.f:(.text+0x450): undefined reference to `srot_'
slaeda.f:(.text+0x4c1): undefined reference to `srot_'
/usr/local/lib/liblapack.a(dlaed2.o): In function `dlaed2_':
dlaed2.f:(.text+0x12b4): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dlaed8.o): In function `dlaed8_':
dlaed8.f:(.text+0x1343): undefined reference to `drot_'
/usr/local/lib/liblapack.a(dlaeda.o): In function `dlaeda_':
dlaeda.f:(.text+0x431): undefined reference to `drot_'
dlaeda.f:(.text+0x4a5): undefined reference to `drot_'
/usr/local/lib/liblapack.a(ssygs2.o): In function `ssygs2_':
ssygs2.f:(.text+0x1a0): undefined reference to `strmv_'
ssygs2.f:(.text+0x248): undefined reference to `ssyr2_'
ssygs2.f:(.text+0x439): undefined reference to `strmv_'
ssygs2.f:(.text+0x4e8): undefined reference to `ssyr2_'
ssygs2.f:(.text+0x7cf): undefined reference to `ssyr2_'
ssygs2.f:(.text+0x88f): undefined reference to `strsv_'
ssygs2.f:(.text+0xaab): undefined reference to `ssyr2_'
ssygs2.f:(.text+0xb64): undefined reference to `strsv_'
/usr/local/lib/liblapack.a(dsygs2.o): In function `dsygs2_':
dsygs2.f:(.text+0x1a0): undefined reference to `dtrmv_'
dsygs2.f:(.text+0x248): undefined reference to `dsyr2_'
dsygs2.f:(.text+0x43a): undefined reference to `dtrmv_'
dsygs2.f:(.text+0x4e9): undefined reference to `dsyr2_'
dsygs2.f:(.text+0x7cf): undefined reference to `dsyr2_'
dsygs2.f:(.text+0x88f): undefined reference to `dtrsv_'
dsygs2.f:(.text+0xab1): undefined reference to `dsyr2_'
dsygs2.f:(.text+0xb6a): undefined reference to `dtrsv_'
collect2: ld returned 1 exit status



a11
mpicxx -DHAVE_DIDASKO_EPETRA \
-DHAVE_MPI \
-DMPICH_IGNORE_CXX_SEEK \
-I /usr/local/share/trilinos-7.0.8/packages/didasko/src/ \
-o ex11.out ex11.cpp \
-lepetra \
-lblas \
-lcblas \
-lgoto \
-llapack \
-lmpe \
-lteuchos \
-lepetra_test \
-ltriutils \
-laztecoo \
-lamesos \
-lifpack \
-lml \
-lnox \
-lnoxepetra \
-lg2c

a12
mpicxx -DHAVE_DIDASKO_EPETRA \
-DHAVE_MPI \
-DMPICH_IGNORE_CXX_SEEK \
-I /usr/local/share/trilinos-7.0.8/packages/didasko/src/ \
-o ex11.out ex11.cpp \
-lepetra \
-llapack \
-lblas -lcblas -lgoto \
-lmpe \
-lteuchos \
-lepetra_test \
-ltriutils \
-laztecoo \
-lamesos \
-lifpack \
-lml \
-lnox \
-lnoxepetra \
-lg2c



ex11.cpp

// Basic definition of communicator.
// This code should be run with one process

#include "Didasko_ConfigDefs.h"
#if defined(HAVE_DIDASKO_EPETRA)

#include
#include "Epetra_ConfigDefs.h"
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_SerialDenseVector.h"
#include "Epetra_SerialDenseMatrix.h"
#include "Epetra_SerialDenseSolver.h"

int main(int argc, char *argv[])
{

#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
Epetra_MpiComm Comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm Comm;
#endif

// Total number of elements in vectors, can be any positive number
int NumRows = 5;

Epetra_SerialDenseVector x, b;
x.Size( NumRows );
b.Size( NumRows );

// set the elements of the vector
for( int i=0 ; i
Epetra_SerialDenseMatrix A, A2;
A.Shape( NumRows, NumRows );
A2.Shape( NumRows, NumRows ); // A2 is a copy of A

// Hilbert matrix (ill-conditioned)
for( int i=0 ; i for( int j=0 ; j A(i,j) = 1.0/(i+j+2);

cout<< A;

// set up the solver
Epetra_SerialDenseSolver Problem;
Problem.SetMatrix( A );
Problem.SetVectors( x, b );

A2 = A;
// we make a copy of A because Problem.Solve() will
// overwrite A with its LU decomposition. Try with
// cout << A after the following invocation

b.Multiply('N','N',1.0, A2, x, 0.0);

cout << "A * x = \n" << b;

double rcond;
Problem.ReciprocalConditionEstimate(rcond);
cout << "The (estimated) condition number of A is " << 1/rcond << endl;

Problem.SetMatrix( A2 );
Problem.Invert();
cout << "The inverse of A is\n";
cout << A2;

#ifdef HAVE_MPI
MPI_Finalize();
#endif

} /* main */

#else

#include
#include

int main(int argc, char *argv[])
{
puts("Please configure Didasko with:\n"
"--enable-epetra");

return 0;
}
#endif
文章评论

共有 0 条评论