[Top][All Lists]

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

Re: complexNDarray of type std::complex<long long>

From: Mike Miller
Subject: Re: complexNDarray of type std::complex<long long>
Date: Thu, 14 May 2015 09:15:25 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, May 13, 2015 at 22:45:42 -0700, shravan61 wrote:
> Hi,
> I am writing oct functions which call an external library. The functions
> that I use from external library takes input arguments of type
> std::complex<long long>* . But in octave, complexNDarray is of type
> std::complex<double>. As long long and double have different represenation
> in the hardware, I cannot typecast pointers. So, I have to copy the data
> from complexNDarray to std::complex<long long> array. 
> When passing large array as input to the external function, copying is
> slowing down the simulation. I want to increase the speed (avoid copying,
> instead take advantage of pointers). Looks like I have to add
> std::complex<long long> type to Octave.
> Can anyone please give me direction on how to add std::complex<long long>?

You are talking about a long long integer, correct?

Such a change would probably not be welcome in Octave upstream, but you
are more than welcome to add such a type as your own local modification
if you can get it working. You would need to add a new MArray type in
liboctave/array, add a new octave_value type in libinterp/octave-value,
and support the new type wherever needed in octave-value and in other
supporting functions for operations, file I/O, etc.

Are you aware that std::complex<T> for any type T that is not floating
point is not supported by the C++ library?

But if you have a third-party library and that's the interface they
chose and you can't change it, it might be easier for you to work with
an int64 array of interleaved real/imaginary values and typecast that
into the library.



reply via email to

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