由买买提看人间百态

topics

全部话题 - 话题: allocat
1 (共1页)
l*******G
发帖数: 1191
1
来自主题: Computation版 - fortran90 奇怪的格式问题
对于自己定义的数据(结构)的成员打印格式居然出问题。有兴趣的看一下为何主程序
最后两行打印结果不一样?gfortran and ifort give same results on linux.
=====save to test.f90, and then "ifort test.f90" and then "./a.out" to run=====
module numz
integer, parameter:: b8 = selected_real_kind(14)
integer,allocatable :: a_gene(:),many_genes(:,:)
end module
module galapagos
use numz
... 阅读全帖
l*******G
发帖数: 1191
2
来自主题: Computation版 - fortran90 奇怪的格式问题
对于自己定义的数据(结构)的成员打印格式居然出问题。有兴趣的看一下为何主程序
最后两行打印结果不一样?gfortran and ifort give same results on linux.
=====save to test.f90, and then "ifort test.f90" and then "./a.out" to run=====
module numz
integer, parameter:: b8 = selected_real_kind(14)
integer,allocatable :: a_gene(:),many_genes(:,:)
end module
module galapagos
use numz
... 阅读全帖
h******u
发帖数: 120
3
来自主题: Investment版 - 请问下面401k可以选哪个? -- 谢谢
AmerFunds Bond America SA1E N
BlackRock GlbalAllocation SALE N,L1
Del Ltd-Term Div Income SA87 N
Del VIP DiversifiedIncome SA93N,L7
Franklin High Income SA20 N,L7
LVIP Delaware Bond SA12 N,L6
LVIP SSgA Bond Index SAL6 N,I
PIMCO Total Return SALM N
Templeton Global Bond VIP SA86 N,L1
AmerFunds Amer High-Inc SA1C N
Delaware VIP Value SA61 N
Invesco Growth & Income SA28 N
LVIP DELAW WEALTH BUILDER SA97 N,FF,22,28
LVIP JPMORGAN RETIRINCOME SA95N,FF,22,28
LVIP Managed Risk Pr 2010 SAL1 N,P1,TD
LVIP M... 阅读全帖
h******u
发帖数: 120
4
【 以下文字转载自 Investment 讨论区 】
发信人: happyhou (小猴), 信区: Investment
标 题: 请问下面401k可以选哪个? -- 谢谢
发信站: BBS 未名空间站 (Thu Nov 30 22:00:09 2017, 美东)
AmerFunds Bond America SA1E N
BlackRock GlbalAllocation SALE N,L1
Del Ltd-Term Div Income SA87 N
Del VIP DiversifiedIncome SA93N,L7
Franklin High Income SA20 N,L7
LVIP Delaware Bond SA12 N,L6
LVIP SSgA Bond Index SAL6 N,I
PIMCO Total Return SALM N
Templeton Global Bond VIP SA86 N,L1
AmerFunds Amer High-Inc SA1C N
Delaware VIP Value SA61 N
Invesco Growth & Income ... 阅读全帖
h******u
发帖数: 120
5
【 以下文字转载自 Investment 讨论区 】
发信人: happyhou (小猴), 信区: Investment
标 题: 请问下面401k可以选哪个? -- 谢谢
发信站: BBS 未名空间站 (Thu Nov 30 22:00:09 2017, 美东)
AmerFunds Bond America SA1E N
BlackRock GlbalAllocation SALE N,L1
Del Ltd-Term Div Income SA87 N
Del VIP DiversifiedIncome SA93N,L7
Franklin High Income SA20 N,L7
LVIP Delaware Bond SA12 N,L6
LVIP SSgA Bond Index SAL6 N,I
PIMCO Total Return SALM N
Templeton Global Bond VIP SA86 N,L1
AmerFunds Amer High-Inc SA1C N
Delaware VIP Value SA61 N
Invesco Growth & Income ... 阅读全帖
o****i
发帖数: 1706
6
【 以下文字转载自 Linux 讨论区 】
发信人: ouyadi (可乐会捂帮帮众), 信区: Linux
标 题: Valgrind报uninitialized value was created by a heap allocation
发信站: BBS 未名空间站 (Sat Feb 19 12:11:20 2011, 美东)
程序运行正常,可是在测memery leak的时候报上面那个错,具体错误消息如下:
==25663== Conditional jump or move depends on uninitialised value(s)
==25663== at 0x400C9F: add_edge (graph.c:59)
==25663== by 0x40071A: main (main.c:13)
==25663== Uninitialised value was created by a heap allocation
==25663== at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==256... 阅读全帖
l**********g
发帖数: 503
7
多谢wanna 和 lightroom。
刚有时间试一下,lvextend 不工作,应该怎么用?请指教。谢谢。
% pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name fedora
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID 5qfS4T-HtTl-gI5t-40ef-eZ07-24BX-8oelWG
% df -h
Filesystem Size Used Avail Use% Mounted on
... 阅读全帖
c******g
发帖数: 63
8
用的是VM player 5.02。一开始硬盘设置为20G, 现在想扩成30G。Power off后在
Utility菜单中已经将大小改为30G,按照网上一些资料的说明,剩余的步骤便是在
Ubuntu系统内部增加disk partition的大小。但似乎中间结果和网上写的有些不一样,
导致无法继续。具体过程如下:(assume所有命令都在sudo下)
$ fdisk /dev/sda 然后输p,显示:
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 39845887 19921920 83 Linux
/dev/sda2 39847934 41940991 1046529 5 Extended
/dev/sda5 39847936 41940991 1046528 82 Linux swap / Solaris
输出n建一个新分区,显示:
Partition type:... 阅读全帖
c********e
发帖数: 383
9
来自主题: Programming版 - size不固定的struct怎么定义呀?
我今天和乐点酒,头脑不是很清楚,凑合看吧。
struct Array
{
unsigned long length_;
int * data_
explicit Array ( const int num) : length_ (num)
{ data = static_castmalloc (sizeof(int)*length);}
~Array (void) {delete data_;}
void init (...) {//initialize ur arrary of int}
int operator [] (int i) { //check boundary maybe; return data[i]; }
private: //or protected
const A& operator=(const A&);
A(const &);
};
或者用vector得乐。要不自己写个templated struct. 还可以用new 来代替malloc.
或者overlaod operator new,或者用allocat
O******e
发帖数: 734
10
Dynamic allocation in heap memory using Fortran 90/95:
integer,dimension(:),allocatable::p2i
integer::size
integer::alloc_stat
read(some_file,some_format)size
allocate(p2i(1:size),stat=alloc_stat)
if(alloc_stat.ne.0)stop"error allocating p2i"
...
deallocate(p2i,stat=alloc_stat)
if(alloc_stat.ne.0)stop"error deallocating p2i"
If you want to call a subroutine to allocate p2i, return from that
subroutine, use p2i elsewhere, then call another subroutine to deallocate
p2i, you will need to declare p2
f**********w
发帖数: 93
11
来自主题: Programming版 - 问个fortran的问题
请教下面的语句是什么意思?
integer, save, dimension(:), allocatable :: vianame
多谢
O******e
发帖数: 734
12
来自主题: Programming版 - 问个fortran的问题
It declares a one-dimensional integer array that is allocatable (you can
allocated whatever number of elements or amount of memory is needed) and
is also saved between allocations of the function or subroutine (the
array will not be deallocated when the subroutine or function returns).
O******e
发帖数: 734
13
来自主题: Programming版 - 问个c调用fortran函数的问题
If you take a look at example given in Metcalf, Reid and Cohan "Fortran
95/2003 Explained" Figure 14.5, it shows you how to pass/receive a C
pointer to a type/struct between Fortran and C in a standard conforming
way if the type/struct contains a noninteroperable allocatable/C-pointer
component.
j**f
发帖数: 28
14
来自主题: Programming版 - 32/64bit Fortran编译器造成的错误
Your code looks fine. Your problem maybe comes from other part of your code
, for example your MYSUB(p(i),xx,xx,xx) can do trick things.
How do you know your p(i) have been changed? Do you print out p(i) before
or after
calling MYSUB(p(i),xx,xx,xx)? If you are sure the value have been changed
after you call MYSUB(p(i),xx,xx,xx), certainly the problem is in your MYSUB(
p(i),xx,xx,xx) instead of allocatable array problem.
I assumed your j is in the range of 32bit integer.
o****i
发帖数: 1706
15
【 以下文字转载自 Linux 讨论区 】
发信人: ouyadi (可乐会捂帮帮众), 信区: Linux
标 题: Valgrind报uninitialized value was created by a heap allocation
发信站: BBS 未名空间站 (Sat Feb 19 12:11:20 2011, 美东)
程序运行正常,可是在测memery leak的时候报上面那个错,具体错误消息如下:
==25663== Conditional jump or move depends on uninitialised value(s)
==25663== at 0x400C9F: add_edge (graph.c:59)
==25663== by 0x40071A: main (main.c:13)
==25663== Uninitialised value was created by a heap allocation
==25663== at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==256... 阅读全帖
t****t
发帖数: 6806
16
你要学会读信息, 未初始化的内存本身没问题, 一开始分配的都没初始化, 但是如果输
出未初始化的值, 或者依靠未初始化的值跳转就会报错
22行的地方是你分配内存的地方. 59行才是使用这个值的地方.
o****i
发帖数: 1706
17
所有报错的地方都是循环语句,类似于
for(vp = *vtxhead; vp != NULL; vp = vp->next){
是不是说最后vp->next是NULL的时候,Valgrind误认为是uninitialized value,如果是这个问题的话,该怎么解决呢?
R****g
发帖数: 130
18
来自主题: Programming版 - 数据存储的问题
用的fortran
用了两个方法:
1.写到direct access file里面 以后要用再打开他读取 --> 慢
2.写到allocatable array里面 程序里面直接读 -->快,但是经常超过virtual memory
,因为数据量太大了
有没有其他方法?如何在2的基础上改进内存的问题?
谢了
S***y
发帖数: 186
19
来自主题: Computation版 - 求矩阵逆的算法
你如果用Fortran, 试试这个:
SUBROUTINE ZGEINV (N,A)
IMPLICIT NONE
INTEGER :: N
COMPLEX*16 :: A(N,N)
INTEGER :: IPIV(N)
INTEGER :: INFO, LWORK
COMPLEX*16, ALLOCATABLE :: WORK(:)
LWORK=N*ILAENV(1,'ZGETRI',' ',N,-1,-1,-1)
ALLOCATE(WORK(LWORK))
CALL ZGETRF(N,N,A,N,IPIV,INFO)
CALL ZGETRI(N,A,N,IPIV,WORK,LWORK,INFO)
DEALLOCATE(WORK)
END SUBROUTINE ZGEINV
这个是算复数矩阵的,如果你是实数矩阵,
把complex*16都换成real*8, ZGE都换成DGE.
当然这个是算普通矩阵的,对于对称正定矩阵,
可能还有更好的方法。
最后,要用LAPACK, 一定要用optimised BLAS,
否则对大矩阵,慢上个3,4倍都很正常。
S***y
发帖数: 186
20
来自主题: Computation版 - 关于C和Fortran: 一点儿个人观点

持保留意见。应该说用Fortran和C的人都在增多,不过用C的增加更快。
但还是那句话,这没可比性,因为C应用领域广的多。
应该是已经淘汰了吧,没人再用F77写专业程序了,我想。
F90是比F77复杂多了,但其实把Module和Allocatable Array整明白,
再把那些增加的Intrinsic Functions记住,就差不多了。
Intel有免费的F90/95的编译器啊,性能不错。
你要是买更牛的机器,这compiler的成本应该是占很小的比例吧。
关于Portability, 我用过的commercial packages, 用Fortran写的都可以
在我所有的机器上编过,IBM, SGI, Alpha, Itanium, Pentium ...
C的我没用过。但我想实际上很少有C的程序是在ANSI Standard下写的,
都或多或少的使用了compiler-dependent extensions,所以这portability
反而会有问题。纯属个人愚见。:)
免费的Fortran写的library就更多到我都不想说了,当然都是做计算的。:(
当你面向整个世界时,
y****d
发帖数: 432
21
9.经典金融投资巨著合集 RAR
http://www.filesonic.com/folder/318617
包含内容
1、本杰明-格雷厄姆:《证券分析》(SecuritiesAnalysis)
2、本杰明-格雷厄姆:《聪明的投资者》(TheIntelligent Investor)
3、本杰明-格雷厄姆:《价值再发现》(RediscoveringBenjamin Graham)
4、乔治-索罗斯:《金融炼金术》(TheAlchemy of Finance)
5、戴维-法柏:《法柏报告》(TheFaber Report)
6、理查斯-盖斯特:《最后的合伙人》(TheLast Partners)
7、理查斯-盖斯特:《金融体系中的投资银行》(InvestmentBanking in Financial
System)
8、《华尔街日报》编辑部:《华尔街巨人》(Who'sWho and What's What)
9、伯顿-麦基尔:《漫步华尔街》(ARandom Walk on Wall Street)
10、沃伦-巴菲特:《巴菲特致股东的信》(Lettersto Shareholders... 阅读全帖
1 (共1页)