--- octave-forge-2004.09.09.orig/main/comm/galois-ops.h +++ octave-forge-2004.09.09/main/comm/galois-ops.h @@ -106,6 +106,31 @@ #define DEFCATOP_G_FN(name, t1, t2, f) \ CATOPDECL (name, a1, a2) \ { \ + CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ + return new octave_galois (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ + } + +#define DEFCATOP_G_METHOD(name, t1, t2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (octave_ ## t1&, const octave_ ## t2&); \ + return new octave_galois (v1.t1 ## _value (). f (v2.t2 ## _value (), ra_idx)); \ + } + +#define INSTALL_G_CATOP(t1, t2, f) INSTALL_CATOP(t1, t2, f) + +#elif defined(HAVE_OLD_OCTAVE_CONCAT) + +#define DEFCATOP_G_FN(name, t1, t2, f) \ + CATOPDECL (name, a1, a2) \ + { \ + CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ + return new octave_galois (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ + } + +#define DEFCATOP_G_METHOD(name, t1, t2, f) \ + CATOPDECL (name, a1, a2) \ + { \ CAST_BINOP_ARGS (const octave_ ## t1&, const octave_ ## t2&); \ return new octave_galois (f (v1.t1 ## _value (), v2.t2 ## _value (), ra_idx)); \ } @@ -113,6 +138,7 @@ #define INSTALL_G_CATOP(t1, t2, f) INSTALL_CATOP(t1, t2, f) #else #define DEFCATOP_G_FN(name, t1, t2, f) +#define DEFCATOP_G_METHOD(name, t1, t2, f) #define INSTALL_G_CATOP(t1, t2, f) #endif --- octave-forge-2004.09.09.orig/main/comm/galois.cc +++ octave-forge-2004.09.09/main/comm/galois.cc @@ -225,7 +225,7 @@ return retval; } -#ifdef HAVE_OCTAVE_CONCAT +#ifdef HAVE_OLD_OCTAVE_CONCAT galois concat (const galois& ra, const galois& rb, const Array& ra_idx) { galois retval (ra); @@ -264,6 +264,50 @@ retval.insert (tmp, ra_idx(0), ra_idx(1)); return retval; } +#endif + +#ifdef HAVE_OCTAVE_CONCAT +galois +galois::concat (const galois& rb, const Array& ra_idx) +{ + if (rb.numel() > 0) + insert (rb, ra_idx(0), ra_idx(1)); + return *this; +} + +galois +galois::concat (const Matrix& rb, const Array& ra_idx) +{ + if (numel() == 1) + return *this; + + galois tmp (0, 0, 0, m(), primpoly()); + int _n = (1< _n)) { + gripe_range_galois(m()); + return *this; + } + if ((rb(i,j) - (double)((int)rb(i,j))) != 0.) { + gripe_integer_galois(); + return *this; + } + tmp(i,j) = (int)rb(i,j); + } + } + + insert (tmp, ra_idx(0), ra_idx(1)); + return *this; +} +#endif + +#if defined (HAVE_OLD_OCTAVE_CONCAT) || defined (HAVE_OCTAVE_CONCAT) galois concat (const Matrix& ra, const galois& rb, const Array& ra_idx) { --- octave-forge-2004.09.09.orig/main/comm/galois.h +++ octave-forge-2004.09.09/main/comm/galois.h @@ -92,11 +92,19 @@ boolMatrix all (int dim = -1) const; boolMatrix any (int dim = -1) const; -#ifdef HAVE_OCTAVE_CONCAT +#ifdef HAVE_OLD_OCTAVE_CONCAT friend galois concat (const galois& ra, const galois& rb, const Array& ra_idx); friend galois concat (const galois& ra, const Matrix& rb, const Array& ra_idx); +#endif + +#ifdef HAVE_OCTAVE_CONCAT + galois concat (const galois& rb, const Array& ra_idx); + galois concat (const Matrix& rb, const Array& ra_idx); +#endif + +#if defined(HAVE_OCTAVE_CONCAT) || defined(HAVE_OLD_OCTAVE_CONCAT) friend galois concat (const Matrix& ra, const galois& rb, const Array& ra_idx); --- octave-forge-2004.09.09.orig/main/comm/op-gm-gm.cc +++ octave-forge-2004.09.09/main/comm/op-gm-gm.cc @@ -80,7 +80,7 @@ DEFBINOP_FN (el_and, galois, galois, mx_el_and) DEFBINOP_FN (el_or, galois, galois, mx_el_or) -DEFCATOP_G_FN (gm_gm, galois, galois, concat) +DEFCATOP_G_METHOD (gm_gm, galois, galois, concat) DEFASSIGNOP_FN (assign, galois, galois, assign) --- octave-forge-2004.09.09.orig/main/comm/op-gm-m.cc +++ octave-forge-2004.09.09/main/comm/op-gm-m.cc @@ -68,7 +68,7 @@ DEFBINOP_FN (el_and, galois, matrix, mx_el_and) DEFBINOP_FN (el_or, galois, matrix, mx_el_or) -DEFCATOP_G_FN (gm_m, galois, matrix, concat) +DEFCATOP_G_METHOD (gm_m, galois, matrix, concat) // Need to create temporary Galois array so that matrix values are checked DEFASSIGNOP (assign, galois, matrix) --- octave-forge-2004.09.09.orig/main/comm/op-gm-s.cc +++ octave-forge-2004.09.09/main/comm/op-gm-s.cc @@ -68,13 +68,20 @@ DEFBINOP_FN_B_S2 (el_and, galois, scalar, mx_el_and) DEFBINOP_FN_B_S2 (el_or, galois, scalar, mx_el_or) -#ifdef DEFCATOP +#ifdef HAVE_OLD_OCTAVE_CONCAT DEFCATOP (gm_s, galois, scalar) { CAST_BINOP_ARGS (const octave_galois&, const octave_scalar&); return new octave_galois (concat (v1.galois_value (), v2.matrix_value (), ra_idx)); } +#elif defined(HAVE_OCTAVE_CONCAT) +DEFCATOP (gm_s, galois, scalar) +{ + CAST_BINOP_ARGS (octave_galois&, const octave_scalar&); + return new octave_galois (v1.galois_value (). concat (v2.matrix_value (), + ra_idx)); +} #endif DEFASSIGNOP(assign, galois, scalar) --- octave-forge-2004.09.09.orig/main/comm/op-s-gm.cc +++ octave-forge-2004.09.09/main/comm/op-s-gm.cc @@ -81,13 +81,20 @@ DEFBINOP_FN_B_S1 (el_and, scalar, galois, mx_el_and) DEFBINOP_FN_B_S1 (el_or, scalar, galois, mx_el_or) -#ifdef DEFCATOP +#ifdef HAVE_OLD_OCTAVE_CONCAT DEFCATOP (s_gm, scalar, galois) { CAST_BINOP_ARGS (const octave_scalar&, const octave_galois&); return new octave_galois (concat (v1.matrix_value (), v2.galois_value (), ra_idx)); } +#elif defined (HAVE_OCTAVE_CONCAT) +DEFCATOP (s_gm, scalar, galois) +{ + CAST_BINOP_ARGS (octave_scalar&, const octave_galois&); + return new octave_galois (concat (v1.matrix_value (), v2.galois_value (), + ra_idx)); +} #endif void --- octave-forge-2004.09.09.orig/main/comm/ov-galois.cc +++ octave-forge-2004.09.09/main/comm/ov-galois.cc @@ -56,7 +56,7 @@ #endif -#ifdef HAVE_OCTAVE_CONCAT +#if defined (HAVE_OCTAVE_CONCAT) || defined (HAVE_OLD_OCTAVE_CONCAT) octave_value octave_galois::resize (const dim_vector& dv) const { if (dv.length() > 2) --- octave-forge-2004.09.09.orig/main/comm/ov-galois.h +++ octave-forge-2004.09.09/main/comm/ov-galois.h @@ -34,7 +34,7 @@ #include #include -#ifdef HAVE_OCTAVE_CONCAT +#if defined(HAVE_OCTAVE_CONCAT) || defined(HAVE_OLD_OCTAVE_CONCAT) #include #endif @@ -111,7 +111,7 @@ } #endif -#ifdef HAVE_OCTAVE_CONCAT +#if defined(HAVE_OCTAVE_CONCAT) || defined(HAVE_OLD_OCTAVE_CONCAT) octave_value resize (const dim_vector& dv) const; size_t byte_size (void) const { return gval.byte_size (); } --- octave-forge-2004.09.09.orig/main/symbolic/findsymbols.cc +++ octave-forge-2004.09.09/main/symbolic/findsymbols.cc @@ -48,7 +48,7 @@ /* have to convert back to compare: */ get_symbol(symlist(j),ex_sym); sym = GiNaC::ex_to(ex_sym); - if(sym==sym_new) { + if(GiNaC::operator == (sym,sym_new)) { unique = false; break; } else { --- octave-forge-2004.09.09.orig/main/symbolic/ov-ex.cc +++ octave-forge-2004.09.09/main/symbolic/ov-ex.cc @@ -115,7 +115,7 @@ GiNaC::symbol sym = GiNaC::ex_to(x); std::vector::iterator iter_symlist; for(iter_symlist=symbol_list.begin();iter_symlistsym) { + if(GiNaC::operator == (sym, iter_symlist->sym)) { iter_symlist->refcount --; if(iter_symlist->refcount==0) symbol_list.erase(iter_symlist);