Changeset 3540
- Timestamp:
- Mar 29, 2005, 9:41:56 AM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 10 edited
-
astro/psCoord.c (modified) (2 diffs)
-
astro/psCoord.h (modified) (2 diffs)
-
astronomy/psAstrometry.c (modified) (6 diffs)
-
astronomy/psAstrometry.h (modified) (4 diffs)
-
astronomy/psCoord.c (modified) (2 diffs)
-
astronomy/psCoord.h (modified) (2 diffs)
-
dataManip/psMinimize.c (modified) (2 diffs)
-
dataManip/psStats.c (modified) (1 diff)
-
math/psMinimize.c (modified) (2 diffs)
-
math/psStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r3470 r3540 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-03-2 2 01:35:49$12 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-03-29 19:41:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 191 191 return (out); 192 192 } 193 194 // XXX: Must code this.195 psPlaneTransform *psPlaneTransformInvert(196 psPlaneTransform *out,197 const psPlaneTransform *in,198 psRegion *region,199 int nSamples)200 {201 PS_PTR_CHECK_NULL(in, NULL);202 PS_PTR_CHECK_NULL(region, NULL);203 204 return(NULL);205 }206 207 208 // XXX: Must code this.209 psPlaneTransform *psPlaneTransformCombine(210 psPlaneTransform *out,211 const psPlaneTransform *trans1,212 const psPlaneTransform *trans2)213 {214 PS_PTR_CHECK_NULL(trans1, NULL);215 PS_PTR_CHECK_NULL(trans2, NULL);216 217 return(NULL);218 }219 220 221 // XXX: Must code this.222 // XXX: What about nRejIter? Iterations?223 224 bool psPlaneTranformFit(225 psPlaneTransform *trans,226 const psArray *source,227 const psArray *dest,228 int nRejIter,229 float sigmaClip)230 {231 PS_PTR_CHECK_NULL(trans, NULL);232 PS_PTR_CHECK_NULL(source, NULL);233 PS_PTR_CHECK_NULL(dest, NULL);234 235 return(NULL);236 }237 238 193 239 194 /****************************************************************************** -
trunk/psLib/src/astro/psCoord.h
r3450 r3540 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-03- 18 21:34:43$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-03-29 19:41:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 227 227 ); 228 228 229 // XXX: Doxygenate.230 psPlaneTransform *psPlaneTransformInvert(231 psPlaneTransform *out,232 const psPlaneTransform *in,233 psRegion *region,234 int nSamples235 );236 237 // XXX: Doxygenate.238 psPlaneTransform *psPlaneTransformCombine(239 psPlaneTransform *out,240 const psPlaneTransform *trans1,241 const psPlaneTransform *trans2242 );243 244 // XXX: Doxygenate.245 bool psPlaneTranformFit(246 psPlaneTransform *trans,247 const psArray *source,248 const psArray *dest,249 int nRejIter,250 float sigmaClip251 );252 253 254 255 229 /** Allocator for psSphereTransform 256 230 * -
trunk/psLib/src/astronomy/psAstrometry.c
r3497 r3540 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-03-2 4 22:36:16 $10 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-03-29 19:41:56 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 913 913 914 914 915 916 917 918 /*****************************************************************************919 psPlaneTransformInvertHEY(out, in, region, nSamples): this is an earlier920 version of this function which doesnot separate the code for building and921 solving the matrixequations.922 923 XXX: Delete this codeonce you know the other version works.924 *****************************************************************************/925 psPlaneTransform *psPlaneTransformInvertHEY(psPlaneTransform *out,926 const psPlaneTransform *in,927 psRegion *region,928 int nSamples)929 {930 PS_PTR_CHECK_NULL(in, NULL);931 if (isProjectionLinear((psPlaneTransform *) in)) {932 return(invertPlaneTransform((psPlaneTransform *) in));933 }934 psPlaneTransform *myPT = NULL;935 psPlane *inCoord = psPlaneAlloc();936 psPlane *outCoord = psPlaneAlloc();937 938 PS_PTR_CHECK_NULL(region, NULL);939 PS_INT_COMPARE(0, nSamples, NULL);940 941 // XXX: Is this correct?942 psS32 order = PS_MAX(in->x->nX, in->x->nY);943 944 //945 // Allocate a new psPlaneTransform if "out" is NULL, or has the wrong size.946 //947 if (out == NULL) {948 myPT = psPlaneTransformAlloc(order, order);949 } else {950 if (!((out->x->nX == order) &&951 (out->x->nY == order) &&952 (out->y->nX == order) &&953 (out->y->nY == order))) {954 psFree(out);955 myPT = psPlaneTransformAlloc(order, order);956 } else {957 myPT = out;958 }959 }960 // XXX: Initialize myPT?961 962 //963 // Create fake polynomial to use in evaluation964 //965 psDPolynomial2D *fakePoly = psDPolynomial2DAlloc(order, order, PS_POLYNOMIAL_ORD);966 for (int i = 0; i < order; i++) {967 for (int j = 0; j < order; j++) {968 fakePoly->coeff[i][j] = 1.0; // Set all coeffecients to 1969 fakePoly->mask[i][j] = 1; // Mask all coefficients; unmask to evaluate970 }971 }972 973 //974 // Create a grid of xin,yin --> xout,yout975 //976 psVector *xIn = psVectorAlloc(nSamples * nSamples, PS_TYPE_F32);977 psVector *yIn = psVectorAlloc(nSamples * nSamples, PS_TYPE_F32);978 psVector *xOut = psVectorAlloc(nSamples * nSamples, PS_TYPE_F32);979 psVector *yOut = psVectorAlloc(nSamples * nSamples, PS_TYPE_F32);980 981 //982 // Initialize the grid of points983 //984 for (int yint = 0; yint < nSamples; yint++) {985 inCoord->y = region->y0 + ((psF32) yint) * ((region->y1 - region->y0) / ((psF32) nSamples));986 for (int xint = 0; xint < nSamples; xint++) {987 inCoord->x = region->x0 + ((psF32) xint) * ((region->x1 - region->x0) / ((psF32) nSamples));988 989 (void)psPlaneTransformApply(outCoord, in, inCoord);990 xOut->data.F32[yint*nSamples + xint] = inCoord->x;991 yOut->data.F32[yint*nSamples + xint] = inCoord->y;992 xIn->data.F32[yint*nSamples + xint] = outCoord->x;993 yIn->data.F32[yint*nSamples + xint] = outCoord->y;994 }995 }996 997 //998 // Initialise the matrix and vectors999 //1000 psS32 nCoeff = order * (order + 1) / 2; // Number of polynomial coefficients1001 psImage *matrix = psImageAlloc(nCoeff, nCoeff, PS_TYPE_F64); // Matrix for solution1002 psVector *xVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in x1003 psVector *yVector = psVectorAlloc(nCoeff, PS_TYPE_F64); // Vector for solution in y1004 for (psS32 i = 0; i < nCoeff; i++) {1005 for (psS32 j = 0; j < nCoeff; j++) {1006 matrix->data.F64[i][j] = 0.0;1007 }1008 xVector->data.F64[i] = 0.0;1009 yVector->data.F64[i] = 0.0;1010 }1011 1012 //1013 // Iterate over the grid points1014 //1015 for (psS32 g = 0; g < nSamples*nSamples; g++) {1016 // Iterate over the polynomial coefficients, accumulating the matrix and vectors1017 1018 for (psS32 i = 0, ijIndex = 0; i < order; i++) {1019 for (psS32 j = 0; j < order - i; j++, ijIndex++) {1020 1021 fakePoly->mask[i][j] = 0;1022 psF64 ijPoly = psDPolynomial2DEval(fakePoly, (psF64) xIn->data.F32[g], (psF64) yIn->data.F32[g]);1023 fakePoly->mask[i][j] = 1;1024 1025 for (psS32 m = 0, mnIndex = 0; m < order; m++) {1026 for (psS32 n = 0; n < order - m; n++, mnIndex++) {1027 fakePoly->mask[m][n] = 0;1028 psF64 mnPoly = psDPolynomial2DEval(fakePoly, (psF64) xIn->data.F32[g], (psF64) yIn->data.F32[g]);1029 fakePoly->mask[m][n] = 1;1030 1031 matrix->data.F64[ijIndex][mnIndex] += ijPoly * mnPoly;1032 }1033 }1034 1035 xVector->data.F64[ijIndex] += ijPoly * (psF64)xOut->data.F32[g];1036 yVector->data.F64[ijIndex] += ijPoly * (psF64)yOut->data.F32[g];1037 }1038 }1039 }1040 1041 //1042 // Solution via LU Decomposition1043 //1044 psVector *permutation = psVectorAlloc(nCoeff, PS_TYPE_F64); // Permutation vector for LU Decomposition1045 psImage *luMatrix = psMatrixLUD(NULL, &permutation, matrix); // LU decomposed matrix1046 psVector *xSolution = psMatrixLUSolve(NULL, luMatrix, xVector, permutation); // Solution in x1047 psVector *ySolution = psMatrixLUSolve(NULL, luMatrix, yVector, permutation); // Solution in y1048 1049 //1050 // Stuff coefficients into transformation1051 //1052 for (psS32 i = 0, ijIndex = 0; i < order; i++) {1053 for (psS32 j = 0; j < order - i; j++, ijIndex++) {1054 myPT->x->coeff[i][j] = xSolution->data.F64[ijIndex];1055 myPT->y->coeff[i][j] = ySolution->data.F64[ijIndex];1056 }1057 }1058 1059 return(myPT);1060 }1061 1062 1063 915 /***************************************************************************** 1064 916 multiplyCoeffs(trans1, trans2): Takes two 2-D polynomials as input and … … 1100 952 1101 953 /***************************************************************************** 1102 psPlaneTransformCombine Tmp(out, trans1, trans2)954 psPlaneTransformCombine(out, trans1, trans2) 1103 955 1104 956 XXX: Much room for optimization. Currently, we call the polyMultiply 1105 957 routine far too many times. 1106 958 *****************************************************************************/ 1107 psPlaneTransform *psPlaneTransformCombine Tmp(psPlaneTransform *out,959 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out, 1108 960 const psPlaneTransform *trans1, 1109 961 const psPlaneTransform *trans2) … … 1240 1092 1241 1093 /***************************************************************************** 1242 psPlaneTranformFit Tmp(trans, source, dest, nRejIter, sigmaClip)1094 psPlaneTranformFit(trans, source, dest, nRejIter, sigmaClip) 1243 1095 1244 1096 XXX: What about nRejIter? Iterations? 1245 1097 XXX: Use static vectors for internal data. 1246 1098 *****************************************************************************/ 1247 bool psPlaneTranformFit Tmp(psPlaneTransform *trans,1248 const psArray *source,1249 const psArray *dest,1250 int nRejIter,1251 float sigmaClip)1099 bool psPlaneTranformFit(psPlaneTransform *trans, 1100 const psArray *source, 1101 const psArray *dest, 1102 int nRejIter, 1103 float sigmaClip) 1252 1104 { 1253 1105 PS_PTR_CHECK_NULL(trans, NULL); … … 1360 1212 1361 1213 /***************************************************************************** 1362 psPlaneTransformInvert Tmp(out, in, region, nSamples)1214 psPlaneTransformInvert(out, in, region, nSamples) 1363 1215 1364 1216 // XXX: Use static data structures. 1365 1217 *****************************************************************************/ 1366 psPlaneTransform *psPlaneTransformInvert Tmp(psPlaneTransform *out,1218 psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out, 1367 1219 const psPlaneTransform *in, 1368 1220 psRegion *region, … … 1448 1300 } 1449 1301 } 1450 bool rc = psPlaneTranformFit Tmp(myPT, inData, outData, 10, 100.0);1302 bool rc = psPlaneTranformFit(myPT, inData, outData, 10, 100.0); 1451 1303 1452 1304 psFree(inCoord); -
trunk/psLib/src/astronomy/psAstrometry.h
r3497 r3540 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-03-2 4 22:36:16 $10 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-03-29 19:41:56 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 537 537 // XXX: These functions don't belong here. Will migrate to psCoords.c later. 538 538 // XXX: Doxygenate. 539 psPlaneTransform *psPlaneTransformInvert Tmp(539 psPlaneTransform *psPlaneTransformInvert( 540 540 psPlaneTransform *out, 541 541 const psPlaneTransform *in, … … 545 545 546 546 // XXX: Doxygenate. 547 psPlaneTransform *psPlaneTransformCombine Tmp(547 psPlaneTransform *psPlaneTransformCombine( 548 548 psPlaneTransform *out, 549 549 const psPlaneTransform *trans1, … … 552 552 553 553 // XXX: Doxygenate. 554 bool psPlaneTranformFit Tmp(554 bool psPlaneTranformFit( 555 555 psPlaneTransform *trans, 556 556 const psArray *source, -
trunk/psLib/src/astronomy/psCoord.c
r3470 r3540 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-03-2 2 01:35:49$12 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-03-29 19:41:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 191 191 return (out); 192 192 } 193 194 // XXX: Must code this.195 psPlaneTransform *psPlaneTransformInvert(196 psPlaneTransform *out,197 const psPlaneTransform *in,198 psRegion *region,199 int nSamples)200 {201 PS_PTR_CHECK_NULL(in, NULL);202 PS_PTR_CHECK_NULL(region, NULL);203 204 return(NULL);205 }206 207 208 // XXX: Must code this.209 psPlaneTransform *psPlaneTransformCombine(210 psPlaneTransform *out,211 const psPlaneTransform *trans1,212 const psPlaneTransform *trans2)213 {214 PS_PTR_CHECK_NULL(trans1, NULL);215 PS_PTR_CHECK_NULL(trans2, NULL);216 217 return(NULL);218 }219 220 221 // XXX: Must code this.222 // XXX: What about nRejIter? Iterations?223 224 bool psPlaneTranformFit(225 psPlaneTransform *trans,226 const psArray *source,227 const psArray *dest,228 int nRejIter,229 float sigmaClip)230 {231 PS_PTR_CHECK_NULL(trans, NULL);232 PS_PTR_CHECK_NULL(source, NULL);233 PS_PTR_CHECK_NULL(dest, NULL);234 235 return(NULL);236 }237 238 193 239 194 /****************************************************************************** -
trunk/psLib/src/astronomy/psCoord.h
r3450 r3540 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-03- 18 21:34:43$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-03-29 19:41:56 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 227 227 ); 228 228 229 // XXX: Doxygenate.230 psPlaneTransform *psPlaneTransformInvert(231 psPlaneTransform *out,232 const psPlaneTransform *in,233 psRegion *region,234 int nSamples235 );236 237 // XXX: Doxygenate.238 psPlaneTransform *psPlaneTransformCombine(239 psPlaneTransform *out,240 const psPlaneTransform *trans1,241 const psPlaneTransform *trans2242 );243 244 // XXX: Doxygenate.245 bool psPlaneTranformFit(246 psPlaneTransform *trans,247 const psArray *source,248 const psArray *dest,249 int nRejIter,250 float sigmaClip251 );252 253 254 255 229 /** Allocator for psSphereTransform 256 230 * -
trunk/psLib/src/dataManip/psMinimize.c
r3476 r3540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-03-2 2 21:52:49$11 * @version $Revision: 1.108 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-03-29 19:41:56 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1414 1414 XXX: Since this is an internal function, many of the parameter checks are 1415 1415 redundant. 1416 XXX: Don't modify the psMinimization argument. 1416 1417 *****************************************************************************/ 1417 1418 #define PS_LINEMIN_MAX_ITERATIONS 30 -
trunk/psLib/src/dataManip/psStats.c
r3529 r3540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.12 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-03-2 8 22:49:33$11 * @version $Revision: 1.122 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-03-29 19:41:56 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/math/psMinimize.c
r3476 r3540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-03-2 2 21:52:49$11 * @version $Revision: 1.108 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-03-29 19:41:56 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1414 1414 XXX: Since this is an internal function, many of the parameter checks are 1415 1415 redundant. 1416 XXX: Don't modify the psMinimization argument. 1416 1417 *****************************************************************************/ 1417 1418 #define PS_LINEMIN_MAX_ITERATIONS 30 -
trunk/psLib/src/math/psStats.c
r3529 r3540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.12 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-03-2 8 22:49:33$11 * @version $Revision: 1.122 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-03-29 19:41:56 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
