📄 spconfig.h
字号:
*/
#define FORTRAN NO
/*!
* This specifies that additional error checking will be compiled.
* The type of error checked are those that are common when the
* matrix routines are first integrated into a user's program. Once
* the routines have been integrated in and are running smoothly, this
* option should be turned off. \a YES is recommended.
*/
#define DEBUG YES
#endif /* spINSIDE_SPARSE */
/*
* The following options affect Sparse exports and so are exported as a
* side effect. For this reason they use the `sp' prefix. The boolean
* constants YES an NO are not defined in spMatrix.h to avoid conflicts
* with user code, so use 0 for NO and 1 for YES.
*/
/*!
* This specifies that the routines will be complied to handle
* complex systems of equations.
*/
#define spCOMPLEX 0
/*!
* This specifies the format for complex vectors. If this is set
* false then a complex vector is made up of one double sized
* array of RealNumber's in which the real and imaginary numbers
* are placed alternately in the array. In other
* words, the first entry would be Complex[1].Real, then comes
* Complex[1].Imag, then Complex[2].Real, etc. If
* \a spSEPARATED_COMPLEX_VECTORS is set true, then each complex
* vector is represented by two arrays of \a spREALs, one with
* the real terms, the other with the imaginary. \a NO is recommended.
*/
#define spSEPARATED_COMPLEX_VECTORS 0
#ifdef spINSIDE_SPARSE
/*
* MATRIX CONSTANTS
*
* These constants are used throughout the sparse matrix routines. They
* should be set to suit the type of matrix being solved.
*/
/* Begin constants. */
/*!
* The relative threshold used if the user enters an invalid
* threshold. Also the threshold used by spFactor() when
* calling spOrderAndFactor(). The default threshold should
* not be less than or equal to zero nor larger than one.
* 0.001 is recommended.
*/
#define DEFAULT_THRESHOLD 1.0e-3
/*!
* This indicates whether spOrderAndFactor() should use diagonal
* pivoting as default. This issue only arises when
* spOrderAndFactor() is called from spFactor(). \a YES is recommended.
*/
#define DIAG_PIVOTING_AS_DEFAULT YES
/*!
* This number multiplied by the size of the matrix equals the number
* of elements for which memory is initially allocated in spCreate().
* 6 is recommended.
*/
#define SPACE_FOR_ELEMENTS 6
/*!
* This number multiplied by the size of the matrix equals the number
* of elements for which memory is initially allocated and specifically
* reserved for fill-ins in spCreate(). 4 is recommended.
*/
#define SPACE_FOR_FILL_INS 4
/*!
* The number of matrix elements requested from the malloc utility on
* each call to it. Setting this value greater than 1 reduces the
* amount of overhead spent in this system call. On a virtual memory
* machine, its good to allocate slightly less than a page worth of
* elements at a time (or some multiple thereof).
* 31 is recommended.
*/
#define ELEMENTS_PER_ALLOCATION 31
/*!
* The minimum allocated size of a matrix. Note that this does not
* limit the minimum size of a matrix. This just prevents having to
* resize a matrix many times if the matrix is expandable, large and
* allocated with an estimated size of zero. This number should not
* be less than one.
*/
#define MINIMUM_ALLOCATED_SIZE 6
/*!
* The amount the allocated size of the matrix is increased when it
* is expanded.
*/
#define EXPANSION_FACTOR 1.5
/*!
* Some terminology should be defined. The Markowitz row count is the number
* of non-zero elements in a row excluding the one being considered as pivot.
* There is one Markowitz row count for every row. The Markowitz column
* is defined similarly for columns. The Markowitz product for an element
* is the product of its row and column counts. It is a measure of how much
* work would be required on the next step of the factorization if that
* element were chosen to be pivot. A small Markowitz product is desirable.
*
* This number is used for two slightly different things, both of which
* relate to the search for the best pivot. First, it is the maximum
* number of elements that are Markowitz tied that will be sifted
* through when trying to find the one that is numerically the best.
* Second, it creates an upper bound on how large a Markowitz product
* can be before it eliminates the possibility of early termination
* of the pivot search. In other words, if the product of the smallest
* Markowitz product yet found and \a TIES_MULTIPLIER is greater than
* \a MAX_MARKOWITZ_TIES, then no early termination takes place.
* Set \a MAX_MARKOWITZ_TIES to some small value if no early termination of
* the pivot search is desired. An array of RealNumbers is allocated
* of size \a MAX_MARKOWITZ_TIES so it must be positive and shouldn't
* be too large. Active when MODIFIED_MARKOWITZ is 1 (YES).
* 100 is recommended.
* \see TIES_MULTIPLIER
*/
#define MAX_MARKOWITZ_TIES 100
/*!
* Specifies the number of Markowitz ties that are allowed to occur
* before the search for the pivot is terminated early. Set to some
* large value if no early termination of the pivot search is desired.
* This number is multiplied times the Markowitz product to determine
* how many ties are required for early termination. This means that
* more elements will be searched before early termination if a large
* number of fill-ins could be created by accepting what is currently
* considered the best choice for the pivot. Active when
* \a MODIFIED_MARKOWITZ is 1 (YES). Setting this number to zero
* effectively eliminates all pivoting, which should be avoided.
* This number must be positive. \a TIES_MULTIPLIER is also used when
* diagonal pivoting breaks down. 5 is recommended.
* \see MAX_MARKOWITZ_TIES
*/
#define TIES_MULTIPLIER 5
/*!
* Which partition mode is used by spPartition() as default.
* Possibilities include \a spDIRECT_PARTITION (each row used direct
* addressing, best for a few relatively dense matrices),
* \a spINDIRECT_PARTITION (each row used indirect addressing, best
* for a few very sparse matrices), and \a spAUTO_PARTITION (direct or
* indirect addressing is chosen on a row-by-row basis, carries a large
* overhead, but speeds up both dense and sparse matrices, best if there
* is a large number of matrices that can use the same ordering.
*/
#define DEFAULT_PARTITION spAUTO_PARTITION
/*!
* The number of characters per page width. Set to 80 for terminal,
* 132 for line printer. Controls how many columns printed by
* spPrint() per page width.
*/
#define PRINTER_WIDTH 80
#endif /* spINSIDE_SPARSE */
/*
* PORTABILITY MACROS
*/
#ifdef __STDC__
# define spcCONCAT(prefix,suffix) prefix ## suffix
# define spcQUOTE(x) # x
# define spcFUNC_NEEDS_FILE(func,file) \
func ## _requires_ ## file ## _to_be_included_
#else
# define spcCONCAT(prefix,suffix) prefix/**/suffix
# define spcQUOTE(x) "x"
# define spcFUNC_NEEDS_FILE(func,file) \
func/**/_requires_/**/file/**/_to_be_included_
#endif
#if defined(__cplusplus) || defined(c_plusplus)
/*
* Definitions for C++
*/
# define spcEXTERN extern "C"
# define spcNO_ARGS
# define spcCONST const
typedef void *spGenericPtr;
#else
#ifdef __STDC__
/*
* Definitions for ANSI C
*/
# define spcEXTERN extern
# define spcNO_ARGS void
# define spcCONST const
typedef void *spGenericPtr;
# else
/*
* Definitions for K&R C -- ignore function prototypes
*/
# define spcEXTERN extern
# define spcNO_ARGS
# define spcCONST
typedef char *spGenericPtr;
#endif
#endif
#ifdef spINSIDE_SPARSE
/*
* MACHINE CONSTANTS
*
* These numbers must be updated when the program is ported to a new machine.
*/
/* Begin machine constants. */
#include <limits.h>
#include <float.h>
/*! The resolution of spREAL. */
#define MACHINE_RESOLUTION DBL_EPSILON
/*! The largest possible value of spREAL. */
#define LARGEST_REAL DBL_MAX
/*! The smalles possible positive value of spREAL. */
#define SMALLEST_REAL DBL_MIN
/*! The largest possible value of shorts. */
#define LARGEST_SHORT_INTEGER SHRT_MAX
/*! The largest possible value of longs. */
#define LARGEST_LONG_INTEGER LONG_MAX
/*! The largest possible value of ints. */
#define LARGEST_INTEGER INT_MAX
/* ANNOTATION */
/*!
* This macro changes the amount of annotation produced by the matrix
* routines. The annotation is used as a debugging aid. Change the number
* associated with \a ANNOTATE to change the amount of annotation produced by
* the program. Possible values include \a NONE, \a ON_STRANGE_BEHAVIOR, and
* \a FULL. \a NONE is recommended.
*/
#define ANNOTATE NONE
/*!
* A possible value for \a ANNOTATE. Disables all annotation.
*/
#define NONE 0
/*!
* A possible value for \a ANNOTATE. Causes annotation to be produce
* upon unusual occurrences only.
*/
#define ON_STRANGE_BEHAVIOR 1
/*!
* A possible value for \a ANNOTATE. Enables full annotation.
*/
#define FULL 2
#endif /* spINSIDE_SPARSE */
#endif /* spCONFIG_DEFS */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -