Main Page   Data Structures   File List   Data Fields   Globals  

addition_scs.c File Reference

Functions for SCS addition and subtraction. More...

Go to the source code of this file.

Functions

void scs_set (scs_ptr result, scs_ptr x)
void scs_renorm (scs_ptr result)
void scs_renorm_no_cancel_check (scs_ptr result)
void scs_add_no_renorm (scs_ptr result, scs_ptr x, scs_ptr y)
void scs_add (scs_ptr result, scs_ptr x, scs_ptr y)
void scs_sub (scs_ptr result, scs_ptr x, scs_ptr y)


Detailed Description

Functions for SCS addition and subtraction.

Author:
Defour David David.Defour@ens-lyon.fr , Florent de Dinechin Florent.de.Dinechin@ens-lyon.fr
This file is part of the SCS library.

Many functions come in two versions, selected by a #if.

The reason is that we designed scslib library for internal use with SCS_NB_WORDS==8, so we provide a version with manual optimizations for this case.

These optimisations include loop unrolling, and sometimes replacing temporary arrays of size 8 with 8 variables, which is more efficient on all modern processors with many (renaming) registers.

Using gcc3.2 with the most aggressive optimization options for this purpose (-funroll-loops -foptimize-register-move -frerun-loop-opt -frerun-cse-after-loop) is still much slower. At some point in the future, gcc should catch up with unrolling since our loops are so simple, however the replacement of small arrays with variables is not something we are aware of in the literature about compiler optimization.

Definition in file addition_scs.c.


Function Documentation

void scs_set scs_ptr    result,
scs_ptr    x
[inline]
 

Copy a SCS number into another.

There is an unrolled version for the case SCS_NB_WORDS==8.

Definition at line 55 of file addition_scs.c.

Referenced by scs_add(), scs_inv(), and scs_sub().

void scs_renorm scs_ptr    result [inline]
 

Renormalisation (to be used after several scs_add_no_renorm).

This function removes the carry from each digit, and also shifts the digits in case of a cancellation (so that if result != 0 then its first digit is non-zero)

Warning:
THIS FUNCTION HAS NEVER BEEN PROPERLY TESTED and is currently unused in the library: instead, specific renormalisation steps are fused within the code of the operations which require it.

Definition at line 84 of file addition_scs.c.

void scs_renorm_no_cancel_check scs_ptr    result [inline]
 

Renormalisation assuming no cancellation.

This renormalization step is especially designed for the addition of several numbers with the same sign. In this case, you know that there has been no cancellation, which allows simpler renormalisation.

Definition at line 137 of file addition_scs.c.

void scs_add_no_renorm scs_ptr    result,
scs_ptr    x,
scs_ptr    y
[inline]
 

Addition without renormalisation, to be used for adding many numbers.

Warning:
In case of a cancellation, severe loss of precision could happen. Safe if the numbers are of the same sign.

Definition at line 224 of file addition_scs.c.

void scs_add scs_ptr    result,
scs_ptr    x,
scs_ptr    y
[inline]
 

Addition of two SCS numbers.

The arguments x, y and result may point to the same memory location. The result is a normalised SCS number.

Definition at line 514 of file addition_scs.c.

References scs::exception, and scs_set().

void scs_sub scs_ptr    result,
scs_ptr    x,
scs_ptr    y
[inline]
 

Subtraction of two SCS numbers.

The arguments x, y and result may point to the same memory location.

Definition at line 539 of file addition_scs.c.

References scs::exception, and scs_set().

Referenced by scs_inv().


Generated on Tue Jun 17 10:15:52 2003 for SCSLib by doxygen1.2.15