matgen.c
来自「数值算法库」· C语言 代码 · 共 28 行
C
28 行
/* matgen.c CCM mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU general * public license. ( See the gpl.license file for details.) * ------------------------------------------------------------------------ */#include <stdio.h>#include <time.h>#include "ccmath.h"main(na,av)int na; char **av;{ double *a,*p,nrml(); int n,m,j; unsigned long seed; FILE *fp; if(na!=3){ printf("para: dim o_file\n"); exit(1);} n=atoi(*++av); m=n*n; fp=fopen(*++av,"wb"); a=(double *)calloc(m,sizeof(double)); seed=(unsigned long)time(NULL); setnrml(seed); for(j=0,p=a; j<m ;++j) *p++ =nrml(); fwrite((void *)&n,sizeof(int),1,fp); fwrite((void *)a,sizeof(double),m,fp);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?