<!-------- @HEADER ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring ! Copyright 2012 Sandia Corporation ! ! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, ! the U.S. Government retains certain rights in this software. ! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions are ! met: ! ! 1. Redistributions of source code must retain the above copyright ! notice, this list of conditions and the following disclaimer. ! ! 2. Redistributions in binary form must reproduce the above copyright ! notice, this list of conditions and the following disclaimer in the ! documentation and/or other materials provided with the distribution. ! ! 3. Neither the name of the Corporation nor the names of the ! contributors may be used to endorse or promote products derived from ! this software without specific prior written permission. ! ! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY ! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE ! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! ! Questions? Contact Karen Devine kddevin@sandia.gov ! Erik Boman egboman@sandia.gov ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! @HEADER -------> <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.6 sun4m) [Netscape]"> <meta name="sandia.approved" content="SAND99-1376"> <meta name="author" content="karen devine, kddevin@sandia.gov"> <title> Zoltan Developer's Guide: Hash function</title> </head> <body bgcolor="#FFFFFF"> <div align=right><b><i><a href="dev.html">Zoltan Developer's Guide</a> | <a href="dev_services_time.html">Next</a> | <a href="dev_services_objlist.html">Previous</a></i></b></div> <!-------------------------------------------------------------------------> <h2> Hash Function</h2> Zoltan provides a hash function for global and local IDs. The hash function computes a non-negative integer value in a certain range<i> </i>from an ID. <blockquote><b><a href="#Zoltan_Hash">Zoltan_Hash</a></b> : hash a global or local ID into non-negative integers</blockquote> <!-------------------------------------------------------------------------> <hr> <a NAME="Zoltan_Hash"></a> <hr> unsigned int<b> Zoltan_Hash</b>( <b><a href="../ug_html/ug_usage.html#Data Types for Object IDs">ZOLTAN_ID_PTR </a></b><i>key</i>, int <i>num_id_entries</i>, unsigned int <i>n</i>); <hr> <b>Zoltan_Hash </b>computes a hash value for a global or local ID. Note that this hash function has been optimized for 32-bit integer systems, but should work on any machine. The current implementation uses a simple multiplicative hash function based on Don Knuth's golden ratio method; see <i>The Art of Computer Programming,</i> vol. 3. <br> <table WIDTH="100%" > <tr VALIGN=TOP> <td VALIGN=TOP WIDTH="20%"><b>Arguments:</b></td> <td WIDTH="80%"></td> </tr> <tr VALIGN=TOP> <td VALIGN=TOP> <i>key</i></td> <td>A pointer to the ID to be hashed.</td> </tr> <tr VALIGN=TOP> <td> <i>num_id_entries</i></td> <td>The length of the ID (as given by <b><a href="../ug_html/ug_param.html#NUM_GID_ENTRIES">NUM_GID_ENTRIES</a></b> or <b><a href="../ug_html/ug_param.html#NUM_LID_ENTRIES">NUM_LID_ENTRIES</a></b>).</td> </tr> <tr VALIGN=TOP> <td VALIGN=TOP> <i>n</i></td> <td>The computed hash value will be between 0 and <i>n</i>-1. </td> </tr> <tr VALIGN=TOP> <td><b>Return Value:</b></td> <td></td> </tr> <tr VALIGN=TOP> <td> unsigned int</td> <td>The hash value (between 0<i> </i>and <i>n</i>-1). </td> </tr> </table> <p> <!-------------------------------------------------------------------------> <hr WIDTH="100%"> <br>[<a href="dev.html">Table of Contents</a> | <a href="dev_services_time.html">Next: Timing Routines</a> | <a href="dev_services_objlist.html">Previous: Object List Function</a> | <a href="https://www.sandia.gov/general/privacy-security/index.html">Privacy and Security</a>] </body> </html>