Forgot your password?

typodupeerror
Math Software Technology Science

MATLAB Can't Manipulate 64-Bit Integers 334

Posted by kdawson
from the does-not-compute dept.
An anonymous reader writes "MATLAB, an important package of mathematical software heavily used in industry and academia, has had support for 64-bit machines for several years now. However, the MATLAB developers still haven't gotten around to implementing even basic arithmetic operations for 64-bit integers. Attempting to add, divide, subtract, or multiply two 64-bit integers will result in an error message saying that the corresponding method does not exist. As one commentator put it, 'What is the point of having numerical data types that can't be manipulated?'" The post notes that the free MATLAB clone GNU Octave deals with 64-bit integers just fine.
This discussion has been archived. No new comments can be posted.

MATLAB Can't Manipulate 64-Bit Integers

Comments Filter:
  • So... (Score:5, Insightful)

    by Anonymous Coward on Sunday May 02 2010, @08:41PM (#32067898)

    How is this news?

  • Answer (Score:3, Insightful)

    by girlintraining (1395911) on Sunday May 02 2010, @08:43PM (#32067918)

    What is the point of having numerical data types that can't be manipulated?

    So they can charge more for the upgrade?

  • by seeker_1us (1203072) on Sunday May 02 2010, @08:51PM (#32067996)
    Yes it is. People who do the kind of hardcore math that MATLAB is good at are the ones who actually need 64 bit computing.
  • by Anonymous Coward on Sunday May 02 2010, @09:00PM (#32068054)

    Yes it is. People who do the kind of hardcore math that MATLAB is good at are the ones who actually need 64 bit computing.

    Surprisingly, not all that often. People who work with very sensitive systems (chaotic one in particular) or VERY precise data need 64 bit precision, but for 98% of everyone else, it's just not necessary. Anyone doing really advanced work is going to use a supercomputer, for obvious reasons.

    MATLAB's largest audience is engineers, although applied mathematicians and physicists use it often, just not nearly in equal numbers with engineers (who also outnumber the others greatly). Given that engineers work with real data, which never has more than 6 digits of accuracy anyway (3 is more realistic), the push for higher precision just isn't there.

    It's one reason MATLAB doesn't have the greatest 64-bit support: there's no real demand for it, yet. The few who need it can just as easily work in C++, since all MATLAB really is is a collection of routines with a nice interface, much easier plotting/graphic commands, and a nice set of help files.

    For reference, I've had 64 bit computing readily available to me for...my entire career, and I've never once NEEDED it, despite being an applied mathematician.

  • by Daniel Dvorkin (106857) * on Sunday May 02 2010, @09:03PM (#32068066) Homepage Journal

    SciPy/NumPy, R, and Octave are all perfectly good alternatives to MATLAB these days for most work. But there are a lot of people who rely on MATLAB-specific toolboxes. I look forward to the day when proprietary math and stats packages take their place in the bitbucket of computing history, but we're not quite there yet.

  • by TerribleNews (1195393) on Sunday May 02 2010, @09:03PM (#32068068)
    As someone who uses math quite a lot in academia, I can tell you that I've never noticed the missing operators. I just don't use 64-bit integers. The reason *I* upgraded to 64-bit Matlab is because I kept running up against memory constraints. 64-bit Matlab can allocate much larger arrays. I am sure there are places where it would be convenient to use really big integers but I find it hard to believe that this is really a big headache for anyone; the main improvement with the 64-bit version is a much bigger memory space.
  • by robot256 (1635039) on Sunday May 02 2010, @09:05PM (#32068086)
    If you're a physicist using MATLAB, then you are (a) using floating point arithmetic, not huge integers and (b) more likely to be using Mathematica than MATLAB in the first place. Huge integers are more useful in computer science, doing encryption and data processing and such, than in physical simulations. Says the EE/Physics guy with no background in CS.
  • by coolsnowmen (695297) on Sunday May 02 2010, @09:10PM (#32068118)

    numerical computations that are highly optimized for speed on computers do not always allow for variable sized numbers. The more you assume about a problem, the faster you can make the algorithm to solve it. I'm betting that there are many optimized numerical algorithms in matlab that use underlying knowledge of the data structure itself to solve it. It is a trade off speed vs scalability/generality.

  • by martin-boundary (547041) on Sunday May 02 2010, @09:13PM (#32068130)
    Huh? How did physicists manage before the era of 64 bit computing, then?

    This is ridiculous, the first thing any self respecting physicist will do is change the units of the problem.

  • by usul294 (1163169) on Sunday May 02 2010, @09:14PM (#32068146)
    MATLAB does most everything with doubles, int and float formats are really only there when dealing with input/output to files. If i put A = 1 into a command line, its put in memory as a double. I use MATLAB most of my working day for signal processing algorithim design, and I don't think I've ever needed the precision of a 64 bit integer. Numbers bigger than a 32 bit integer can handle pop up from time to time, but never with more precision than a double provides.
  • by nedlohs (1335013) on Sunday May 02 2010, @09:16PM (#32068160)

    1. MATLAB doesn't support 64 bit ints
    2. People still us MATLAB.

    Thus, there is a group of people "who do the kind of hardcore math that MATLAB is good at" who don't need 64 bit computing.

  • by Jah-Wren Ryel (80510) on Sunday May 02 2010, @09:32PM (#32068262)

    Frankly, even equally worrisome is that Matlab doesn't appear to take advantage of GPGPU yet. The concept has been around for over half a decade, and I'd have expected the MAtrix LABoratory to jump on the bandwagon quicker than most. It's a game changer in their core competency, after all.

    I haven't looked at MATLAB+GPGPU recently, but back in the olden days before CUDA and OpenCL there were a handful of 3rd party matlab extensions that made use of GPGPU. Nothing official, but still plenty functional in their limited areas of implementation. The company's laziness with respect to GPGPU is no surprise (see my other rant in this story's discussion) and the fact that others have put together limited GPU-based extensions has probably further reduced the pressure for them to do anything in that area.

  • by ProfMobius (1313701) on Sunday May 02 2010, @09:39PM (#32068306)
    Well, having to go dig an additional library to add native types is a bit paradoxal isn't it ? Even more when the software cost a lot of money and is directed at engineers.
  • Re:MATLAB ~= fast (Score:3, Insightful)

    by Brett Buck (811747) on Sunday May 02 2010, @09:44PM (#32068328)

    Only if it can be vectorized. Otherwise, MATLAB is *bog slow*. Compiling as a MEX function will restore the speed.

  • by Anonymous Coward on Sunday May 02 2010, @09:48PM (#32068354)

    And chip designers. And number theory specialists (not all of them, oh the shock, are cryptographers). In fact, anyone that uses a number as an abstraction and not a physically interpreted quantity.

  • by WeatherGod (1726770) on Sunday May 02 2010, @09:50PM (#32068364)
    That is one of the things that pushed me away from Matlab. I kept on running into memory bounds whenever I tried to do things "the Matlab way" (i.e., no loops, vectorize, etc.). It seems that Matlab liked to copy my arrays all the time when I was going in and out of functions. It seems ridiculous to me that I would have to do things "the bad way" in order to get my work done.
  • For a program like octave, having no GUI is very forgiveable. There is really no way to work with the system outside of prompt commands. Even Matlab is very prompt based.

    What is unforgivable in Octave's case is its graphing capabilities. Octave used Gnuplot for drawing which basically means it is stuck in the 1990s when it comes to making plots. 3D plots are slow, difficult and complicated things to create. Animations are out of the question. 99% of the time, you're better off exporting to png (itself a nighmare), and animating from those. 3D data is all but ungraphable on Linux systems anyway, so I suppose Octave is not alone here.

  • by Supergibbs (786716) on Sunday May 02 2010, @10:22PM (#32068544) Homepage
    Sweet spot? Could it have been that a majority of computers were 32-bit? Ya sure, 64 bit computing has been around a while but it was mostly specialized servers. Now that most new computers are x64 [wikipedia.org] compatible it would make sense to optimize for 64-bit. The many integers between 32 and 64 bits would be processed much faster and couldn't the bigint routines take advantage as well? I am not sure how big int work other than they use strings for storage. I assume they use clever math to break the calculations up and then piece it back together, so could 64bit reduce the number of calculations?
  • by KibibyteBrain (1455987) on Sunday May 02 2010, @10:27PM (#32068558)
    Umm, you realize you can do math on greater than 32 bits values in Matlab, just not using the 64-bit platforms's ability to natively handle 64 bit datatypes. After all, I can do make on 64-bit values on an 8-bit micro-controller just fine, it will just take more than a few instructions.
    And as stated before, this matters little as it is a performance issue, and matlab still offers the best performance of its class, even vs. those who do have this feature.
  • by symbolset (646467) on Sunday May 02 2010, @10:31PM (#32068582) Homepage Journal

    It's best to design software for limits that are frankly absurd. Since I coined the phrase "absurd limit theory", let's delve a little bit into it.

    A second divided into increments enumerated by fractions of a 64 bit integer is less than the differential travel of differing wavelengths of light over a planck unit of distance. It's a smaller unit of time than matters to our current understanding. 2^64 seconds is more time than the entire history of our Universe from beginning to end even in the most ridiculous theory. Even counting photons and every known subatomic particle, an index of 2^64 is sufficient to enumerate each and every one with a unique ID that represents that one and no other. In each dimension angles discriminated in units of 1/2^64 of a circle are fine enough for any imaginable purpose.

    Given that we are close to understanding these elements, 128 bits would probably be a more durable unit. 128 bits should give us a few more years of discrimination before the physical sciences discover even finer units of time, mass and distance. Some even theorize now that 64 bits are the limit: that space, mass and time have a granularity and that finer resolutions are absurd. To that I say...

    If software must be designed with limits it should use limits so absurd that no user no matter how hypothetical could be constrained by those limits because the designer does not know how long his application will persist nor how its use will evolve.

    It's not the most efficient design that wins. Ultimately it's the most persistent.

  • by WeatherGod (1726770) on Sunday May 02 2010, @10:34PM (#32068598)
    Both Matlab and SciPy/NumPy use the same BLAS/ATLAS backend. So, a well-written Matlab program will be comparable to a well-written Python program in speed. However, Python has Matlab beat on memory usage. Matlab does have an extensively documented language with a very good help system.

    In my personal opinion, I feel that Matlab was too awkward of a language when it came to do anything else besides math. For example, it made it difficult to use when one needed to do string manipulations to figure out what files to load. Meanwhile, Python is a full-fledged language that would allow me to do many supporting tasks for my math related work.

  • by Anonymous Coward on Sunday May 02 2010, @10:34PM (#32068602)

    For some reason commercial software usually seems to lag worst on the 64 bit transition. Windows and OSX lagged Linux, Java and Flash were the last bits on my Linux systems to go 64 bit, etc. They act as if 64 bit is a fad, and people will soon come to their senses and revert to 32.

    *Solaris and DEC users shake their heads*

  • by Aphonia (1315785) on Sunday May 02 2010, @10:45PM (#32068676)

    Just because they use the same BLAS/ATLAS backend doesn't mean that they'll perform to the same speed - BLAS calls dont have to be done at the same efficiency, or certain common operations which are a chain of calls be implemented in the same manner. A lot of good functions are prewritten for Matlab. It is like saying if I put a Ferrari engine in a Chevy Suburban, it will perform as well as if i put it in a Ferrari.

  • Re:So... (Score:3, Insightful)

    by creimer (824291) on Sunday May 02 2010, @11:00PM (#32068788) Homepage
    I will give you a numerically precise answer... DANGER, WILL ROBINSON, DANGER!
  • by Drencrom (689725) <<moc.liamg> <ta> <onilrem.egroj>> on Sunday May 02 2010, @11:05PM (#32068808) Journal
    Yes, they do. From the article you mention

    "If you really need your results to add up exactly, especially when you work with money: use a special decimal datatype"

    Is is true that the GP mentions small numbers and fp is in fact more precise with small numbers, but when the numbers get larger the difference between two representable fp numbers gets bigger also.
  • by martin-boundary (547041) on Sunday May 02 2010, @11:11PM (#32068856)
    Units matter if you want to ensure accuracy (in floating point). You don't want to indiscriminately combine extremely small numbers with extremely large numbers in a formula, if you can help it.
  • by hazem (472289) on Sunday May 02 2010, @11:30PM (#32068956) Journal

    Hmm, a double has 64 bits, where do the last 12 go?

    A 64 bit integer will lose precision when converted to a 64 bit double because the double has to use some of the bits for the exponent and the rest go the mantissa. If 12 bits go to the exponent, then your 64 bit integer now has to be expressed as a 52 bit integer, raised to some power. There are (I think) 2^11 distinct numbers that would have the same representation as a double.

  • Re:Yes but Octave (Score:3, Insightful)

    by wsloand (176072) on Sunday May 02 2010, @11:34PM (#32068974)

    You should check out some of the newer versions of Octave. The graphics in versions 3.0 and 3.2 are very much improved. (Disclosure: I was an active Octave developer a couple of years ago.)

  • Re:Yes but Octave (Score:3, Insightful)

    by TerranFury (726743) on Monday May 03 2010, @12:34AM (#32069228)
    I don't know what you mean; you can do a lot with handle graphics in MATLAB...
  • by sadtrev (61519) on Monday May 03 2010, @03:40AM (#32070004) Homepage

    using 64-bit integers instead of floats is a common trick in embedded C for control and signal processing on low power processors. I have experience of four different embedded systems used in commercial products from three different companies I've worked with - three of the four used 64-bit integers for roundoff-sensitive calculations.
    I was a bit surprised that Matlab can't handle this, but then I've seen the poor quality of the ostensibly production-ready code that comes out of their M2C converter - it was about ten times the code footprint and a fifth the speed of a minimally-optimised C version of the same algorithm.

    Honestly, I don't know how anyone can justify paying for this, when R (and even Octave in this instance) is more capable. Where the target platform requires C or asm code, then doing development in Matlab is usually more trouble than it saves. The graphs are prettier, though.

  • by Rockoon (1252108) on Monday May 03 2010, @06:38AM (#32070526)
    1998 called. It wants to know why you havent learned anything since then.
  • by Skapare (16644) on Monday May 03 2010, @06:44AM (#32070546) Homepage

    CPU operations are limited to a certain number of bits for their operations. Programming languages like C/C++ perform their basic arithmetic operations at the machine level, so they inherit the same limitations. These bounds are not a limit either through library/template facilities at the C/C++ level, or with basic operations in high level (particular object oriented) languages such as Pike and Python.

    I can tell you libgmp is not stuck with bcd. But the bcd aspect will exist because some kinds of uses for extended precision are financial/money based, and conversion to and from an external decimal format is sufficiently frequent that it's easier/faster to just do the arithmetic directly on decimal, even if tightly squeezed into 4 bits per digit. This has been going on since early computers. FYI, the ancient IBM model 1620 [wikipedia.org] computer could do this in hardware. As you can see from the code in the links I posted earlier, a choice of language can hide the fact that the underlying architecture has fixed width arithmetic.

    BTW, for fun, compare the speeds of those two programs, which are implementations of the same algorithm.

  • by gmarsh (839707) on Monday May 03 2010, @07:42AM (#32070802)

    Oddly enough, he's right. Integer operations *are* way faster on most CPUs. Maybe not on a modern x86 CPU working in SSE space, but they're not "most CPU's".

    If you're writing code for a fixed-point DSP chip (used in most home receivers) the majority of RISC processors (ARM, MIPS, most Power) or any microcontroller, working in integer space will be much faster since floating point has to be emulated or issued to a separate floating point unit which requires extra overhead to move data to/from it.

    And the same engineers who target code to those systems also tend to use Matlab. Many systems (control systems, audio/video codecs, whatnot) are simulated in Matlab before they're even written for their target processor, where you can do things like verify the algorithm up front, then specify an arbitrary number of bits at different stages to find out how much error it introduces so you can pick your data types in your target.

    Matlab with 32-bit integers (or 64 bit floats + rounding, for 53 bits) is good enough for simulating most 16 bit DSPs (40 bit accumulator, usually) but not quite enough for a 24 bit DSP (56 bit accumulator, usually). Having pure 64 bit integer support means you're good for 24 bitters.

    Now, knowing Matlab, I wouldn't be surprised if they emulate integers somehow using floating point ;)

  • by Anonymous Coward on Monday May 03 2010, @11:54AM (#32073286)
    I know libgmp doesn't use bcd, why on earth do you think I've linked that?

    but at thesame time why don't we have a math lib that supports it all? rounding support for financial institutes, fast math until it overflow the 32 bits, double where precision is not defined and arbitrary precision when you tell it to.

Your happiness is intertwined with your outlook on life.

Working...