Macaulay2 Engine
Loading...
Searching...
No Matches

◆ text_out()

template<class Field>
void SLP< Field >::text_out ( buffer & o) const

Definition at line 958 of file NAG.cpp.

959{
961 {
962 if (program->array[4] == slpCOMPILED)
963 {
964 o << "(SLP is precompiled) " << newline;
965 }
966 if (program->array[4] == slpPREDICTOR ||
967 program->array[4] == slpCORRECTOR)
968 {
969 return;
970 }
971 }
972
973 o << "CONSTANT (count = " << num_consts;
974 o << ") nodes:\n";
975 int cur_node = 0;
976 int i, j;
977 for (i = 0; i < num_consts; i++, cur_node++)
978 {
979 char s[100];
980 nodes[cur_node].snprint(s, 100);
981 o << s << ", ";
982 }
983 o << newline;
984 o << "INPUT (count = " << num_inputs << ") nodes:\n";
985 for (i = 0; i < num_inputs; i++, cur_node++) o << cur_node << " ";
986 o << newline;
987
988 switch (program->array[SLP_HEADER_LEN])
989 {
990 case slpPREDICTOR:
991 o << "Predictor: type " << program->array[5] << newline;
992 o << "SLPs: " << program->array[6] << "," << program->array[7] << ","
993 << program->array[8] << newline;
994 break;
995 default:
996 for (i = SLP_HEADER_LEN; program->array[i] != slpEND; cur_node++)
997 {
998 o << cur_node << " => ";
999 switch (program->array[i])
1000 {
1001 case slpCOPY:
1002 o << "copy " << program->array[(++i)++];
1003 break;
1004 case slpMULTIsum:
1005 {
1006 o << "sum";
1007 int n_summands = program->array[i + 1];
1008 for (j = 0; j < n_summands; j++)
1009 o << " " << program->array[i + j + 2];
1010 i += n_summands + 2;
1011 }
1012 break;
1013 case slpPRODUCT:
1014 o << "product " << program->array[i + 1] << " "
1015 << program->array[i + 2];
1016 i += 3;
1017 break;
1018 default:
1019 o << "BLA i=" << i++;
1020 }
1021 o << newline;
1022 }
1023 int out_shift = i + 1;
1024 o << "OUTPUT (" << rows_out << "x" << cols_out << ") nodes:\n";
1025 for (i = 0; i < rows_out; i++)
1026 {
1027 for (j = 0; j < cols_out; j++)
1028 o << program->array[out_shift + i * cols_out + j] << " ";
1029 o << newline;
1030 }
1031 }
1032}
int rows_out
Definition NAG.hpp:502
int cols_out
Definition NAG.hpp:502
M2_arrayint program
Definition NAG.hpp:498
int num_inputs
Definition NAG.hpp:502
element_type * nodes
Definition NAG.hpp:499
int num_consts
Definition NAG.hpp:502
bool is_relative_position
Definition NAG.hpp:497
Definition NAG.hpp:485

References cols_out, is_relative_position, newline, nodes, num_consts, num_inputs, program, rows_out, s, SLP_HEADER_LEN, slpCOMPILED, slpCOPY, slpCORRECTOR, slpEND, slpMULTIsum, slpPREDICTOR, and slpPRODUCT.

Referenced by StraightLineProgram::text_out().