Code Directory
 Visual Basic & VB.NET
New Code
GetOrgChart 2.5.3
AnyGantt JS Gantt Charts 8.6.0
AnyChart JS Charts and Dashboards 8.6.0
Multi Vendor Ecommerce Script & Apps 4.0
Magento 2 Inventory Management Extension 1.0
Yipit Clone Script - Daily Deals Software 1.0.2
Devart Excel Add-in for Oracle 1.7
Devart Excel Add-in for Freshdesk 1.7
Devart Excel Add-in for G Suite 1.7
C# QR Code Generator
Salesforce WordPress Customer Portal 3.2.0
Single Leg MLM 1.2.1
OzGIS 14.6
Quick Maps For Dynamics CRM 3.1
Job Board Software 4.2
Top Code
USANet Classified Ads pro 4.50
Remote Desktop Control
YellowMaker 3.II
Atlant Classifieds (Standard) 8.IX
Chilli Classifieds updated 3.I
AnyChart JS Charts and Dashboards 8.6.0
Top Rated
VisualNEO Web 2018.12.15
Paste phpSoftPro 1.4.1
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
XSum 1.0
File ID: 85118

XSum 1.0
Download XSum 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 10.0 KB
Downloads: 4
Submit Rating:
XSum 1.0 Description
Description: XSum - SUM with error compensation

The accuracy of the sum of floating point numbers is limited by the truncation error. E.g. SUM([1e16, 1, -1e16]) replies 0 instead of 1 and the error of SUM(RANDN(N, 1)) is about EPS*(N / 10).
Kahan, Knuth, Dekker, Ogita and Rump (and others) have derived some methods to reduce the influence of rounding errors, which are implemented here as fast C-Mex: XSum(RANDN(N, 1), 'Knuth') is exact to all 15 digits.

Y = XSum(X, N, Method)
X: Double array of any size.
N: Dimension to operate on.
Method: String: 'Double', 'Long', 'Kahan', 'Knuth', 'KnuthLong', 'Knuth2'.

Y: Double array, equivalent to SUM, but with compensated error depending
on the Method. The high-precision result is rounded to double precision.

METHODS: (speed and accuracy compared to SUM)
- Double: A thread-safe implementation of Matlab's SUM. At least in Matlab 2008a to 2009b the results of the multi-threaded SUM can differ slightly from call to call. 50% faster than single-threaded SUM (MSVC++ 2008), equivalent accuracy.
- Long: Accumulated in a 80 bit long double, if the compiler support this (e.g. LCC v3.8). 3.5 more valid digits, 40% slower.
- Kahan: The local error is subtracted from the next element. 1 to 3 more valid digits, 10% slower.
- Knuth: As if the sum is accumulated in a 128 bit float: about 15 more valid digits. About the same speed (MSVC++2008 compiler). This is suitable for the most real world problems.
- Knuth2: 30 more valid digits as if it is accumulated in a 196 bit float. 60% slower.
- KnuthLong: As Knuth, but using long doubles to get about 21 more valid digits, if supported by the compiler. 2.5 times slower.

License: Shareware

Related: 2009b, 2008a, matlab, results, Multithreaded, faster, slightly, differ, matlabs

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 4

User Review for XSum
- required fields

Please enter text on the image