guile-devel
[Top][All Lists]
Advanced

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

Array bugs


From: Ludovic Courtès
Subject: Array bugs
Date: Sun, 04 Mar 2007 22:07:50 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Hi,

There are a couple of bug reports (see below) by SZAVAI Gyula
(Nov. 2006, on `bug-guile') that I have not fixed.  I'm not very
familiar with this area and after re-looking at it, I still feel unable
to make an accurate evaluation of the issue and solution.

In particular:

  1. I don't understand how `scm_shap2ra ()' is supposed to behave when
     LBND > UBND since it doesn't check it.  Is it intended?  Should it
     instead inverse the bounds order?  Or keep the bounds as is and set
     INC = -1?

  2. AFAIU, 1-dimensional arrays with LBND == 0 are treated specially so
     that they are simply vectors.  Thus, the second hunk of Gyula's
     first patch seems inconsistent.

  3. I don't understand how the first hunk of the first patch relates to
     the issue, but I don't understand either the first part of the `if'
     condition (without the patch).

  4. Regarding the second patch, I don't grasp what the "contiguous"
     flag is about.

Could anyone please help with this?  :-)

Thanks in advance,
Ludovic.

--- Begin Message --- Subject: Topics
Topics:
   bounds of 1-dimensional empty arrays
   contents of empty shared array

--- End Message ---
--- Begin Message --- Subject: bounds of 1-dimensional empty arrays Date: Thu, 30 Nov 2006 14:21:08 +0100
guile-1.8-20061126


address@hidden()
==> #()

(array-shape (make-array #t '(10 9)))
==> ((0 -1))

(make-shared-array #() (lambda x #f) '(10 9))
==> #()




--- orig/libguile/unif.c        2006-11-29 23:05:46.526091200 +0100
+++ mod/libguile/unif.c 2006-11-30 01:08:03.876683200 +0100
@@ -764,7 +764,7 @@
   SCM_I_ARRAY_V (ra) = creator (scm_from_size_t (rlen), fill);

   if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
-    if (s->ubnd < s->lbnd || (0 == s->lbnd && 1 == s->inc))
+    if (0 == s->lbnd && 1 == s->inc)
       return SCM_I_ARRAY_V (ra);
   return ra;
 }
@@ -898,10 +898,7 @@
       inds = scm_cons (scm_from_long (s[k].lbnd), inds);
       if (s[k].ubnd < s[k].lbnd)
        {
-         if (1 == SCM_I_ARRAY_NDIM (ra))
-           ra = make_typed_vector (scm_array_type (ra), 0);
-         else
-           SCM_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
+         SCM_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
          scm_array_handle_release (&old_handle);
          return ra;
        }




_______________________________________________
Bug-guile mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-guile



--- End Message ---
--- Begin Message --- Subject: contents of empty shared array Date: Thu, 30 Nov 2006 14:20:57 +0100
guile-1.8-20061126


(let ((a (make-shared-array #() (lambda x #f) 0 2)))
  (array-contents a))
==> #f

---------------

(let ((a (make-shared-array #() (lambda x #f) 0 2)))
  (array-for-each display a))     ; and other scm_ramapc-based functions

Backtrace:
In current input:
   3: {0}* (let* ((a (make-shared-array # # ...))) (display a) ...)
   5: 1  [array-for-each #<primitive-generic display> #2:0:2()]

<unnamed port>:5:3: In procedure array-for-each in expression 
(array-for-each di
splay a):
<unnamed port>:5:3: Value out of range: 0
ABORT: (out-of-range)





--- orig/libguile/unif.c        2006-11-30 10:25:50.101433600 +0100
+++ mod/libguile/unif.c 2006-11-30 13:03:16.244320000 +0100
@@ -900,6 +900,7 @@
        {
          SCM_I_ARRAY_V (ra) = make_typed_vector (scm_array_type (ra), 0);
          scm_array_handle_release (&old_handle);
+         SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
          return ra;
        }
     }




_______________________________________________
Bug-guile mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-guile



--- End Message ---

reply via email to

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