数字を変更するとプログラミングが動かなくなります.
以前と書いてある4,5,21行目の数字を変更するとプログラミングが動かなくなります.
以前の数字では,最後のプリントが出力されるので,それまでの行に問題があると思います.
C言語はあまり使っていないため,解決策が思いつきません.
よろしくお願いします.
#include <stdio.h> #include <math.h> #include <stdlib.h> #define V 1066 // 語彙数 //以前311 #define D 212208 // 文書数 //以前151119 #define Z 0 // ポリガンマ関数の次数 #define K2 5000 // トピック類似度によるトピック数上限:100 // 関数と構造体の宣言 float stdz(int N, float *x); // 行基準化関数 int comp_twei(const void *a, const void *b); // 重み比較関数:twei用 struct twei {int ord; float wei;}; // 重み算出用構造体 // main関数の始まり int main() { double polygamma(); double x, p; float stdz(); int Nw[212208][2], Ag[D]; // 変換したサンプル数の上限,元の議題数 //以前Nw[151119] int i, j, k, v, itr, K, M, T, mit, wdi, UT; int dum, dum2; float dumf, dumf2; // double zero = 0.0; float pqz[100], sv[100], ss; float qz[100], rqz[100], sqz[100]; FILE *file1, *file2, *file3, *file4, *file5, *file6; FILE *bfndk, *bfnvk, *bfq; double beta[V],alp[100]; double ra, rb, llh; float siml[K2]; struct twei tw[100]; // 入出力ファイルの定義 /* file1 : qz_di_in/ initial values for latent variable /初期乱数ファイル:語数やkが増えると,要素数を増やす必要あり file2 : 2002.txt // disctritized geographical topics /語彙を番号変換したファイル file3 : Ag / number of observed attribute for each site /議題ごとの単語区切り位置 file4 : number of transformed (devided) documents 単語区切り位置と分割後の語ファイル file5 : ndk出力 file6 : nvk出力 */ /* 分割後の語数ファイル設定*/ file4 = fopen("Nw_length.txt", "w"); // beta,alpの初期化 for(i=0; i<V; i++) beta[i] = 10.0 / V; for(i=0; i<100; i++) alp[i] =0.1; // qz_diのファイル設定 file1 = fopen("qz_di.txt","r"); // 行数に注意:全単語数よりも多いこと // wdiの読み込みファイル設定 file2 = fopen("2002.txt","r"); // file2 = fopen("widat.txt","r"); wi_new2.txt // Nwの読み込みファイル設定 file3 = fopen("len2002.txt","r"); // length_new // binaryファイルの設定:作業ファイル bfndk = fopen("bfndk.bin","wb+"); bfnvk = fopen("bfnvk.bin","wb+"); bfq = fopen("bfq.bin","wb+"); printf("*****************************************\n");
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/09/03 19:47