Changeset 361
- Timestamp:
- Mar 31, 2004, 10:54:37 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r360 r361 1 %%% $Id: psLibSDRS.tex,v 1.2 2 2004-04-01 08:52:29 eugene Exp $1 %%% $Id: psLibSDRS.tex,v 1.23 2004-04-01 08:54:37 price Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 1006 1006 the list, pointed to by both \code{psDlist.head} and 1007 1007 \code{psDlist.tail}. If the data entry is \code{NULL}, then an empty 1008 list, with both pointers set to \code{NULL} should be created.1008 list, with both pointers are set to \code{NULL} should be created. 1009 1009 1010 1010 An entry may be added to the list with the function: … … 1016 1016 \code{psDlist} may have changed. The value of \code{where} specifies 1017 1017 if the specified data item should be placed on the front of the list 1018 (\code{PS_DLIST_HEAD}), at the end of the list (\code{PS_DLIST_TAIL}),1019 \tbd{use of other options?}. 1018 (\code{PS_DLIST_HEAD}), or at the end of the list 1019 (\code{PS_DLIST_TAIL}). 1020 1020 1021 1021 A data item may be retrieved from the list with the function: … … 1026 1026 of the special values: \code{PS_DLIST_HEAD}, \code{PS_DLIST_TAIL}, 1027 1027 \code{PS_DLIST_PREV}, and \code{PS_DLIST_NEXT}, all of which are 1028 defined as negative integers. 1028 defined as negative integers, allowing \code{where} to also be the 1029 index of one of the data items. 1029 1030 1030 1031 A data item may be removed from the list with the function: … … 1037 1038 \code{PS_DLIST_NEXT}, all of which are defined as negative integers. 1038 1039 If the value of \code{which} is \code{PS_DLIST_UNKNOWN}, then the data 1039 item is identified by matching the pointer value with \code{void 1040 *data}. 1040 item is identified by matching the pointer value with \code{void *data}. 1041 1041 1042 1042 All data items placed onto lists (\code{psDlistAdd}) shall have their … … 1112 1112 % 1113 1113 where \code{nbucket} is the number of buckets defined for the hash 1114 functions, and \code{buckets} are the individual buckets, each of1115 which is defined by:1114 functions, and \code{buckets} is an array of pointers to the 1115 individual buckets, each of which is defined by: 1116 1116 % 1117 1117 \begin{verbatim} … … 1124 1124 where each bucket contains the value of the \code{key}, a pointer to 1125 1125 the \code{data}, and a pointer to the \code{next} list entry in the 1126 bucket .1126 bucket (in the event that two or more keys have the same hash value). 1127 1127 1128 1128 A hash table is created with the following function: 1129 1129 \begin{verbatim} 1130 psHash *psHashAlloc( int nbucket);1130 psHash *psHashAlloc(void); 1131 1131 \end{verbatim} 1132 1132 which allocates the space for the hash table and initializes all of 1133 the buckets. \tbd{why specify nbucket? isn't it set by the hash 1134 function?}. 1133 the buckets. 1135 1134 1136 1135 A data item may be added to the hash table with the function: … … 1144 1143 same value of \code{key}. The routine \code{psHashInsert} must 1145 1144 provide a non-NULL \code{itemFree} argument if it wishes to change the 1146 value for previously inserted keys; if \code{itemFree} is NULL 1145 value for previously inserted keys; if \code{itemFree} is NULL, 1147 1146 attempting to insert a pre-existing key is an error, and the routine 1148 1147 will return NULL. If \code{psHashInsert} succeeds it returns … … 1159 1158 void *psHashRemove(psHash *table, char *key); 1160 1159 \end{verbatim} 1161 \tbd{what is return value?} 1160 the return value of which is the value at the key that is removed (or 1161 NULL if no match is found). 1162 1162 1163 1163 A complete hash table may be freed by calling: … … 1166 1166 \end{verbatim} 1167 1167 where the function \code{itemFree} is provided to delete the 1168 individual elements in the table. If it is NULL thisis the1169 responsibility of the caller .1168 individual elements in the table. If it is NULL it is the 1169 responsibility of the caller to free the elements. 1170 1170 1171 1171 The function … … 1173 1173 psDlist *psHashKeylist(psHast *table); 1174 1174 \end{verbatim} 1175 returns the complete list of defined keys associated with the psHash1176 table as a linked list.1175 returns the complete list of defined keys associated with the 1176 \code{psHash} table as a linked list. 1177 1177 1178 1178 \section{Data manipulation} … … 1238 1238 \end{verbatim} 1239 1239 1240 \code{psBitMaskSet} sets the specified \code{bit} in the 1241 \code{psBitMask}, and returns the updated bitmask. The input bitmask 1242 will be modified. 1243 1240 1244 \begin{verbatim} 1241 1245 /** Check a bit mask. Returns true or false */ … … 1245 1249 ); 1246 1250 \end{verbatim} 1251 1252 \code{psBitMaskTest} returns a true value if the specified \code{bit} 1253 is set; otherwise, it returns a false value. 1247 1254 1248 1255 \begin{verbatim} … … 1256 1263 \end{verbatim} 1257 1264 1265 \code{psBitMaskOp} returns the \code{psBitMask} that is the result of 1266 performing the specified \code{operator} (one of \code{"AND"}, 1267 \code{"OR"}, or \code{"XOR"}) on \code{inMask1} and \code{inMask2}. 1268 1258 1269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1259 1270 1260 1271 \subsection{Sorting} 1261 1272 1262 We require the ability to sort an array of floating-point values: 1273 We require the ability to sort an array of floating-point values. The 1274 following function returns the array, sorted from the smallest (i.e.\ 1275 most negative) value in the first element, and the largest (i.e.\ most 1276 positive) value in the last element. The input array, \code{myArray}, 1277 may be sorted in-place if it is also specified as the \code{out} 1278 array. 1263 1279 1264 1280 \begin{verbatim} … … 1270 1286 \end{verbatim} 1271 1287 1272 We also require the ability to sort one array based on another. In 1273 order to facilitate this, we will have a sort function return an array 1274 containing the induces for the unsorted list in the order appropriate 1275 for the sorted array: 1288 We also require the ability to sort one array based on another. For 1289 example, we may want to sort both \code{x} and \code{y} by the value 1290 in \code{x}. In order to facilitate this, we will have a sort 1291 function return an array containing the indices for the unsorted list 1292 in the order appropriate for the sorted array: 1276 1293 1277 1294 \begin{verbatim} … … 1281 1298 const psFloatArray *restrict myArray ///< Array to sort 1282 1299 ); 1300 \end{verbatim} 1301 1302 Then the sorted arrays may be accessed in the following manner: 1303 1304 \begin{verbatim} 1305 indexArray = psSortIndex(NULL, x); 1306 for (int i = 0; i < indexArray.n; i++) { 1307 doMyFunc(x[indexArray[i]], y[indexArray[i]]); 1308 } 1283 1309 \end{verbatim} 1284 1310 … … 1295 1321 \item Sample mean; 1296 1322 \item Sample median; 1297 \item Sample mode;1298 1323 \item Sample standard deviation; 1299 1324 \item Sample upper and lower quartiles; 1300 \item Robust mean , associated errorand number of values used to calculate;1301 \item Robust median , associated errorand number of values used to calculate;1302 \item Robust mode , associated errorand number of values used to calculate;1325 \item Robust mean and number of values used to calculate; 1326 \item Robust median and number of values used to calculate; 1327 \item Robust mode and number of values used to calculate; 1303 1328 \item Robust standard deviation; 1304 1329 \item Robust upper and lower quartiles; 1305 \item Clipped mean , associated errorand number of values used to calculate;1330 \item Clipped mean and number of values used to calculate; 1306 1331 \item Clipped standard deviation; and 1307 1332 \item Minimum and maximum value in array. … … 1325 1350 ); 1326 1351 \end{verbatim} 1352 % 1353 This function takes the input data in \code{myArray} (with optional 1354 masking in \code{maskArray}, so that the user may explicitly reject 1355 specific entries) and a \code{psStats} structure, which will be 1356 altered and returned. 1327 1357 1328 1358 The \code{psStats} structure is defined with entries for each of the … … 1332 1362 /** generic statistics structure */ 1333 1363 typedef struct { 1334 double sampleMean; ///< formal mean of sample 1335 double sampleMedian; ///< formal median of sample 1336 double sampleMode; ///< Formal mode of sample 1337 double sampleStdev; ///< standard deviation of sample 1338 double sampleUQ; ///< upper quartile of sample 1339 double sampleLQ; ///< lower quartile of sample 1340 double robustMean; ///< robust mean of array 1341 double robustMeanError; ///< error on robust mean 1342 int robustMeanNvalues; ///< number of measurements used for robust mean 1343 double robustMedian; ///< robust median of array 1344 double robustMedianError; ///< error on robust median 1345 int robustMedianNvalues; ///< number of measurements used for robust median 1346 double robustMode; ///< Robust mode of array 1347 double robustModeErr; ///< Error in robust mode 1348 int robustModeNvalues; ///< Number of measurements used for robust mode 1349 double robustStdev; ///< robust standard deviation of array 1350 double robustUQ; ///< robust upper quartile 1351 double robustLQ; ///< robust lower quartile 1352 double clippedMean; ///< Nsigma clipped mean 1353 double clippedMeanError; ///< error on clipped mean 1354 int clippedMeanNvalues; ///< number of data points used for clipped mean 1355 double clippedStdev; ///< standard deviation after clipping 1356 double clipSigma; ///< Nsigma used for clipping; user input 1357 int clipIter; ///< Number of clipping iterations; user input 1358 double min; ///< minimum data value in array 1359 double max; ///< maximum data value in array 1360 int nValues; ///< number of data values in array 1361 psStatsOptions options; ///< bitmask of calculated values 1364 double sampleMean; ///< formal mean of sample 1365 double sampleMedian; ///< formal median of sample 1366 double sampleStdev; ///< standard deviation of sample 1367 double sampleUQ; ///< upper quartile of sample 1368 double sampleLQ; ///< lower quartile of sample 1369 double robustMean; ///< robust mean of array 1370 int robustMeanNvalues; ///< number of measurements used for robust mean 1371 double robustMedian; ///< robust median of array 1372 int robustMedianNvalues; ///< number of measurements used for robust median 1373 double robustMode; ///< Robust mode of array 1374 int robustModeNvalues; ///< Number of measurements used for robust mode 1375 double robustStdev; ///< robust standard deviation of array 1376 double robustUQ; ///< robust upper quartile 1377 double robustLQ; ///< robust lower quartile 1378 double clippedMean; ///< Nsigma clipped mean 1379 int clippedMeanNvalues; ///< number of data points used for clipped mean 1380 double clippedStdev; ///< standard deviation after clipping 1381 double clipSigma; ///< Nsigma used for clipping; user input 1382 int clipIter; ///< Number of clipping iterations; user input 1383 double min; ///< minimum data value in array 1384 double max; ///< maximum data value in array 1385 int nValues; ///< number of data values in array 1386 psStatsOptions options; ///< bitmask of calculated values 1362 1387 } psStats; 1363 1388 \end{verbatim} 1389 where \code{psStatsOptions} is defined with entries to turn on the 1390 calculation of each of the statistics: 1391 1392 \begin{verbatim} 1393 /** statistics which may be calculated */ 1394 typedef enum { 1395 PS_STAT_SAMPLE_MEAN = 0x000001, 1396 PS_STAT_SAMPLE_MEDIAN = 0x000002, 1397 PS_STAT_SAMPLE_STDEV = 0x000004, 1398 PS_STAT_SAMPLE_UQ = 0x000008, 1399 PS_STAT_SAMPLE_LQ = 0x000010, 1400 PS_STAT_ROBUST_MEAN = 0x000020, 1401 PS_STAT_ROBUST_MEAN_NVALUES = 0x000040, 1402 PS_STAT_ROBUST_MEDIAN = 0x000080, 1403 PS_STAT_ROBUST_MEDIAN_NVALUES = 0x000100, 1404 PS_STAT_ROBUST_MODE = 0x000200, 1405 PS_STAT_ROBUST_MODE_NVALUES = 0x000400, 1406 PS_STAT_ROBUST_STDEV = 0x000800, 1407 PS_STAT_ROBUST_UQ = 0x001000, 1408 PS_STAT_ROBUST_LQ = 0x002000, 1409 PS_STAT_CLIPPED_MEAN = 0x004000, 1410 PS_STAT_CLIPPED_MEAN_NVALUES = 0x008000, 1411 PS_STAT_CLIPPED_MEAN_NSIGMA = 0x010000, 1412 PS_STAT_CLIPPED_STDEV = 0x020000, 1413 PS_STAT_MAX = 0x040000, 1414 PS_STAT_MIN = 0x080000, 1415 PS_STAT_NVALUES = 0x100000 1416 } psStatsOptions; 1417 \end{verbatim} 1418 1419 Associated constructors and destructors are also required: 1420 1421 \begin{verbatim} 1422 /** Constructor */ 1423 psStats * 1424 psStatsAlloc(psStatsOptions options ///< Statistics to measure 1425 ); 1426 1427 /** Destructor */ 1428 void 1429 psStatsFree(psStats *restrict stats ///< Stats structure to destroy 1430 ); 1431 \end{verbatim} 1432 1364 1433 1365 1434 \subsubsection{Histograms} 1366 1435 1367 1436 We also require to be able to generate histograms, given a list of 1368 upper and lower bounds for each of the bins, and maximum and minimum 1369 values. 1437 upper and lower bounds for each of the bins. 1370 1438 1371 1439 \begin{verbatim}
Note:
See TracChangeset
for help on using the changeset viewer.
