kusano 7d535a
/*! @file sp_ienv.c
kusano 7d535a
 * \brief Chooses machine-dependent parameters for the local
kusano 7d535a
 * environment.
kusano 7d535a
 *
kusano 7d535a
 * -- SuperLU routine (version 4.1) --
kusano 7d535a
 * Univ. of California Berkeley, Xerox Palo Alto Research Center,
kusano 7d535a
 * and Lawrence Berkeley National Lab.
kusano 7d535a
 * November, 2010
kusano 7d535a
 *
kusano 7d535a
*/
kusano 7d535a
kusano 7d535a
/*
kusano 7d535a
 * File name:		sp_ienv.c
kusano 7d535a
 * History:             Modified from lapack routine ILAENV
kusano 7d535a
 */
kusano 7d535a
#include "slu_Cnames.h"
kusano 7d535a
kusano 7d535a
/*! \brief
kusano 7d535a
kusano 7d535a
 
kusano 7d535a
    Purpose   
kusano 7d535a
    =======   
kusano 7d535a
kusano 7d535a
    sp_ienv() is inquired to choose machine-dependent parameters for the
kusano 7d535a
    local environment. See ISPEC for a description of the parameters.   
kusano 7d535a
kusano 7d535a
    This version provides a set of parameters which should give good,   
kusano 7d535a
    but not optimal, performance on many of the currently available   
kusano 7d535a
    computers.  Users are encouraged to modify this subroutine to set   
kusano 7d535a
    the tuning parameters for their particular machine using the option   
kusano 7d535a
    and problem size information in the arguments.   
kusano 7d535a
kusano 7d535a
    Arguments   
kusano 7d535a
    =========   
kusano 7d535a
kusano 7d535a
    ISPEC   (input) int
kusano 7d535a
            Specifies the parameter to be returned as the value of SP_IENV.   
kusano 7d535a
            = 1: the panel size w; a panel consists of w consecutive
kusano 7d535a
	         columns of matrix A in the process of Gaussian elimination.
kusano 7d535a
		 The best value depends on machine's cache characters.
kusano 7d535a
            = 2: the relaxation parameter relax; if the number of
kusano 7d535a
	         nodes (columns) in a subtree of the elimination tree is less
kusano 7d535a
		 than relax, this subtree is considered as one supernode,
kusano 7d535a
		 regardless of their row structures.
kusano 7d535a
            = 3: the maximum size for a supernode in complete LU;
kusano 7d535a
	    = 4: the minimum row dimension for 2-D blocking to be used;
kusano 7d535a
	    = 5: the minimum column dimension for 2-D blocking to be used;
kusano 7d535a
	    = 6: the estimated fills factor for L and U, compared with A;
kusano 7d535a
	    = 7: the maximum size for a supernode in ILU.
kusano 7d535a
	    
kusano 7d535a
   (SP_IENV) (output) int
kusano 7d535a
            >= 0: the value of the parameter specified by ISPEC   
kusano 7d535a
            < 0:  if SP_IENV = -k, the k-th argument had an illegal value. 
kusano 7d535a
  
kusano 7d535a
    ===================================================================== 
kusano 7d535a
kusano 7d535a
*/
kusano 7d535a
int
kusano 7d535a
sp_ienv(int ispec)
kusano 7d535a
{
kusano 7d535a
    int i;
kusano 7d535a
kusano 7d535a
    switch (ispec) {
kusano 7d535a
	case 1: return (12);
kusano 7d535a
	case 2: return (1);
kusano 7d535a
	case 3: return (100);
kusano 7d535a
	case 4: return (200);
kusano 7d535a
	case 5: return (60);
kusano 7d535a
        case 6: return (20);
kusano 7d535a
        case 7: return (10);
kusano 7d535a
    }
kusano 7d535a
kusano 7d535a
    /* Invalid value for ISPEC */
kusano 7d535a
    i = 1;
kusano 7d535a
    xerbla_("sp_ienv", &i);
kusano 7d535a
    return 0;
kusano 7d535a
kusano 7d535a
} /* sp_ienv_ */
kusano 7d535a