Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > ff8e7344076b5fbaa54d805766a057bd > files > 6

libscs-devel-1.4.1-4.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>addition_scs.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<hr><h1>addition_scs.c File Reference</h1>Functions for SCS addition and subtraction. 
<a href="#_details">More...</a>
<p>

<p>
<a href="addition__scs_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a0">scs_set</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result, <a class="el" href="scs_8h.html#a2">scs_ptr</a> x)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a1">scs_renorm</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a2">scs_renorm_no_cancel_check</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a4">scs_add_no_renorm</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result, <a class="el" href="scs_8h.html#a2">scs_ptr</a> x, <a class="el" href="scs_8h.html#a2">scs_ptr</a> y)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a8">scs_add</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result, <a class="el" href="scs_8h.html#a2">scs_ptr</a> x, <a class="el" href="scs_8h.html#a2">scs_ptr</a> y)</td></tr>
<tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="addition__scs_8c.html#a9">scs_sub</a> (<a class="el" href="scs_8h.html#a2">scs_ptr</a> result, <a class="el" href="scs_8h.html#a2">scs_ptr</a> x, <a class="el" href="scs_8h.html#a2">scs_ptr</a> y)</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions for SCS addition and subtraction.
<p>
<dl compact><dt><b>
Author: </b><dd>
Defour David <a href="mailto:David.Defour@ens-lyon.fr">David.Defour@ens-lyon.fr</a> , Florent de Dinechin <a href="mailto:Florent.de.Dinechin@ens-lyon.fr">Florent.de.Dinechin@ens-lyon.fr</a></dl>This file is part of the SCS library.
<p>
Many functions come in two versions, selected by a #if.
<p>
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.
<p>
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.
<p>
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.
<p>

<p>
Definition in file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.<hr><h2>Function Documentation</h2>
<a name="a0" doxytag="addition_scs.c::scs_set"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_set </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>result</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>x</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Copy a SCS number into another.
<p>
There is an unrolled version for the case SCS_NB_WORDS==8. 
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00055">55</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.
<p>
Referenced by <a class="el" href="addition__scs_8c-source.html#l00514">scs_add</a>(), <a class="el" href="division__scs_8c-source.html#l00038">scs_inv</a>(), and <a class="el" href="addition__scs_8c-source.html#l00539">scs_sub</a>().    </td>
  </tr>
</table>
<a name="a1" doxytag="addition_scs.c::scs_renorm"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_renorm </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>result</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Renormalisation (to be used after several scs_add_no_renorm).
<p>
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)
<p>
<dl compact><dt><b>
Warning: </b><dd>
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. </dl>
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00084">84</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.    </td>
  </tr>
</table>
<a name="a2" doxytag="addition_scs.c::scs_renorm_no_cancel_check"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_renorm_no_cancel_check </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>result</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Renormalisation assuming no cancellation.
<p>
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. 
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00137">137</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.    </td>
  </tr>
</table>
<a name="a4" doxytag="addition_scs.c::scs_add_no_renorm"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_add_no_renorm </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>result</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>x</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>y</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Addition without renormalisation, to be used for adding many numbers.
<p>
<dl compact><dt><b>
Warning: </b><dd>
In case of a cancellation, severe loss of precision could happen. Safe if the numbers are of the same sign. </dl>
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00224">224</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.    </td>
  </tr>
</table>
<a name="a8" doxytag="addition_scs.c::scs_add"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_add </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>result</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>x</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>y</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Addition of two SCS numbers.
<p>
The arguments x, y and result may point to the same memory location. The result is a normalised SCS number. 
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00514">514</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.
<p>
References <a class="el" href="scs_8h-source.html#l00102">scs::exception</a>, and <a class="el" href="addition__scs_8c-source.html#l00055">scs_set</a>().    </td>
  </tr>
</table>
<a name="a9" doxytag="addition_scs.c::scs_sub"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void scs_sub </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>result</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>x</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="scs_8h.html#a2">scs_ptr</a>&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>y</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Subtraction of two SCS numbers.
<p>
The arguments x, y and result may point to the same memory location. 
<p>
Definition at line <a class="el" href="addition__scs_8c-source.html#l00539">539</a> of file <a class="el" href="addition__scs_8c-source.html">addition_scs.c</a>.
<p>
References <a class="el" href="scs_8h-source.html#l00102">scs::exception</a>, and <a class="el" href="addition__scs_8c-source.html#l00055">scs_set</a>().
<p>
Referenced by <a class="el" href="division__scs_8c-source.html#l00038">scs_inv</a>().    </td>
  </tr>
</table>
<hr><address align="right"><small>Generated on Tue Jun 17 10:15:52 2003 for SCSLib by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>