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

◆ start_computation()

void GBinhom_comp::start_computation ( )
virtual

Implements GBComputation.

Definition at line 766 of file gb-sugarless.cpp.

767{
769
770 for (;;)
771 {
772 if (system_interrupted())
773 {
774 is_done = COMP_INTERRUPTED;
775 break;
776 }
777
778 if (need_resize)
779 {
780 is_done = COMP_NEED_RESIZE;
781 break;
782 }
783
784 is_done = computation_complete();
785 if (is_done != COMP_COMPUTING) break;
786
787 if (error())
788 {
789 is_done = COMP_ERROR;
790 break;
791 }
792 s_pair *p = spairs->remove();
793 if (p == nullptr)
794 {
795 is_done = COMP_DONE;
796 break;
797 }
798 int stype = s_pair_step(p);
799 if (M2_gbTrace >= 3 && M2_gbTrace <= 7) switch (stype)
800 {
801 case SPAIR_GB:
802 emit_wrapped("m");
803 break;
804 case SPAIR_SYZ:
805 emit_wrapped("z");
806 break;
807 case SPAIR_ZERO:
808 emit_wrapped("o");
809 break;
810 case SPAIR_REMOVED:
811 emit_wrapped("r");
812 break;
813 default:
814 emit_wrapped("ERROR");
815 break;
816 }
817 }
818
819 // MES: complete the reduction of the GB here
820 if (M2_gbTrace >= 1) emit_line("");
821 if (M2_gbTrace >= 4)
822 {
823 buffer o;
824 o << "Number of pairs = " << n_pairs << newline;
825 o << "Number of gb elements = " << n_gb << newline;
826 o << "Number of gcd=1 pairs = " << n_saved_gcd << newline;
827 o << "Number of gcd tails=1 pairs = " << n_saved_lcm << newline;
828 o << "Number of pairs computed = " << n_computed << newline;
829 emit(o.str());
830 }
831 set_status(is_done);
832}
enum ComputationStatusCode set_status(enum ComputationStatusCode)
Definition comp.cpp:66
s_pair_heap * spairs
ComputationStatusCode computation_complete() const
int s_pair_step(s_pair *p)
char * str()
Definition buffer.hpp:72
const int SPAIR_ZERO
Definition comp-gb.hpp:53
const int SPAIR_GB
Definition comp-gb.hpp:51
const int SPAIR_SYZ
Definition comp-gb.hpp:52
const int SPAIR_REMOVED
Definition comp-gb.hpp:58
ComputationStatusCode
Definition computation.h:53
@ COMP_NEED_RESIZE
Definition computation.h:55
@ COMP_DONE
Definition computation.h:60
@ COMP_ERROR
Definition computation.h:56
@ COMP_COMPUTING
Definition computation.h:71
@ COMP_INTERRUPTED
Definition computation.h:57
int error()
Definition error.c:48
int p
bool system_interrupted()
char newline[]
Definition m2-types.cpp:49
int M2_gbTrace
Definition m2-types.cpp:52
void emit_wrapped(const char *s)
Definition text-io.cpp:27
void emit_line(const char *s)
Definition text-io.cpp:47
void emit(const char *s)
Definition text-io.cpp:41

References COMP_COMPUTING, COMP_DONE, COMP_ERROR, COMP_INTERRUPTED, COMP_NEED_RESIZE, computation_complete(), emit(), emit_line(), emit_wrapped(), error(), M2_gbTrace, n_computed, n_gb, n_pairs, n_saved_gcd, n_saved_lcm, need_resize, newline, p, s_pair_step(), Computation::set_status(), SPAIR_GB, SPAIR_REMOVED, SPAIR_SYZ, SPAIR_ZERO, spairs, buffer::str(), and system_interrupted().