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

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

[Octave-bug-tracker] [bug #53232] Range type should implement element-by


From: Rik
Subject: [Octave-bug-tracker] [bug #53232] Range type should implement element-by-element multiplication operator with a scalar
Date: Mon, 26 Feb 2018 20:50:48 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

                 Summary: Range type should implement element-by-element
multiplication operator with a scalar
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Mon 26 Feb 2018 05:50:47 PM PST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

The Range class already implements addition, subtraction, and multiplication
operators with a scalar.  And it implements the corresponding
element-by-elment operators for addition (.+) and subtraction (.-).  But it
does not implement element-by-elment multiplication.

For example:


octave:2> x = 1:5
x =

   1   2   3   4   5

octave:3> typeinfo (x)
ans = range
octave:4> y = x * 2
y =

    2    4    6    8   10

octave:5> typeinfo (y)
ans = range
octave:6> z = x .* 2
z =

    2    4    6    8   10

octave:7> typeinfo (z)
ans = matrix
octave:2> x = 1:5
x =

   1   2   3   4   5

octave:3> typeinfo (x)
ans = range
octave:4> y = x * 2
y =

    2    4    6    8   10

octave:5> typeinfo (y)
ans = range
octave:6> z = x .* 2
z =

    2    4    6    8   10

octave:7> typeinfo (z)
ans = matrix
octave:2> x = 1:5
x =

   1   2   3   4   5

octave:3> typeinfo (x)
ans = range
octave:4> y = x * 2
y =

    2    4    6    8   10

octave:5> typeinfo (y)
ans = range
octave:6> z = x .* 2
z =

    2    4    6    8   10

octave:7> typeinfo (z)
ans = matrix
octave:2> x = 1:5
x =

   1   2   3   4   5

octave:3> typeinfo (x)
ans = range
octave:4> y = x * 2
y =

    2    4    6    8   10

octave:5> typeinfo (y)
ans = range
octave:6> z = x .* 2
z =

    2    4    6    8   10

octave:7> typeinfo (z)
ans = matrix


This seems like an oversight and should be easy to fix as the
element-by-element operator should just map to the same routine that ordinary
multiplication is using.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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