octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #53179] Wrong result with bsxfun (single compl


From: Ceral Paquet
Subject: [Octave-bug-tracker] [bug #53179] Wrong result with bsxfun (single complex argument)
Date: Sat, 17 Feb 2018 16:53:06 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

URL:
  <http://savannah.gnu.org/bugs/?53179>

                 Summary: Wrong result with bsxfun (single complex argument)
                 Project: GNU Octave
            Submitted by: octavebugs
            Submitted on: Sat 17 Feb 2018 09:53:05 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I just ran into a serious problem with bsxfun with single complex arguments.


>> im=ones(4,4,2)+single(i);
>> mask=true(4,4);
>> mask(:,1:2)=0;
>> bsxfun(@times,im,mask)
ans =

ans(:,:,1) =

   0   0   0   0
   0   0   0   0
   0   0   0   0
   0   0   0   0

ans(:,:,2) =

   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i



The result only seems to depend on "im" being single and complex. 


>> bsxfun(@times,real(im),mask)
ans =

ans(:,:,1) =

   0   0   1   1
   0   0   1   1
   0   0   1   1
   0   0   1   1

ans(:,:,2) =

   0   0   1   1
   0   0   1   1
   0   0   1   1
   0   0   1   1

>> bsxfun(@times,double(im),mask)
ans =

ans(:,:,1) =

   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i

ans(:,:,2) =

   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i
   0 + 0i   0 + 0i   1 + 1i   1 + 1i

>> bsxfun(@times,im,double(mask))
ans =

ans(:,:,1) =

   0   0   0   0
   0   0   0   0
   0   0   0   0
   0   0   0   0

ans(:,:,2) =

   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i
   0 + 0i   0 + 0i   0 + 0i   1 + 1i





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53179>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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