📄 alloc.c
字号:
/* Memory allocation for Input/Target Arrays etc * * * $Id: alloc.c 1272 2007-05-09 16:26:20Z mhe $ */#include <stdlib.h>#include <stdio.h>#include "lstm.h"#include "roc.h"#include "alloc.h"void alloc () { /* AA symbols train */ fprintf(stderr, "alloc mem for AA symbols training %d MB\n", training_size * maxseqlentrain * sizeof(char) / 1024 / 1024); aaSym = alloc2DimCharArray(aaSym, training_size, maxseqlentrain); /* AA symbols test */ fprintf(stderr, "alloc mem for AA symbols test %d MB\n", test_size * maxseqlentest * sizeof(char) / 1024 / 1024); aaSym_t = alloc2DimCharArray(aaSym_t, test_size, maxseqlentest); /* input train */ fprintf(stderr, "alloc mem for inp training %d KB\n", maxseqlentrain * (windowsize) * sizeof(double) / 1024); inp = alloc2DimDoubleArray(inp, maxseqlentrain, windowsize); /* input index train */ fprintf(stderr, "alloc mem for inp_idx training %d KB\n", maxseqlentrain * (windowsize) * sizeof(int) / 1024); inp_idx = alloc2DimIntArray(inp_idx, maxseqlentrain, windowsize); /* fasta description train */ //fprintf(stderr, "alloc mem for fasta description training %d KB\n", MAXCHARSFASTADESC * training_size * sizeof(char) / 1024); //fasta_desc = alloc2DimCharArray(fasta_desc, training_size, MAXCHARSFASTADESC); /* input test */ fprintf(stderr, "alloc mem for inp test %d KB\n", maxseqlentest * (windowsize) * sizeof(double) / 1024); inp_t = alloc2DimDoubleArray(inp_t, maxseqlentest, windowsize); /* input index test */ fprintf(stderr, "alloc mem for inp_idx test %d KB\n", maxseqlentest * (windowsize) * sizeof(int) / 1024); inp_idx_t = alloc2DimIntArray(inp_idx_t, maxseqlentest, windowsize); /* fasta description test */ //fprintf(stderr, "alloc mem for fasta description test %d KB\n", MAXCHARSFASTADESC * test_size * sizeof(char) / 1024); //fasta_desc_t = alloc2DimCharArray(fasta_desc_t, test_size, MAXCHARSFASTADESC); /* target train */ fprintf(stderr, "alloc mem for tar Train %.1f kB\n", (double)training_size * sizeof(int) / 1024); tar = allocIntArray(tar, training_size); /* target test */ fprintf(stderr, "alloc mem for tar Test %.1f kB\n", (double)test_size * sizeof(int) / 1024); tar_t = allocIntArray(tar_t, test_size); fprintf(stderr, "\n"); length = allocIntArray(length, training_size); length_t = allocIntArray(length_t, test_size); Y_in = allocDoubleArray(Y_in, num_blocks); Y_out = allocDoubleArray(Y_out, num_blocks); G = alloc2DimDoubleArray(G, num_blocks, MAXBLOCKSIZE); H = alloc2DimDoubleArray(H, num_blocks, MAXBLOCKSIZE); S = alloc2DimDoubleArray(S, num_blocks, MAXBLOCKSIZE); Yc = alloc2DimDoubleArray(Yc, num_blocks, MAXBLOCKSIZE); }void alloc2(int num_prot, int num_prot_t) { prand = allocIntArray(prand, num_prot); sptrain = (struct seqperf*)malloc(sizeof(struct seqperf) * num_prot); sptest = (struct seqperf*)malloc(sizeof(struct seqperf) * num_prot_t);}void alloc3(int numunits) { W = alloc2DimDoubleArray(W, numunits, numunits); DW = alloc2DimDoubleArray(DW, numunits, numunits); DWold = alloc2DimDoubleArray(DWold, numunits, numunits); Yk_new = allocDoubleArray(Yk_new, numunits); Yk_old = allocDoubleArray(Yk_old, numunits); SI = alloc3DimDoubleArray(SI, num_blocks, MAXBLOCKSIZE, numunits); SC = alloc3DimDoubleArray(SC, num_blocks, MAXBLOCKSIZE, numunits); e = allocDoubleArray(e, numunits); ec = alloc2DimDoubleArray(ec, num_blocks, MAXBLOCKS); eo = allocDoubleArray(eo, num_blocks); es = alloc2DimDoubleArray(es, num_blocks, MAXBLOCKS); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -