help-octave
[Top][All Lists]
Advanced

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

Re: cat(3, [], A) for 3-dim A


From: David Bateman
Subject: Re: cat(3, [], A) for 3-dim A
Date: Thu, 08 Mar 2007 14:38:54 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Gerd Bürger wrote:
> Hi,
>
> if N=ndims(A)>2, the command
>
> cat(d, [], A),
>
> which should return A, does not work for 3<=d<=N, unlike matlab. It gives
>
> error: Array<T>::insert: range error for insert
>
> Gerd
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>   
Consider the attached patch..

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./liboctave/Array.cc.orig53 2007-03-08 14:36:05.675708462 +0100
--- ./liboctave/Array.cc        2007-03-08 12:15:38.866013121 +0100
***************
*** 1026,1032 ****
  Array<T>&
  Array<T>::insert (const Array<T>& a, octave_idx_type r, octave_idx_type c)
  {
!   if (ndims () == 2 && a.ndims () == 2)
      insert2 (a, r, c);
    else
      insertN (a, r, c);
--- 1026,1034 ----
  Array<T>&
  Array<T>::insert (const Array<T>& a, octave_idx_type r, octave_idx_type c)
  {
!   if (dims().all_zero())
!     *this = a;
!   else if (ndims () == 2 && a.ndims () == 2)
      insert2 (a, r, c);
    else
      insertN (a, r, c);
*** ./src/data.cc.orig53        2007-03-08 14:36:16.003208657 +0100
--- ./src/data.cc       2007-03-08 14:24:27.825065855 +0100
***************
*** 736,742 ****
  
          octave_value tmp;
  
!           for (int i = 1; i < n_args; i++)
            {
              if (! args (i).all_zero_dims ())
                {
--- 736,743 ----
  
          octave_value tmp;
  
!         int i;
!           for (i = 1; i < n_args; i++)
            {
              if (! args (i).all_zero_dims ())
                {
***************
*** 752,765 ****
  
          Array<int> ra_idx (dv.length (), 0);
  
!         for (int i = 1; i < n_args; i++)
            {
!             tmp = do_cat_op (tmp, args (i), ra_idx);
  
              if (error_state)
                return retval;
  
!             dim_vector dv_tmp = args (i).dims ();
  
              ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1);
            }
--- 753,766 ----
  
          Array<int> ra_idx (dv.length (), 0);
  
!         for (int j = i; j < n_args; j++)
            {
!             tmp = do_cat_op (tmp, args (j), ra_idx);
  
              if (error_state)
                return retval;
  
!             dim_vector dv_tmp = args (j).dims ();
  
              ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1);
            }

reply via email to

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