LOGIN
|
REGISTER NOW
|
SUBSCRIBE
AS OF 5/21/2013 5:03AM EST
HOME
ALL STORIES
LATEST NEWS
COLUMNS
OPINIONS
GUEST VIEWS
SHORT TAKES
LINKAPALOOZA
NEWSWIRE
SPECIAL REPORTS
ZEICHICK'S TAKE
SD TIMES 100
BE A NEWSHOUND
IPHONE APP
IPAD APP
RSS FEEDS
FACEBOOK
TWITTER
WHITE PAPERS
SPONSORED PROFILES
JOB BOARD
WEBINAR CENTER
FREE SOFTWARE
ANDROID NEWSLETTER
BIG DATA TECHREPORT
ALM
SHAREPOINT
EVENTS CALENDAR
PRINT/PDF EDITION
PRINT/PDF BACK ISSUES
SUBSCRIBE TODAY
CUSTOMER SERVICE
EDITORIAL BEATS
GUEST VIEW GUIDE
SD TIMES 100 GUIDE
EVENTS CALENDAR
ADVERTISING
ARTICLE REPRINTS
REPORT A BUG
SITE MAP
ABOUT US
BZ MEDIA NEWS
NEWS ON MONDAY
SPTECHREPORT
SPTECHWEB
SPTECHCON
IPHONE/IPAD DEVCON
ANDROID DEVCON
PRIVACY POLICY
CONTACT US
HOME
>>
ZEICHICK'S TAKE
Zeichick’s Take: Don’t roll your own math
By
Alan Zeichick
Tweet
July 23, 2012 —
When it comes to advanced numerical functions, my advice is clear: Look at libraries. Don’t roll your own algorithms.
Generally speaking, I’m a fan of modular code reuse, especially for complex functions like UI controls, database access drivers, PDF generation or managing images. Most of the time, it’s a good idea to find open-source components that will get your job done, or to license commercial reusable components. Sometimes, though, it makes more sense to write your own functionality.
Numerical libraries are the exception. Unless you are in the math business, resist the temptation to write your own Fast Fourier Transform (FFT) functions, random number generators, Basic Linear Algebra Subprograms (BLAS), wavelets, eigenvalues, partial differential equations—you get the picture.
This came up thanks to an e-mail from an SD Times subscriber:
I'm an IT consultant in the software arena and would like to ask you a question on buying mathematical algorithms vs. programming them yourself. Especially for complicated mathematical subroutines, is it cost-effective to subscribe to an algorithm library, or to let your programmers do all the work?
Advanced numerical algorithms are very complex to get right. Simply writing the basic code is complicated—and so is the testing of that code, to make sure that each routine delivers consistently correct results in all cases, including across different processors, hardware architectures, programming languages, compilers, runtimes, standard libraries, and so on.
Incredible amounts of work have gone into designing, coding and testing most high-end numerical libraries, and the code has been reviewed by many individuals, including mathematicians. Generally speaking, you can be assured that the math is correct.
Beyond consistent correctness, there’s also efficiency. You’re not running that FFT or BLAS routine once; it’s being executed hundreds, thousands, millions of times, perhaps, during the execution of your program. Efficiency matters, including both raw speed and also the use of resources like memory and threads.
An advantage of most numerical libraries is the tuning that goes into the code—a lot of hand-crafted C or Assembly code, in some cases. In other words, it’s fast. Increasingly, those libraries are also tuned for multicore processing. You could never justify spending the resources to do this yourself.
I have had experience with many numerical libraries, ranging from Intel’s
Math Kernel Library
to AMD’s
Core Math Library
to the IMSL
Numerical Libraries
to the NAG
Numerical Components
. They are all good, all recommended.
The tradeoff is that many numerical libraries are costly. If you need math, though, licensing one of the libraries is a bargain, and you can do the ROI calculations on a pocket calculator.
Alan Zeichick is editorial director of SD Times. Read his blog at
ztrek.blogspot.com
.
Related Search Term(s):
algebra
,
algorithms
,
random number generators
Share this link:
http://sdt.bz/36818
Technorati
Digg
Reddit
Slashdot
Facebook
Friendfeed
Twitter
del.icio.us
Related Articles
The Numerical Algorithms Group releases the NAG Library for Java
Over 1,700 mathematical and statistical routines for Java
JetBrains Sets TeamCity Free For Unlimited Number of Users
Continuous Integration and Build Management server introduces personal builds on branches for Git & Mercurial
CAST puts a number on the cost of fixing code quality
Study examines four areas of code that can affect the "technical debt" of an operational application
NEXT ARTICLE
The Numerical Algorithms Group releases the NAG Library for Java
Over 1,700 mathematical and statistical routines for Java
Read More...
 
LOADING...
News on Monday
more>>
Android Developer News
more>>
SharePoint Tech Report
more>>
Big Data TechReport
more>>
Download Current Issue
MAY 2013 PDF ISSUE
Need Back Issues?
DOWNLOAD HERE
Want to subscribe?
CTIA 2013
5/21/2013 to 5/23/2013
Las Vegas
CTIA
AnDevCon Boston
5/28/2013 to 5/31/2013
Boston
BZ Media LLC
Fluent Conf.
5/28/2013 to 5/30/2013
San Francisco
O'Reilly Media
Better Software Conf.
6/2/2013 to 6/7/2013
Las Vegas
SQE
IBM Innovate
6/2/2013 to 6/6/2013
Orlando
IBM Rational
More