Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / linearalgebra / sparsematrix.h
index a8479b99b36bb36c923100afc5ecd8fbf978817f..04731f0181fce3403d000db382478eeba3dc069c 100644 (file)
@@ -1,50 +1,53 @@
 /*
- * 
- *                This source code is part of
- * 
- *                 G   R   O   M   A   C   S
- * 
- *          GROningen MAchine for Chemical Simulations
- * 
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * This file is part of the GROMACS molecular simulation package.
+ *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
- * 
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- * 
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
  * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- * 
- * For more info, check our website at http://www.gromacs.org
- * 
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
+ * the research papers on the package. Check out http://www.gromacs.org.
  */
 #ifndef GMX_LINEARALGEBRA_SPARSEMATRIX_H
 #define GMX_LINEARALGEBRA_SPARSEMATRIX_H
 
 #include <stdio.h>
 
-#include "../legacyheaders/types/simple.h"
+#include "gromacs/utility/basedefinitions.h"
+#include "gromacs/utility/real.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 typedef struct
-gmx_sparsematrix_entry
+    gmx_sparsematrix_entry
 {
     int      col;
     real     value;
@@ -70,7 +73,7 @@ gmx_sparsematrix_entry
  *
  *  index[nrow] should be equal to the total number of elements stored.
  *
- *  Thus, to find the value of matrix element [5,4] you should loop 
+ *  Thus, to find the value of matrix element [5,4] you should loop
  *  over positions index[5] to index[6]-1 in column until you either find
  *  the value 4, or a higher value (meaning the element was zero).
  *
@@ -79,14 +82,14 @@ gmx_sparsematrix_entry
  *
  *  IMPORTANT:
  *  If compressed_symmetric is set to TRUE, you should only store EITHER the upper OR
- *  lower triangle (and the diagonal), and the other half is assumed to be 
- *  symmetric. Otherwise, if compressed_symmetric==FALSE, no symmetry is implied and all 
+ *  lower triangle (and the diagonal), and the other half is assumed to be
+ *  symmetric. Otherwise, if compressed_symmetric==FALSE, no symmetry is implied and all
  *  elements should be stored.
- *  
+ *
  *  The symmetry compression saves us a factor 2 both in storage and
  *  matrix multiplication CPU-time, which can be very useful for huge eigenproblems.
  *
- *  If you are unsure, just set compressed_symmetric to FALSE and list all elements. If 
+ *  If you are unsure, just set compressed_symmetric to FALSE and list all elements. If
  *  you enable it but still list all elements (both upper and lower triangle) you will be sorry...
  *
  *  Internally, the sparse data is stored as a separate list for each row, where the list
@@ -96,26 +99,26 @@ gmx_sparsematrix_entry
  *  The matrix data could be stored in a single contiguous array with indices for each row,
  *  but then we could only insert elements at the end without copying the entire matrix.
  *
- *  After you have 
+ *  After you have
  *
  *  In other words: Not perfect, but it works.
- */ 
-typedef struct 
-gmx_sparsematrix 
+ */
+typedef struct
+    gmx_sparsematrix
 {
     gmx_bool                     compressed_symmetric; /**< Store half elements and assume symmetry. */
     int                          nrow;                 /**< Number of rows in matrix                 */
     int *                        ndata;                /**< Number of entries on each row (list)     */
     int *                        nalloc;               /**< Allocated entry list length for each row */
     gmx_sparsematrix_entry_t **  data;                 /**< data[i] is a list with entries on row i  */
-} 
+}
 gmx_sparsematrix_t;
 
 
 /*! \brief Allocate a new sparse matrix structure
  *
  *  The number of rows is used to allocate the index array entry. Obviously you
- *  can reallocate these later yourself if necessary - this is a 
+ *  can reallocate these later yourself if necessary - this is a
  *  convenience routine.
  *
  *  By default, the compressed_symmetric flag in the structure will
@@ -128,7 +131,7 @@ gmx_sparsematrix_init            (int                    nrow);
 
 /*! \brief Release all resources used by a sparse matrix structure
  *
- *  All arrays in the structure will be freed, and the structure itself.  
+ *  All arrays in the structure will be freed, and the structure itself.
  */
 void
 gmx_sparsematrix_destroy         (gmx_sparsematrix_t *   A);
@@ -145,25 +148,25 @@ gmx_sparsematrix_print           (FILE *                 stream,
 
 /* Adds value at row,col. If the value did not exist
  * previously it is added, otherwise it is incremented with difference.
- * 
+ *
  * The column sort order might change, so you need to run fix_sparsematrix
  * once you are done changing the matrix.
  */
 real
 gmx_sparsematrix_value          (gmx_sparsematrix_t *    A,
-                                 int                     row, 
+                                 int                     row,
                                  int                     col);
 
 
 /* Adds value at row,col. If the value did not exist
-* previously it is added, otherwise it is incremented with difference.
-* 
-* The column sort order might change, so you need to run fix_sparsematrix
-* once you are done changing the matrix.
-*/
+ * previously it is added, otherwise it is incremented with difference.
+ *
+ * The column sort order might change, so you need to run fix_sparsematrix
+ * once you are done changing the matrix.
+ */
 void
 gmx_sparsematrix_increment_value(gmx_sparsematrix_t *    A,
-                                 int                     row, 
+                                 int                     row,
                                  int                     col,
                                  real                    difference);
 
@@ -171,7 +174,7 @@ gmx_sparsematrix_increment_value(gmx_sparsematrix_t *    A,
 
 /*! \brief Sort elements in each column and remove zeros.
  *
- *  Sparse matrix access is faster when the elements are stored in 
+ *  Sparse matrix access is faster when the elements are stored in
  *  increasing column order in each row. In some cases previously non-zero
  *  elements will be zero after adding more data, and this routine also removes
  *  those entries to reduce the storage requirements.
@@ -183,9 +186,9 @@ gmx_sparsematrix_compress       (gmx_sparsematrix_t *    A);
 
 
 
-/*! \brief Sparse matrix vector multiplication 
- * 
- * Calculate y = A * x for a sparse matrix A. 
+/*! \brief Sparse matrix vector multiplication
+ *
+ * Calculate y = A * x for a sparse matrix A.
  */
 void
 gmx_sparsematrix_vector_multiply(gmx_sparsematrix_t *    A,
@@ -198,5 +201,3 @@ gmx_sparsematrix_vector_multiply(gmx_sparsematrix_t *    A,
 
 
 #endif
-
-