1 /*   corematx.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name:  corematx.h
27 *
28 * Author:  Hogue
29 *
30 * Version Creation Date:   3/20/95
31 *
32 * $Revision: 6.0 $
33 *
34 * File Description:
35 *   	Numerical Recipies in C toolkit-ized
36 *	matrix and vector allocators and free-ers
37 *	see corematx.c for implementation docs.
38 *
39 * Modifications:
40 * --------------------------------------------------------------------------
41 * Date     Name        Description of modification
42 * -------  ----------  -----------------------------------------------------
43 * 16 Aug   Hogue       Added PointerPtr typedef * vector allocators
44 *
45 * $Log: corematx.h,v $
46 * Revision 6.0  1997/08/25 18:10:33  madden
47 * Revision changed to 6.0
48 *
49 * Revision 5.0  1996/05/28 14:02:09  ostell
50 * Set to revision 5.0
51 *
52  * Revision 1.3  1995/08/28  19:31:53  kans
53  * version 4.1
54  *
55  * Revision 1.2  1995/08/03  21:44:33  kans
56  * changes
57  *
58  * Revision 1.1  1995/08/02  17:07:15  kans
59  * Initial revision
60  *
61 *
62 * ==========================================================================
63 */
64 
65 
66 typedef FloatHiPtr *FloatHiPtrPtr;
67 typedef FloatLoPtr *FloatLoPtrPtr;
68 typedef Int2Ptr *Int2PtrPtr;
69 typedef Int4Ptr *Int4PtrPtr;
70 typedef FloatLoPtr **FloatLoPtrPtrPtr;
71 typedef Pointer *PointerPtr;
72 
73 /* To use NUMERICAL RECIPIES IN C wrapper functions */
74 /* set the compiler define NRTONCBI */
75 #ifndef _COREMATX_
76 #define _COREMATX_
77 
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 /* function prototypes here */
83 FloatHiPtr LIBCALL FHVector  (Int4 nl, Int4 nh);
84 FloatLoPtr LIBCALL FLVector (Int4 nl, Int4 nh);
85 Int2Ptr  LIBCALL I2Vector  (Int4 nl, Int4 nh);
86 Int4Ptr  LIBCALL I4Vector (Int4 nl, Int4 nh);
87 UcharPtr LIBCALL UCVector (Int4 nl, Int4 nh);
88 Uint4Ptr LIBCALL UI4Vector (Int4 nl, Int4 nh);
89 PointerPtr LIBCALL PTRVector(Int4 nl, Int4 nh);
90 void LIBCALL FHVectorFree (FloatHiPtr v, Int4 nl);
91 void LIBCALL FLVectorFree (FloatLoPtr v,  Int4 nl);
92 void LIBCALL I2VectorFree (Int2Ptr v,  Int4 nl);
93 void LIBCALL I4VectorFree (Int4Ptr v,  Int4 nl);
94 void LIBCALL UCVectorFree (UcharPtr v,  Int4 nl);
95 void LIBCALL UI4VectorFree (Uint4Ptr v,  Int4 nl);
96 void LIBCALL PTRVectorFree(PointerPtr v,  Int4 nl);
97 
98 
99 
100 
101 FloatHiPtrPtr LIBCALL FHMatrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
102 FloatLoPtrPtr LIBCALL FLMatrix  (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
103 Int2PtrPtr LIBCALL I2Matrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
104 Int4PtrPtr LIBCALL I4Matrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
105 void LIBCALL FLMatrixFree (FloatLoPtr *m,  Int4 nrl, Int4 ncl);
106 void LIBCALL FHMatrixFree (FloatHiPtr *m,  Int4 nrl, Int4 ncl);
107 void LIBCALL I2MatrixFree (Int2Ptr *m,  Int4 nrl, Int4 ncl);
108 void LIBCALL I4MatrixFree (Int4Ptr *m,  Int4 nrl, Int4 ncl);
109 
110 FloatLoPtrPtr LIBCALL FLSubmatrix (FloatLoPtr *a,  Int4 oldrl,  Int4 oldrh,
111 		Int4 oldcl,  Int4 oldch,  Int4 newrl,  Int4 newcl);
112 void LIBCALL FLSubmatrixFree (FloatLoPtr *b,  Int4 nrl);
113 
114 FloatHiPtrPtr  LIBCALL FHConvtMatrix (FloatHiPtr a, Int4 nrl,  Int4 nrh,  Int4 ncl,
115 			    Int4 nch);
116 FloatLoPtrPtr  LIBCALL FLConvtMatrix (FloatLoPtr a, Int4 nrl,  Int4 nrh,  Int4 ncl,
117 			    Int4 nch);
118 Int2PtrPtr  LIBCALL I2ConvtMatrix (Int2Ptr a, Int4 nrl,  Int4 nrh,  Int4 ncl,
119 			    Int4 nch);
120 Int4PtrPtr  LIBCALL I4ConvtMatrix (Int4Ptr a, Int4 nrl,  Int4 nrh,  Int4 ncl,
121 			    Int4 nch);
122 void LIBCALL FHConvtFree (FloatHiPtr *b, Int4 nrl);
123 void LIBCALL FLConvtFree (FloatLoPtr *b, Int4 nrl);
124 void LIBCALL I2ConvtFree (Int2Ptr *b, Int4 nrl);
125 void LIBCALL I4ConvtFree (Int4Ptr *b, Int4 nrl);
126 
127 FloatLoPtrPtrPtr LIBCALL FL3Matrix (Int4 nrl,  Int4 nrh,  Int4 ncl,  Int4 nch,  Int4 ndl,
128 Int4 ndh);
129 void LIBCALL FL3MatrixFree (FloatLoPtr **b, Int4 nrl, Int4 ncl, Int4 ndl);
130 
131 /* Numerical Recipies in C "Wrappers" */
132 #ifdef NRTONCBI
133 void nrerror (char error_text[]);
134 FloatLoPtr vector (Int4 nl, Int4 nh);
135 Int4Ptr ivector (Int4 nl, Int4 nh);
136 FloatHiPtr dvector (Int4 nl, Int4 nh);
137 UcharPtr cvector (Int4 nl,  Int4 nh);
138 Uint4Ptr lvector (Int4 nl,  Int4 nh);
139 FloatLoPtr *matrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
140 FloatHiPtr *dmatrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
141 Int4Ptr *imatrix (Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
142 void free_dvector (FloaHiPtr v, Int4 nl,  Int4 nh);
143 void free_vector (FloatLoPtr v,  Int4 nl,  Int4 nh);
144 void free_cvector (UcharPtr v,  Int4 nl,  Int4 nh);
145 void free_lvector (Uint4Ptr v,  Int4 nl,  Int4 nh);
146 void free_ivector (Int4Ptr v,  Int4 nl,  Int4 nh);
147 void free_imatrix (Int4Ptr *m,  Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
148 void free_matrix (FloatLoPtr *m,  Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
149 void free_dmatrix (FloatHiPtr *m,  Int4 nrl, Int4 nrh,  Int4 ncl,  Int4 nch);
150 FloatLoPtr convert_matrix (FloatLoPtr a, Int4 nrl,  Int4 nrh,  Int4 ncl,
151 			    Int2 nch);
152 void free_convert_matrix (FloatLoPtr *b,  Int4 nrl,  Int4 nrh,  Int4 ncl,
153                           Int4 nch);
154 FloatLoPtr *submatrix (FloatLoPtr *a,  Int4 oldrl,  Int4 oldrh,
155 		Int4 oldcl,  Int4 oldch,  Int4 newrl,  Int4 newcl);
156 void free_submatrix (FloatLoPtr *b,  Int4 nrl,  Int4 nrh,
157 		Int4 ncl,  Int4 nch);
158 FloatLoPtr **f3tensor (Int4 nrl,  Int4 nrh,  Int4 ncl,  Int4 nch,  Int4 ndl,
159                        Int4 ndh);
160 void free_f3tensor (FloatLoPtr **t,  Int4 nrl,  Int4 nrh,  Int4 ncl,  Int4 nch,
161 		    Int4 ndl,  Int4 ndh);
162 
163 #endif
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 
170 #endif
171 
172