[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54110] bitset: output is zero when first argu
From: |
Philipp Mengs |
Subject: |
[Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar |
Date: |
Wed, 13 Jun 2018 09:16:55 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 |
URL:
<http://savannah.gnu.org/bugs/?54110>
Summary: bitset: output is zero when first argument is vector
and third argument is scalar
Project: GNU Octave
Submitted by: philwatcher
Submitted on: Wed 13 Jun 2018 01:16:54 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: Microsoft Windows
_______________________________________________________
Details:
On Octave 4.4.0 on Windows:
input: bitset([1,2,3,4,5],1,1)
expected return: [1,3,3,5,5]
actually returns: [1,0,0,0,0]
Omitting the third argument ("val") works:
input: bitset([1,2,3,4,5],1)
expected return: [1,3,3,5,5]
actually returns: [1,3,3,5,5]
Setting the third argument to a ones vector works as well:
input: bitset([1,2,3,4,5],1,[1,1,1,1,1])
expected return: [1,3,3,5,5]
actually returns: [1,3,3,5,5]
>From the documentation, I would expect that the third argument would be
broadcast to all vector entries. In the current state, it is only applied to
the first entry (more precisely, if val has n entries it is applied to the
first n entries of the input vector).
In the code, if val is omitted, then the function creates it to the same size
as the input. If val is present, there is no check if the sizes match. I am
not sure if this is intended behavior.
A potential fix would be in bitset.m, around line 53:
if (isscalar(val))
val = logical(ones(sz) * val);
endif
(or a more octavic broadcasting operation)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54110>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar,
Philipp Mengs <=
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Markus Mützel, 2018/06/13
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Mike Miller, 2018/06/13
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Philipp Mengs, 2018/06/13
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Rik, 2018/06/13
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Markus Mützel, 2018/06/14
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Rik, 2018/06/14
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Markus Mützel, 2018/06/14
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Rik, 2018/06/14
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Rik, 2018/06/15
- [Octave-bug-tracker] [bug #54110] bitset: output is zero when first argument is vector and third argument is scalar, Markus Mützel, 2018/06/15