18 out = fopen(filename,
"w");
19 if (!out)
return "Cannot save your File";
26 fprintf(out,
"%-10s ",
entries[row]->name);
27 for (col=0; col<row; col++) {
28 fprintf(out,
"%6f ",
matrix->
get(row, col));
46 char **nds_results =
new char*[
nentries];
52 buf = labeler.speciesLabel(gb_main, gb_species,
NULp,
NULp);
53 while (buf[0] ==
' ') ++buf;
57 maxnds =
std::max(maxnds, strlen(buf));
60 #if defined(DEBUG) && 0
61 fprintf(out,
"maxnds=%zu\n", maxnds);
67 if (!tabbed && (col%4) == 0)
fputc(
'\t', out);
68 fprintf(out,
"\t%s", nds_results[col]);
73 bool *eos_reached =
new bool[
nentries];
74 for (col = 0; col<
nentries; ++col) eos_reached[col] =
false;
76 for (row = 0; row<maxnds; ++row) {
77 for (col = 0; col<(maxnds+2); ++col)
fputc(
' ', out);
80 if (!tabbed && (col%4) == 0)
fputs(
" ", out);
83 if (!eos_reached[col]) {
84 c = nds_results[col][row];
85 if (!c) { c =
' '; eos_reached[col] =
true; }
87 fprintf(out,
" %c ", c);
92 delete [] eos_reached;
97 if (!tabbed && (row%4) == 0) fprintf(out,
"\n");
100 fprintf(out,
"%s", nds_results[row]);
103 fprintf(out,
"%-*s ",
int(maxnds), nds_results[row]);
111 else if ((col%4) == 0) {
115 double val2 =
matrix->
get(row, col) * 100.0;
118 if (val2 > 99.9 || row == col) sprintf(buf,
"%4.0f", val2);
119 else sprintf(buf,
"%4.1f", val2);
122 char *
dot = strchr(buf,
'.');
128 if (!tabbed)
fputc(
' ', out);
130 if (val2 > max) max = val2;
131 if (val2 < min) min = val2;
140 fprintf(out,
"Minimum:\t%f\n", min);
141 fprintf(out,
"Maximum:\t%f\n", max);
142 fprintf(out,
"Average:\t%f\n", sum/(nentries*nentries));
144 for (col=0; col<
nentries; col++) free(nds_results[col]);
145 delete [] nds_results;
static void dot(double **i, double **j, double **k)
char * ARB_strdup(const char *str)
GB_ERROR GB_export_error(const char *error)
static void error(const char *msg)
GBDATA * GBT_find_species_rel_species_data(GBDATA *gb_species_data, const char *name)
fputs(TRACE_PREFIX, stderr)
T get(size_t i, size_t j) const
const char * save(const char *filename, enum DI_SAVE_TYPE type)
GB_transaction ta(gb_var)