00001 #include <scil/row_entry.h>
00002 #include <scil/var_obj.h>
00003
00004 using namespace SCIL;
00005
00006 row_entry::row_entry(var v, double c)
00007 {
00008 coeff=c;
00009 Var=v;
00010 };
00011
00012
00013 std::ostream& SCIL::operator<<(std::ostream& o,const row_entry& re)
00014 {
00015 if(re.Var == nil) return o<<re.coeff;
00016 else return o<<re.coeff<<"*x"<<re.Var.var_pointer()->index();
00017 };
00018
00019
00020 std::istream& operator>>(std::istream& i,const row_entry&)
00021 {
00022 return i;
00023 };
00024
00025 bool SCIL::operator< ( const row_entry& re1, const row_entry& re2 )
00026 {
00027 return (re1.Var < re2.Var);
00028 };
00029
00030 namespace SCIL {
00031 int compare(const row_entry& t1, const row_entry& t2)
00032 {
00033 return compare(t1.Var,t2.Var);
00034 }
00035 };
00036
00037
00038