bugGNU Octave - Bugs: bug #38959, Complex integer types are not yet...


bug #38959: Complex integer types are not yet implemented

Submitter:  Clemens Buchacher <drizzd>
Submitted:  Fri 10 May 2013 09:58:28 AM UTC
Category:  Libraries Severity:  1 - Wish
Priority:  1 - Later Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Clemens Buchacher Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Wed 19 Apr 2023 12:45:13 AM UTC, comment #6: 

following discussion at https://octave.discourse.group/t/matlab-now-supports-complex-integer-types/4337, there is no plan to implement this anytime soon, at least until there's a pressing compatibility need to use complex integers for calculations.

Nicholas Jankowski <nrjank>
Group Member
Tue 04 Jun 2019 03:30:00 PM UTC, comment #5: 

I'm lowering the priority even further.  Since Matlab does not allow calculation with complex integers, they are pretty useless.  Their only advantage is that they take up less memory, but that is mostly undone by the first point because presumably one would like to use the stored numbers in a calculation.

For anything that really requires complex integers, I would implement a translation unit at the periphery of the program that converts I/O back and forth between complex integer and complex double.  Since there should be only a few interfaces, say with a hardware peripheral, this isn't onerous.

Rik <rik5>
Group administrator
Sun 20 Nov 2016 10:23:44 PM UTC, comment #4: 

This issue is still present in Octave 4.2.0.

Hartmut <hardy>
Wed 24 Jun 2015 10:54:36 AM UTC, comment #3: 

I found a use case for this on stack overflow (see comments to the question http://stackoverflow.com/questions/30923613/how-do-i-make-complex-int16-numbers-in-octave#comment50055152_30923613 )

> It does have to be converted to int16 to communicate with hardware. But you are right it seems that prior to computation the array is converted to double anyways.

Carnë Draug <carandraug>
Group Member
Fri 10 May 2013 03:26:20 PM UTC, comment #2: 

I noticed it in one of our unit tests and worked around it by disabling the test for complex integer types. I have no real world example of usefulness.

Clemens Buchacher <drizzd>
Fri 10 May 2013 02:16:57 PM UTC, comment #1: 

Alright, looks like Matlab allows complex integers, even though it doesn't allow complex integer arithmetic.

This will require a major retooling of our integer types so that we can make them all complex. If this bug is important (does a lot of Matlab code rely on being able to create complex integers?), this would be a good opportunity to revisit our stupidly boneheaded numeric class hierarchy so we can make it less boneheaded.

Jordi Gutiérrez Hermoso <jordigh>
Group Member
Fri 10 May 2013 09:58:28 AM UTC, original submission:  

The int32 conversion function refuses to convert complex input:

  • Expected result:

> int32(1+1i)

ans =  1 + 1i

  • Actual result:

> int32(1+1i)

error: invalid conversion from complex scalar to int32 scalar

The complex() function does not provide a workaround, since it converts int32 input to double output:

> complex(int32(1), int32(1))

ans =  1 + 1i

> class(complex(int32(1), int32(1)))

ans = double

Conversion functions for other types do not have this issue:

> single(1+1i)

ans =  1 + 1i

Clemens Buchacher <drizzd>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by drizzd (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.


    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-19 nrjank StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    2019-06-04 mtmiller Carbon-CopyRemoved 80942 -
    2019-06-04 rik5 Priority3 - Low 1 - Later
    2015-06-22 mtmiller Severity3 - Normal 1 - Wish
        Priority5 - Normal 3 - Low
        Release3.6.4 dev
        SummaryConversion from complex double to int32 Complex integer types are not yet implemented
    2015-06-22 mtmiller Dependencies- bugs #45373 is dependent
    2013-05-10 jordigh Open/ClosedClosed Open
    2013-05-10 jordigh StatusNone Confirmed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12