help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failure to compile Octave 3.0.2 on AIX 5.3


From: David Bateman
Subject: Re: Failure to compile Octave 3.0.2 on AIX 5.3
Date: Tue, 07 Oct 2008 01:28:02 +0100
User-agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724)

John W. Eaton wrote:
Oops, this patch does not do what I intended.

David, can you please take a look at this?  The source of the problem
seems to be the extern declarations in the SPARSE_SMSM_BOOL_OP and
SPARSE_MSM_CMP_OP macros in Sparse-op-defs.h.

I don't think these macros should be unconditionally declaring mixed
ops for Complex and double types.  If they include extern declarations
at all, they should probably be of the form

  extern OCTAVE_API SparseBoolMatrix F (const M1::elt_type&, const M2&);

but maybe it would be better to include the generated smx-X-Y.h file
that declares these mixed-type functions in any file that uses these
macros?  To do that will probably require some changes to the
sparse-mk-ops.awk script.  Also, I think the sparse-mk-ops.awk script
is not generating all the necessary functions and declarations.


I was trying in this code to share code between
SPARSE_SMS_CMP_OPS, SPARSE_SSM_CMP_OPS and SPARSE_SMSM_CMP_OPS, but forgot the case of M1 or M2 to SPARSE_SMSM_CMP_OPS being boolean. I suppose the easiest fix for this would just be to duplicate some of the code to get rid of the externs. The mixed sparse boolean, double ops aren't needed as Octave in that case promotes the boolean to a double in any case before treating it.

Changeset attached.

D.



--
David Bateman                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1223339173 -3600
# Node ID 73a5c0435018346793feb9c5e357c2a8afb7c497
# Parent  8eef4d0469250e678c877c8a2259f6c8b0d781f9
AIX Build fix

diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-07  David Bateman  <address@hidden>
+       
+       * Sparse-op-defs.h (SPARSE_SMSM_CMP_OPS): Duplicate code for scalar
+       sparse arguments rather than rely on extern function.
+
 2008-09-30  Jaroslav Hajek <address@hidden>
 
        * oct-inttypes.h: Mostly rewrite. 
diff --git a/liboctave/Sparse-op-defs.h b/liboctave/Sparse-op-defs.h
--- a/liboctave/Sparse-op-defs.h
+++ b/liboctave/Sparse-op-defs.h
@@ -749,15 +749,61 @@
     \
     if (m1_nr == 1 && m1_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const double&, const M2&); \
-        extern OCTAVE_API SparseBoolMatrix F (const Complex&, const M2&); \
-        r = F (m1.elem(0,0), m2); \
+    if (C1 (m1.elem(0,0)) OP C2 (Z2)) \
+         { \
+           r = SparseBoolMatrix (m2_nr, m2_nc, true); \
+           for (octave_idx_type j = 0; j < m2_nc; j++) \
+             for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
+               if (! (C1 (m1.elem (0,0)) OP C2 (m2.data(i)))) \
+                 r.data (m2.ridx (i) + j * m2_nr) = false; \
+           r.maybe_compress (true); \
+         } \
+       else \
+         { \
+           r = SparseBoolMatrix (m2_nr, m2_nc, m2.nnz ()); \
+           r.cidx (0) = static_cast<octave_idx_type> (0); \
+           octave_idx_type nel = 0; \
+           for (octave_idx_type j = 0; j < m2_nc; j++) \
+             { \
+               for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \
+                 if (C1 (m1.elem (0,0)) OP C2 (m2.data(i))) \
+                   { \
+                     r.ridx (nel) = m2.ridx (i); \
+                     r.data (nel++) = true; \
+                   } \
+               r.cidx (j + 1) = nel; \
+             } \
+           r.maybe_compress (false); \
+         } \
       } \
     else if (m2_nr == 1 && m2_nc == 1) \
       { \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const double&); \
-        extern OCTAVE_API SparseBoolMatrix F (const M1&, const Complex&); \
-        r = F (m1, m2.elem(0,0)); \
+       if (C1 (Z1) OP C2 (m2.elem (0,0))) \
+         { \
+           r = SparseBoolMatrix (m1_nr, m1_nc, true); \
+           for (octave_idx_type j = 0; j < m1_nc; j++) \
+             for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
+               if (! (C1 (m1.data (i)) OP C2 (m2.elem(0,0)))) \
+                 r.data (m1.ridx (i) + j * m1_nr) = false; \
+           r.maybe_compress (true); \
+         } \
+       else \
+         { \
+           r = SparseBoolMatrix (m1_nr, m1_nc, m1.nnz ()); \
+           r.cidx (0) = static_cast<octave_idx_type> (0); \
+           octave_idx_type nel = 0; \
+           for (octave_idx_type j = 0; j < m1_nc; j++) \
+             { \
+               for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \
+                 if (C1 (m1.data (i)) OP C2 (m2.elem(0,0))) \
+                   { \
+                     r.ridx (nel) = m1.ridx (i); \
+                     r.data (nel++) = true; \
+                   } \
+               r.cidx (j + 1) = nel; \
+             } \
+           r.maybe_compress (false); \
+         } \
       } \
     else if (m1_nr == m2_nr && m1_nc == m2_nc) \
       { \

reply via email to

[Prev in Thread] Current Thread [Next in Thread]