help-octave
[Top][All Lists]
Advanced

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

changing oct-files to be ready for 3.4


From: John W. Eaton
Subject: changing oct-files to be ready for 3.4
Date: Wed, 19 Jan 2011 14:49:47 -0500

On 19-Jan-2011, Carlo de Falco wrote:

| Hi all,
| 
| Some time ago I sent this post which remained unanswered:
| 
"http://octave.1599824.n4.nabble.com/Octave-packages-for-IsoGeometric-analysis-and-moving-to-3-4-tp3091510p3091510.html";
| 
| Probably the question was not specific enough, so I'll try again reducing the 
problem to a minimal function that 
| shows the same issue
| 
| The attached DLD function works as follows in octave 3.2.4:
| 
| >> nel = 5; ndof = 10; nsh = 4; nqn = 9;
| >> in = ones (nqn, nsh, nel);
| >> connectivity = [1 2 3 4; 2 3 4 5; 6 7 8 9; 10 1 2 3; 1 2 3 4; 2 3 4 5; 3 4 
5 6; 1 2 3 4; 2 3 4 5; 6 7 8 9]';
| >> A = test_ndarray_sparse (in, nel, nsh, nqn, ndof, connectivity);
| >> full (A)
| ans =
| 
|    27   27   27   18    0    0    0    0    0    9
|    27   36   36   27    9    0    0    0    0    9
|    27   36   36   27    9    0    0    0    0    9
|    18   27   27   27    9    0    0    0    0    0
|     0    9    9    9    9    0    0    0    0    0
|     0    0    0    0    0    9    9    9    9    0
|     0    0    0    0    0    9    9    9    9    0
|     0    0    0    0    0    9    9    9    9    0
|     0    0    0    0    0    9    9    9    9    0
|     9    9    9    0    0    0    0    0    0    9
| 
| >> 
| 
| while in version 3.3.54+ (built just before the Xmas break) I get
| 
| >> nel = 5; ndof = 10; nsh = 4; nqn = 9;
| >> in = ones (nqn, nsh, nel);
| >> connectivity = [1 2 3 4; 2 3 4 5; 6 7 8 9; 10 1 2 3; 1 2 3 4; 2 3 4 5; 3 4 
5 6; 1 2 3 4; 2 3 4 5; 6 7 8 9]';
| >> A = test_ndarray_sparse (in, nel, nsh, nqn, ndof, connectivity);
| octave(1870,0xa01e8540) malloc: *** error for object 0x5a353f4: incorrect 
checksum for freed object - object was probably modified after being freed.
| *** set a breakpoint in malloc_error_break to debug
| panic: Segmentation fault -- stopping myself...
| Segmentation fault
| 
| Can someone please help me find out (or give me some pointers) what has 
changed between versions that might be causing this problem?

Taking a guess, I added

  #define BOUNDS_CHECKING

to the top of your file.  This caused the call to test_ndarray_sparse
to generate the error

Then ran with gdb to isolate where this was happening.

You need to write

      Array <octave_idx_type> I (nel * nsh * nsh, 1, octave_idx_type (0));
      Array <octave_idx_type> J (nel * nsh * nsh, 1, octave_idx_type (0));
      Array <double> V (nel * nsh * nsh, 1, 0.0);

instead of

      Array <octave_idx_type> I (nel * nsh * nsh, 0);
      Array <octave_idx_type> J (nel * nsh * nsh, 0);
      Array <double> V (nel * nsh * nsh, 0.0);

You can't define a 1-d array with an initialization value because we
also have an Array constructor that takes two dimensions.  How would
we distinguish between the second dimension and the initial value
arguments?

We currently have Array constructors like this:

  // Empty ctor (0x0).
  Array (void)

  // Obsolete 1D ctor (there are no 1D arrays).
  explicit Array (octave_idx_type n) GCC_ATTR_DEPRECATED

  // 2D uninitialized ctor.
  explicit Array (octave_idx_type m, octave_idx_type n)

  // 2D initialized ctor.
  explicit Array (octave_idx_type m, octave_idx_type n, const T& val)

  // nD uninitialized ctor.
  explicit Array (const dim_vector& dv)

  // nD initialized ctor.
  explicit Array (const dim_vector& dv, const T& val)

  // Reshape constructor.
  Array (const Array<T>& a, const dim_vector& dv);

  Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc);

  // Type conversion case.
  template <class U>
  Array (const Array<U>& a)

  // No type conversion case.
  Array (const Array<T>& a)

To avoid confusion, maybe we should deprecate and eventually drop

  // 2D uninitialized ctor.
  explicit Array (octave_idx_type m, octave_idx_type n)

  // 2D initialized ctor.
  explicit Array (octave_idx_type m, octave_idx_type n, const T& val)

  Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc);

and require dim_vectors to be created explicitly?

Note that this would not affect constructors for the NDArray or Matrix
classes.

jwe




reply via email to

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