BCLS: Bound Constrained Least Squares

Version 0.1

bclib.h

Go to the documentation of this file.
00001 /* bclib.h
00002    $Revision: 282 $ $Date: 2006-12-17 17:38:00 -0800 (Sun, 17 Dec 2006) $
00003 
00004    ----------------------------------------------------------------------
00005    This file is part of BCLS (Bound-Constrained Least Squares).
00006 
00007    Copyright (C) 2006 Michael P. Friedlander, Department of Computer
00008    Science, University of British Columbia, Canada. All rights
00009    reserved. E-mail: <mpf@cs.ubc.ca>.
00010    
00011    BCLS is free software; you can redistribute it and/or modify it
00012    under the terms of the GNU Lesser General Public License as
00013    published by the Free Software Foundation; either version 2.1 of the
00014    License, or (at your option) any later version.
00015    
00016    BCLS is distributed in the hope that it will be useful, but WITHOUT
00017    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00018    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
00019    Public License for more details.
00020    
00021    You should have received a copy of the GNU Lesser General Public
00022    License along with BCLS; if not, write to the Free Software
00023    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
00024    USA
00025    ----------------------------------------------------------------------
00026 */
00027 
00028 #ifndef _BCLSLIB_H
00029 #define _BCLSLIB_H
00030 
00031 #include "bcls.h"
00032 
00033 #define PRINT1(...)  bcls_print( ls, 1, __VA_ARGS__ )
00034 #define PRINT2(...)  bcls_print( ls, 2, __VA_ARGS__ )
00035 #define PRINT3(...)  bcls_print( ls, 3, __VA_ARGS__ )
00036 #define PRINT4(...)  bcls_print( ls, 4, __VA_ARGS__ )
00037 #define PRINT5(...)  bcls_print( ls, 5, __VA_ARGS__ )
00038 #define PRINT6(...)  bcls_print( ls, 6, __VA_ARGS__ )
00039 
00040 // Inline min and max functions.
00041 static inline int imax(int a, int b) {
00042     return a > b ? a : b;
00043 }
00044 
00045 static inline int imin(int a, int b) {
00046     return a > b ? b : a;
00047 }
00048 
00049 // Inline int swap function.
00050 #define bcls_iswap(a,b) {       \
00051         int c = (a);    \
00052         (a) = (b);      \
00053         (b) =  c;       \
00054     }
00055 
00056 // Inline double swap function.
00057 #define bcls_dswap(a,b) {    \
00058         double c = (a); \
00059         (a) = (b);      \
00060         (b) =  c;       \
00061     }
00062 
00063 // Print output.
00064 void bcls_print( BCLS *ls, int current_print_level, char *fmt, ... );
00065 
00066 // Print fault and exit the program.
00067 void bcls_fault( BCLS *ls, char *fmt, ... );
00068 
00069 // Compute a projected step.
00070 void bcls_project_step( int n, double s[], double step, double x[],
00071                         double dx[], double bl[], double bu[] );
00072 
00073 // Examine and print something about the problem's bounds.
00074 int bcls_examine_bnds( BCLS *ls, int n, double bl[], double bu[] );
00075 
00076 // Examine and print something about the column scales.
00077 void bcls_examine_column_scales( BCLS *ls, double anorm[] );
00078 
00079 // Print the BCLS parameters.
00080 void bcls_print_params( BCLS *ls );
00081 
00082 // Compute the primal infeasibility at the point x.
00083 int bcls_primal_inf( int n, double x[], double bl[], double bu[],
00084                      double *pInf, int *jpInf );
00085 
00086 // Compute the dual infeasibility at the point x.
00087 void bcls_dual_inf( int n, double x[], double z[], double bl[], double bu[],
00088                     double *dInf, int *jInf );
00089 
00090 // Project  x  into the box defined by bl and bu.
00091 void bcls_mid( int n, double x[], double bl[], double bu[] );
00092 
00093 // Interface to the user's Aprod routine.
00094 void bcls_aprod( BCLS *ls, int mode, int nix,
00095                  int ix[], double x[], double y[] );
00096 
00097 // Interface to the user's preconditioning routine.
00098 void bcls_usolve( BCLS *ls, int mode, int nix,
00099                   int ix[], double v[], double w[] );
00100 
00101 // Interface to the user's callback routine.
00102 int bcls_callback( BCLS *ls );
00103 
00104 // Determine the set of free variables.
00105 int bcls_free_vars( BCLS *ls, int n, int ix[], double x[],
00106                     double g[], double bl[], double bu[] );
00107 
00108 // Discard the smallest element from the heap.
00109 int bcls_heap_del_min( int numElems, double x[], int ix[] );
00110 
00111 // Sift a heap.
00112 void bcls_heap_sift( int root, int lastChild, double x[], int ix[] );
00113 
00114 // Build a heap.
00115 void bcls_heap_build( int n, double x[], int ix[] );
00116 
00117 // Two-norm of a subvector.
00118 double
00119 bcls_vec_dnorm2( int nix, int ix[], double x[] );
00120 
00121 // Load a constant into a vector.
00122 void bcls_dload( const int n, const double alpha, double x[], const int incx );
00123 
00124 // Gather the components of x(ix) into y, eg, y = x(ix).
00125 void bcls_gather( const int nix, const int ix[],
00126                   const double x[], double y[] );
00127 
00128 // Scatter the components of x into y(ix), eg, y(ix) = x.
00129 void bcls_scatter( const int nix, const int ix[],
00130                    const double x[], double y[] );
00131 
00132 #endif

Generated on Sun Mar 4 22:50:03 2007 by Doxygen 1.5.1