Changeset 3884
- Timestamp:
- May 11, 2005, 12:02:16 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 20 edited
-
pslib.kdevelop.pcs (modified) ( previous)
-
pslib.kdevses (modified) (2 diffs)
-
src/astro/psCoord.c (modified) (6 diffs)
-
src/astro/psTime.c (modified) (4 diffs)
-
src/astronomy/psCoord.c (modified) (6 diffs)
-
src/astronomy/psTime.c (modified) (4 diffs)
-
src/dataManip/psConstants.h (modified) (3 diffs)
-
src/dataManip/psFunctions.c (modified) (2 diffs)
-
src/dataManip/psMinimize.c (modified) (4 diffs)
-
src/image/psImageManip.c (modified) (4 diffs)
-
src/image/psImageStats.c (modified) (3 diffs)
-
src/imageops/psImageStats.c (modified) (3 diffs)
-
src/math/psConstants.h (modified) (3 diffs)
-
src/math/psMinimize.c (modified) (4 diffs)
-
src/math/psPolynomial.c (modified) (2 diffs)
-
src/math/psSpline.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrixVectorArithmetic02.c (modified) (5 diffs)
-
test/dataManip/tst_psVectorFFT.c (modified) (4 diffs)
-
test/image/tst_psImageFFT.c (modified) (2 diffs)
-
test/image/tst_psImageManip.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/pslib.kdevses
r3880 r3884 4 4 <DocsAndViews NumberOfDocuments="6" > 5 5 <Doc0 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/image/psImageManip.h" > 6 <View0 line="32"Type="Source" />6 <View0 Type="Source" /> 7 7 </Doc0> 8 8 <Doc1 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/image/psImageManip.c" > … … 10 10 </Doc1> 11 11 <Doc2 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/dataManip/psMatrix.c" > 12 <View0 line=" 377" Type="Source" />12 <View0 line="412" Type="Source" /> 13 13 </Doc2> 14 14 <Doc3 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/dataManip/psMatrix.h" > 15 15 <View0 line="0" Type="Source" /> 16 16 </Doc3> 17 <Doc4 NumberOfViews="1" URL="file:/// usr/include/gsl/gsl_linalg.h" >18 <View0 line=" 53" Type="Source" />17 <Doc4 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/test/dataManip/tst_psMatrix06.c" > 18 <View0 line="0" Type="Source" /> 19 19 </Doc4> 20 <Doc5 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/ src/dataManip/psConstants.h" >21 <View0 line=" 32" Type="Source" />20 <Doc5 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/test/dataManip/tst_psMinimize06.c" > 21 <View0 line="28" Type="Source" /> 22 22 </Doc5> 23 23 </DocsAndViews> -
trunk/psLib/src/astro/psCoord.c
r3715 r3884 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 4-19 05:46:24$12 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:15 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 326 326 { 327 327 while (angle < FLT_EPSILON) { 328 angle+= PS_PI*2;329 } 330 331 while (angle >= ( PS_PI*2)) {332 angle-= PS_PI*2;328 angle+=M_PI*2; 329 } 330 331 while (angle >= (M_PI*2)) { 332 angle-=M_PI*2; 333 333 } 334 334 return(angle); … … 509 509 } else if ( projection->type == PS_PROJ_PAR) { 510 510 out->x = phi*(2.0*cos(2.0*theta/3.0) - 1.0); 511 out->y = PS_PI*sin(theta/3.0);511 out->y = M_PI*sin(theta/3.0); 512 512 } else { 513 513 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 558 558 // Parabolic deprojection 559 559 } else if ( projection->type == PS_PROJ_PAR) { 560 psF64 rho = y/ PS_PI;560 psF64 rho = y/M_PI; 561 561 phi = x/(1.0 - 4.0*rho*rho); 562 562 theta = 3.0*asin(rho); … … 647 647 // Wrap these to an acceptable range. This assumes that all 648 648 // angles are in radians. 649 tmp->r = fmod(tmp->r, 2* PS_PI);650 tmp->d = fmod(tmp->d, 2* PS_PI);649 tmp->r = fmod(tmp->r, 2*M_PI); 650 tmp->d = fmod(tmp->d, 2*M_PI); 651 651 tmp->rErr = 0.0; 652 652 tmp->dErr = 0.0; … … 760 760 // Add offset and wrap to 0 to 2PI if necessary 761 761 tmp->r = position->r + tmpR; 762 tmp->r = fmod(tmp->r, 2.0* PS_PI);762 tmp->r = fmod(tmp->r, 2.0*M_PI); 763 763 tmp->d = position->d + tmpD; 764 tmp->d = fmod(tmp->d, 2.0* PS_PI);764 tmp->d = fmod(tmp->d, 2.0*M_PI); 765 765 tmp->rErr = 0.0; 766 766 tmp->dErr = 0.0; -
trunk/psLib/src/astro/psTime.c
r3712 r3884 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 4-19 02:13:53$12 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:15 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 43 43 44 44 /** Two times pi with double precision accuracy */ 45 #define TWOPI (2.0* PS_PI)45 #define TWOPI (2.0*M_PI) 46 46 47 47 /** Conversion from radians to degrees */ 48 #define R2DEG = (180.0/ PS_PI)48 #define R2DEG = (180.0/M_PI) 49 49 50 50 /** Maximum length of time string */ … … 563 563 564 564 t = 2000.0 + (mjd - 51544.03)/365.2422; 565 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0* PS_PI*t) + 0.007*cos(4.0*PS_PI*t);565 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*M_PI*t) + 0.007*cos(4.0*M_PI*t); 566 566 result = dut->data.F64[0] + dut->data.F64[1]*(mjd - dut->data.F64[2]) - dut2ut1; 567 567 … … 692 692 } 693 693 694 // Create output sphere and convert arcsec to radians (i.e. x/60/60* PS_PI/180)694 // Create output sphere and convert arcsec to radians (i.e. x/60/60*M_PI/180) 695 695 output = psAlloc(sizeof(psSphere)); 696 output->r = x * PS_PI / 648000.0;697 output->d = y * PS_PI / 648000.0;696 output->r = x * M_PI / 648000.0; 697 output->d = y * M_PI / 648000.0; 698 698 699 699 return output; -
trunk/psLib/src/astronomy/psCoord.c
r3715 r3884 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 4-19 05:46:24$12 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:15 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 326 326 { 327 327 while (angle < FLT_EPSILON) { 328 angle+= PS_PI*2;329 } 330 331 while (angle >= ( PS_PI*2)) {332 angle-= PS_PI*2;328 angle+=M_PI*2; 329 } 330 331 while (angle >= (M_PI*2)) { 332 angle-=M_PI*2; 333 333 } 334 334 return(angle); … … 509 509 } else if ( projection->type == PS_PROJ_PAR) { 510 510 out->x = phi*(2.0*cos(2.0*theta/3.0) - 1.0); 511 out->y = PS_PI*sin(theta/3.0);511 out->y = M_PI*sin(theta/3.0); 512 512 } else { 513 513 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 558 558 // Parabolic deprojection 559 559 } else if ( projection->type == PS_PROJ_PAR) { 560 psF64 rho = y/ PS_PI;560 psF64 rho = y/M_PI; 561 561 phi = x/(1.0 - 4.0*rho*rho); 562 562 theta = 3.0*asin(rho); … … 647 647 // Wrap these to an acceptable range. This assumes that all 648 648 // angles are in radians. 649 tmp->r = fmod(tmp->r, 2* PS_PI);650 tmp->d = fmod(tmp->d, 2* PS_PI);649 tmp->r = fmod(tmp->r, 2*M_PI); 650 tmp->d = fmod(tmp->d, 2*M_PI); 651 651 tmp->rErr = 0.0; 652 652 tmp->dErr = 0.0; … … 760 760 // Add offset and wrap to 0 to 2PI if necessary 761 761 tmp->r = position->r + tmpR; 762 tmp->r = fmod(tmp->r, 2.0* PS_PI);762 tmp->r = fmod(tmp->r, 2.0*M_PI); 763 763 tmp->d = position->d + tmpD; 764 tmp->d = fmod(tmp->d, 2.0* PS_PI);764 tmp->d = fmod(tmp->d, 2.0*M_PI); 765 765 tmp->rErr = 0.0; 766 766 tmp->dErr = 0.0; -
trunk/psLib/src/astronomy/psTime.c
r3712 r3884 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 4-19 02:13:53$12 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:15 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 43 43 44 44 /** Two times pi with double precision accuracy */ 45 #define TWOPI (2.0* PS_PI)45 #define TWOPI (2.0*M_PI) 46 46 47 47 /** Conversion from radians to degrees */ 48 #define R2DEG = (180.0/ PS_PI)48 #define R2DEG = (180.0/M_PI) 49 49 50 50 /** Maximum length of time string */ … … 563 563 564 564 t = 2000.0 + (mjd - 51544.03)/365.2422; 565 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0* PS_PI*t) + 0.007*cos(4.0*PS_PI*t);565 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*M_PI*t) + 0.007*cos(4.0*M_PI*t); 566 566 result = dut->data.F64[0] + dut->data.F64[1]*(mjd - dut->data.F64[2]) - dut2ut1; 567 567 … … 692 692 } 693 693 694 // Create output sphere and convert arcsec to radians (i.e. x/60/60* PS_PI/180)694 // Create output sphere and convert arcsec to radians (i.e. x/60/60*M_PI/180) 695 695 output = psAlloc(sizeof(psSphere)); 696 output->r = x * PS_PI / 648000.0;697 output->d = y * PS_PI / 648000.0;696 output->r = x * M_PI / 648000.0; 697 output->d = y * M_PI / 648000.0; 698 698 699 699 return output; -
trunk/psLib/src/dataManip/psConstants.h
r3880 r3884 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-05-11 02:29:39$8 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-11 22:02:16 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 */ 21 21 22 #include<math.h> // for M_PI 23 22 24 /***************************************************************************** 23 25 These constants are used by various functions in the psLib. … … 31 33 These are common mathimatical constants used by various functions in the psLib. 32 34 *****************************************************************************/ 33 #define PS_PI 3.1415926535897932384626433832795029 /* pi */ 34 #define PS_PI_2 1.5707963267948966192313216916397514 /* pi/2 */ 35 #define PS_PI_4 0.7853981633974483096156608458198757 /* pi/4 */ 36 #define PS_1_PI 0.3183098861837906715377675267450287 /* 1/pi */ 37 #define PS_2_PI 0.6366197723675813430755350534900574 /* 2/pi */ 38 39 #define DEG_TO_RAD(DEGREES) ((DEGREES) * PS_PI / 180.0) 40 #define MIN_TO_RAD(MINUTES) ((MINUTES) * PS_PI / (180.0 * 60.0)) 41 #define SEC_TO_RAD(SECONDS) ((SECONDS) * PS_PI / (180.0 * 60.0 * 60.0)) 42 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / PS_PI) 43 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / PS_PI) 44 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / PS_PI) 35 #ifndef M_PI 36 #define M_PI 3.1415926535897932384626433832795029 /* pi */ 37 #define M_PI_2 1.5707963267948966192313216916397514 /* pi/2 */ 38 #define M_PI_4 0.7853981633974483096156608458198757 /* pi/4 */ 39 #define M_1_PI 0.3183098861837906715377675267450287 /* 1/pi */ 40 #define M_2_PI 0.6366197723675813430755350534900574 /* 2/pi */ 41 #endif 42 43 #define DEG_TO_RAD(DEGREES) ((DEGREES) * M_PI / 180.0) 44 #define MIN_TO_RAD(MINUTES) ((MINUTES) * M_PI / (180.0 * 60.0)) 45 #define SEC_TO_RAD(SECONDS) ((SECONDS) * M_PI / (180.0 * 60.0 * 60.0)) 46 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / M_PI) 47 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / M_PI) 48 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / M_PI) 45 49 46 50 /***************************************************************************** -
trunk/psLib/src/dataManip/psFunctions.c
r3857 r3884 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.10 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-05- 05 22:33:14$9 * @version $Revision: 1.101 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-05-11 22:02:16 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1001 1001 1002 1002 if (normal == true) { 1003 tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));1003 tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma)); 1004 1004 } 1005 1005 -
trunk/psLib/src/dataManip/psMinimize.c
r3873 r3884 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.11 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-05-1 0 01:57:47$11 * @version $Revision: 1.116 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-05-11 22:02:16 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 541 541 psF64 flux = normalization * exp(-( u*u/(2.0 * sigmaX * sigmaX) + 542 542 v*v/(2.0 * sigmaY * sigmaY)))/ 543 (2.0 * PS_PI * sigmaX * sigmaY);543 (2.0 * M_PI * sigmaX * sigmaY); 544 544 out->data.F32[i] = flux; 545 545 … … 1204 1204 for (psS32 i=0;i<n;i++) { 1205 1205 // NR 5.8.4 1206 psF64 Y = cos( PS_PI * (0.5 + ((psF32) i)) / ((psF32) n));1206 psF64 Y = cos(M_PI * (0.5 + ((psF32) i)) / ((psF32) n)); 1207 1207 psF64 X = (Y + bma + bpa) - 1.0; 1208 1208 tmpScalar.data.F64 = X; … … 1232 1232 for (k=0;k<n;k++) { 1233 1233 sum+= f->data.F64[k] * 1234 cos( PS_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));1234 cos(M_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n)); 1235 1235 } 1236 1236 -
trunk/psLib/src/image/psImageManip.c
r3880 r3884 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-05-11 02:29:39$12 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:16 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 679 679 } 680 680 // put the angle in the range of 0...2PI. 681 angle = (float)((double)angle - (2.0* PS_PI) * floor(angle / (2.0*PS_PI)));682 683 if (fabsf(angle - PS_PI_2) < FLT_EPSILON) {681 angle = (float)((double)angle - (2.0*M_PI) * floor(angle / (2.0*M_PI))); 682 683 if (fabsf(angle - M_PI_2) < FLT_EPSILON) { 684 684 // perform 1/4 rotate counter-clockwise 685 685 psS32 numRows = in->numCols; … … 726 726 } 727 727 } 728 } else if (fabsf(angle - PS_PI) < FLT_EPSILON) {728 } else if (fabsf(angle - M_PI) < FLT_EPSILON) { 729 729 // perform 1/2 rotate 730 730 psS32 numRows = in->numRows; … … 772 772 } 773 773 } 774 } else if (fabsf(angle - ( PS_PI+PS_PI_2)) < FLT_EPSILON) {774 } else if (fabsf(angle - (M_PI+M_PI_2)) < FLT_EPSILON) { 775 775 // perform 1/4 rotate clockwise 776 776 psS32 numRows = in->numCols; -
trunk/psLib/src/image/psImageStats.c
r3714 r3884 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 4-19 04:16:02$11 * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-05-11 22:02:16 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 207 207 for (i = 0; i < n; i++) { 208 208 tmp = (double)(n - i); 209 tmp = ( PS_PI * (tmp - 0.5)) / ((double)n);209 tmp = (M_PI * (tmp - 0.5)) / ((double)n); 210 210 scalingFactors[i] = cos(tmp); 211 211 } … … 416 416 // Chebyshev polynomials are 0. 417 417 for (x = 0; x < input->numRows; x++) { 418 double xTmp = cos( PS_PI * (0.5 + ((float) x)) / ((float) input->numRows));418 double xTmp = cos(M_PI * (0.5 + ((float) x)) / ((float) input->numRows)); 419 419 double xNode = - ((xTmp + bma + bpa) - 1.0); 420 420 double xOrig = ((float) input->numRows) * (xNode - min) / (max - min); 421 421 422 422 for (y = 0; y < input->numCols; y++) { 423 double yTmp = cos( PS_PI * (0.5 + ((float) y)) / ((float) input->numCols));423 double yTmp = cos(M_PI * (0.5 + ((float) y)) / ((float) input->numCols)); 424 424 double yNode = - ((yTmp + bma + bpa) - 1.0); 425 425 double yOrig = ((float) input->numCols) * (yNode - min) / (max - min); -
trunk/psLib/src/imageops/psImageStats.c
r3714 r3884 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 4-19 04:16:02$11 * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-05-11 22:02:16 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 207 207 for (i = 0; i < n; i++) { 208 208 tmp = (double)(n - i); 209 tmp = ( PS_PI * (tmp - 0.5)) / ((double)n);209 tmp = (M_PI * (tmp - 0.5)) / ((double)n); 210 210 scalingFactors[i] = cos(tmp); 211 211 } … … 416 416 // Chebyshev polynomials are 0. 417 417 for (x = 0; x < input->numRows; x++) { 418 double xTmp = cos( PS_PI * (0.5 + ((float) x)) / ((float) input->numRows));418 double xTmp = cos(M_PI * (0.5 + ((float) x)) / ((float) input->numRows)); 419 419 double xNode = - ((xTmp + bma + bpa) - 1.0); 420 420 double xOrig = ((float) input->numRows) * (xNode - min) / (max - min); 421 421 422 422 for (y = 0; y < input->numCols; y++) { 423 double yTmp = cos( PS_PI * (0.5 + ((float) y)) / ((float) input->numCols));423 double yTmp = cos(M_PI * (0.5 + ((float) y)) / ((float) input->numCols)); 424 424 double yNode = - ((yTmp + bma + bpa) - 1.0); 425 425 double yOrig = ((float) input->numCols) * (yNode - min) / (max - min); -
trunk/psLib/src/math/psConstants.h
r3880 r3884 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-05-11 02:29:39$8 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-11 22:02:16 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 */ 21 21 22 #include<math.h> // for M_PI 23 22 24 /***************************************************************************** 23 25 These constants are used by various functions in the psLib. … … 31 33 These are common mathimatical constants used by various functions in the psLib. 32 34 *****************************************************************************/ 33 #define PS_PI 3.1415926535897932384626433832795029 /* pi */ 34 #define PS_PI_2 1.5707963267948966192313216916397514 /* pi/2 */ 35 #define PS_PI_4 0.7853981633974483096156608458198757 /* pi/4 */ 36 #define PS_1_PI 0.3183098861837906715377675267450287 /* 1/pi */ 37 #define PS_2_PI 0.6366197723675813430755350534900574 /* 2/pi */ 38 39 #define DEG_TO_RAD(DEGREES) ((DEGREES) * PS_PI / 180.0) 40 #define MIN_TO_RAD(MINUTES) ((MINUTES) * PS_PI / (180.0 * 60.0)) 41 #define SEC_TO_RAD(SECONDS) ((SECONDS) * PS_PI / (180.0 * 60.0 * 60.0)) 42 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / PS_PI) 43 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / PS_PI) 44 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / PS_PI) 35 #ifndef M_PI 36 #define M_PI 3.1415926535897932384626433832795029 /* pi */ 37 #define M_PI_2 1.5707963267948966192313216916397514 /* pi/2 */ 38 #define M_PI_4 0.7853981633974483096156608458198757 /* pi/4 */ 39 #define M_1_PI 0.3183098861837906715377675267450287 /* 1/pi */ 40 #define M_2_PI 0.6366197723675813430755350534900574 /* 2/pi */ 41 #endif 42 43 #define DEG_TO_RAD(DEGREES) ((DEGREES) * M_PI / 180.0) 44 #define MIN_TO_RAD(MINUTES) ((MINUTES) * M_PI / (180.0 * 60.0)) 45 #define SEC_TO_RAD(SECONDS) ((SECONDS) * M_PI / (180.0 * 60.0 * 60.0)) 46 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / M_PI) 47 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / M_PI) 48 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / M_PI) 45 49 46 50 /***************************************************************************** -
trunk/psLib/src/math/psMinimize.c
r3873 r3884 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.11 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-05-1 0 01:57:47$11 * @version $Revision: 1.116 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-05-11 22:02:16 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 541 541 psF64 flux = normalization * exp(-( u*u/(2.0 * sigmaX * sigmaX) + 542 542 v*v/(2.0 * sigmaY * sigmaY)))/ 543 (2.0 * PS_PI * sigmaX * sigmaY);543 (2.0 * M_PI * sigmaX * sigmaY); 544 544 out->data.F32[i] = flux; 545 545 … … 1204 1204 for (psS32 i=0;i<n;i++) { 1205 1205 // NR 5.8.4 1206 psF64 Y = cos( PS_PI * (0.5 + ((psF32) i)) / ((psF32) n));1206 psF64 Y = cos(M_PI * (0.5 + ((psF32) i)) / ((psF32) n)); 1207 1207 psF64 X = (Y + bma + bpa) - 1.0; 1208 1208 tmpScalar.data.F64 = X; … … 1232 1232 for (k=0;k<n;k++) { 1233 1233 sum+= f->data.F64[k] * 1234 cos( PS_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));1234 cos(M_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n)); 1235 1235 } 1236 1236 -
trunk/psLib/src/math/psPolynomial.c
r3857 r3884 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.10 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-05- 05 22:33:14$9 * @version $Revision: 1.101 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-05-11 22:02:16 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1001 1001 1002 1002 if (normal == true) { 1003 tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));1003 tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma)); 1004 1004 } 1005 1005 -
trunk/psLib/src/math/psSpline.c
r3857 r3884 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.10 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-05- 05 22:33:14$9 * @version $Revision: 1.101 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-05-11 22:02:16 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1001 1001 1002 1002 if (normal == true) { 1003 tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));1003 tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma)); 1004 1004 } 1005 1005 -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c
r3682 r3884 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 4-07 20:27:42$12 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-05-11 22:02:16 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 131 131 testUnaryOpM( log, F64, 1000.0, 0.0, 3, 2, 3 ); 132 132 testUnaryOpM( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 2, 3 ); 133 testUnaryOpM( sin, S32, PS_PI_2, 0, 3, 2, 1 );134 testUnaryOpM( sin, F32, PS_PI_2, 0.0, 3, 2, 1.0 );135 testUnaryOpM( sin, F64, PS_PI_2, 0.0, 3, 2, 1.0 );136 testUnaryOpM( sin, C32, PS_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );133 testUnaryOpM( sin, S32, M_PI_2, 0, 3, 2, 1 ); 134 testUnaryOpM( sin, F32, M_PI_2, 0.0, 3, 2, 1.0 ); 135 testUnaryOpM( sin, F64, M_PI_2, 0.0, 3, 2, 1.0 ); 136 testUnaryOpM( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 ); 137 137 testUnaryOpM( dsin, S32, 90, 0, 3, 2 , 1); 138 138 testUnaryOpM( dsin, F32, 90.0, 0.0, 3, 2, 1.0 ); … … 147 147 testUnaryOpM( dcos, F64, 0.0, 0.0, 3, 2, 1.0 ); 148 148 testUnaryOpM( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 ); 149 testUnaryOpM( tan, S32, PS_PI_4, 0, 3, 2, 1);150 testUnaryOpM( tan, F32, PS_PI_4, 0.0, 3, 2, 1.0 );151 testUnaryOpM( tan, F64, PS_PI_4, 0.0, 3, 2, 1.0 );152 testUnaryOpM( tan, C32, PS_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1 );149 testUnaryOpM( tan, S32, M_PI_4, 0, 3, 2, 1); 150 testUnaryOpM( tan, F32, M_PI_4, 0.0, 3, 2, 1.0 ); 151 testUnaryOpM( tan, F64, M_PI_4, 0.0, 3, 2, 1.0 ); 152 testUnaryOpM( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1 ); 153 153 testUnaryOpM( dtan, S32, 45, 0, 3, 2, 1 ); 154 154 testUnaryOpM( dtan, F32, 45.0, 0.0, 3, 2, 1.0 ); 155 155 testUnaryOpM( dtan, F64, 45.0, 0.0, 3, 2, 1.0 ); 156 156 testUnaryOpM( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 2, 1.0 ); 157 testUnaryOpM( asin, S32, 1, 0, 3, 2, PS_PI_2);158 testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, PS_PI_2 );159 testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, PS_PI_2);160 testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, PS_PI_2);157 testUnaryOpM( asin, S32, 1, 0, 3, 2, M_PI_2); 158 testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, M_PI_2 ); 159 testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, M_PI_2); 160 testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, M_PI_2); 161 161 testUnaryOpM( dasin, S32, 1.0, 0, 3, 2, 90 ); 162 162 testUnaryOpM( dasin, F32, 1.0, 0.0, 3, 2, 90.0 ); 163 163 testUnaryOpM( dasin, F64, 1.0, 0.0, 3, 2, 90.0 ); 164 164 testUnaryOpM( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, 90.0 ); 165 testUnaryOpM( acos, S32, 0, 0, 3, 2, PS_PI_2);166 testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, PS_PI_2 );167 testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, PS_PI_2 );168 testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, PS_PI_2 );165 testUnaryOpM( acos, S32, 0, 0, 3, 2, M_PI_2); 166 testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, M_PI_2 ); 167 testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, M_PI_2 ); 168 testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_2 ); 169 169 testUnaryOpM( dacos, S32, 0, 0, 3, 2, 90 ); 170 170 testUnaryOpM( dacos, F32, 0.0, 0.0, 3, 2, 90.0 ); 171 171 testUnaryOpM( dacos, F64, 0.0, 0.0, 3, 2, 90.0 ); 172 172 testUnaryOpM( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 90.0 ); 173 testUnaryOpM( atan, S32, 1, 0, 3, 2, PS_PI_4);174 testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, PS_PI_4 );175 testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, PS_PI_4);176 testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, PS_PI_4);173 testUnaryOpM( atan, S32, 1, 0, 3, 2, M_PI_4); 174 testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, M_PI_4 ); 175 testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, M_PI_4); 176 testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_4); 177 177 testUnaryOpM( datan, S32, 1, 0, 3, 2, 45 ); 178 178 testUnaryOpM( datan, F32, 1.0, 0.0, 3, 2, 45.0 ); … … 216 216 testUnaryOpV( log, F64, 1000.0, 0.0, 3, 3 ); 217 217 testUnaryOpV( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 3 ); 218 testUnaryOpV( sin, S32, PS_PI_2, 0, 3, 1 );219 testUnaryOpV( sin, F32, PS_PI_2, 0.0, 3, 1.0 );220 testUnaryOpV( sin, F64, PS_PI_2, 0.0, 3, 1.0 );221 testUnaryOpV( sin, C32, PS_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0 );218 testUnaryOpV( sin, S32, M_PI_2, 0, 3, 1 ); 219 testUnaryOpV( sin, F32, M_PI_2, 0.0, 3, 1.0 ); 220 testUnaryOpV( sin, F64, M_PI_2, 0.0, 3, 1.0 ); 221 testUnaryOpV( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0 ); 222 222 testUnaryOpV( dsin, S32, 90, 0, 3, 1); 223 223 testUnaryOpV( dsin, F32, 90.0, 0.0, 3, 1.0 ); … … 232 232 testUnaryOpV( dcos, F64, 0.0, 0.0, 3, 1.0 ); 233 233 testUnaryOpV( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0 ); 234 testUnaryOpV( tan, S32, PS_PI_4, 0, 3, 1);235 testUnaryOpV( tan, F32, PS_PI_4, 0.0, 3, 1.0 );236 testUnaryOpV( tan, F64, PS_PI_4, 0.0, 3, 1.0 );237 testUnaryOpV( tan, C32, PS_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1 );234 testUnaryOpV( tan, S32, M_PI_4, 0, 3, 1); 235 testUnaryOpV( tan, F32, M_PI_4, 0.0, 3, 1.0 ); 236 testUnaryOpV( tan, F64, M_PI_4, 0.0, 3, 1.0 ); 237 testUnaryOpV( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1 ); 238 238 testUnaryOpV( dtan, S32, 45, 0, 3, 1 ); 239 239 testUnaryOpV( dtan, F32, 45.0, 0.0, 3, 1.0 ); 240 240 testUnaryOpV( dtan, F64, 45.0, 0.0, 3, 1.0 ); 241 241 testUnaryOpV( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 1.0 ); 242 testUnaryOpV( asin, S32, 1, 0, 3, PS_PI_2);243 testUnaryOpV( asin, F32, 1.0, 0.0, 3, PS_PI_2 );244 testUnaryOpV( asin, F64, 1.0, 0.0, 3, PS_PI_2);245 testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, PS_PI_2);242 testUnaryOpV( asin, S32, 1, 0, 3, M_PI_2); 243 testUnaryOpV( asin, F32, 1.0, 0.0, 3, M_PI_2 ); 244 testUnaryOpV( asin, F64, 1.0, 0.0, 3, M_PI_2); 245 testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, M_PI_2); 246 246 testUnaryOpV( dasin, S32, 1.0, 0, 3, 90 ); 247 247 testUnaryOpV( dasin, F32, 1.0, 0.0, 3, 90.0 ); 248 248 testUnaryOpV( dasin, F64, 1.0, 0.0, 3, 90.0 ); 249 249 testUnaryOpV( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 90.0 ); 250 testUnaryOpV( acos, S32, 0, 0, 3, PS_PI_2);251 testUnaryOpV( acos, F32, 0.0, 0.0, 3, PS_PI_2 );252 testUnaryOpV( acos, F64, 0.0, 0.0, 3, PS_PI_2 );253 testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, PS_PI_2 );250 testUnaryOpV( acos, S32, 0, 0, 3, M_PI_2); 251 testUnaryOpV( acos, F32, 0.0, 0.0, 3, M_PI_2 ); 252 testUnaryOpV( acos, F64, 0.0, 0.0, 3, M_PI_2 ); 253 testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_2 ); 254 254 testUnaryOpV( dacos, S32, 0, 0, 3, 90 ); 255 255 testUnaryOpV( dacos, F32, 0.0, 0.0, 3, 90.0 ); 256 256 testUnaryOpV( dacos, F64, 0.0, 0.0, 3, 90.0 ); 257 257 testUnaryOpV( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 90.0 ); 258 testUnaryOpV( atan, S32, 1, 0, 3, PS_PI_4);259 testUnaryOpV( atan, F32, 1.0, 0.0, 3, PS_PI_4 );260 testUnaryOpV( atan, F64, 1.0, 0.0, 3, PS_PI_4);261 testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, PS_PI_4);258 testUnaryOpV( atan, S32, 1, 0, 3, M_PI_4); 259 testUnaryOpV( atan, F32, 1.0, 0.0, 3, M_PI_4 ); 260 testUnaryOpV( atan, F64, 1.0, 0.0, 3, M_PI_4); 261 testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_4); 262 262 testUnaryOpV( datan, S32, 1, 0, 3, 45 ); 263 263 testUnaryOpV( datan, F32, 1.0, 0.0, 3, 45.0 ); -
trunk/psLib/test/dataManip/tst_psVectorFFT.c
r3682 r3884 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 4-07 20:27:42$8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-11 22:02:16 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 68 68 vec->n = vec->nalloc; 69 69 for ( psU32 n = 0; n < 100; n++ ) { 70 vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * PS_PI );70 vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * M_PI ); 71 71 } 72 72 … … 111 111 } 112 112 for ( psU32 n = 0; n < 100; n++ ) { 113 psF32 val = sinf( ( psF32 ) n / 50.0f * PS_PI );113 psF32 val = sinf( ( psF32 ) n / 50.0f * M_PI ); 114 114 psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100; 115 115 if ( fabsf( vecVal - val ) > 0.1f ) { … … 548 548 vec3->n = vec3->nalloc; 549 549 for ( psU32 n = 0; n < 100; n++ ) { 550 vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * PS_PI );551 vec3->data.C64[ n ] = n + I * sinf( ( ( psF64 ) n ) / 50.f * PS_PI );550 vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * M_PI ); 551 vec3->data.C64[ n ] = n + I * sinf( ( ( psF64 ) n ) / 50.f * M_PI ); 552 552 } 553 553 -
trunk/psLib/test/image/tst_psImageFFT.c
r3702 r3884 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 4-15 00:12:09$8 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-11 22:02:16 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 68 68 69 69 // 1. assign a image to a radial sinisoid 70 GENIMAGE(img,m,n,F32, sinf((32.0f-row)/32.0f* PS_PI)+sinf((64.0f-col)/64.0f*PS_PI));70 GENIMAGE(img,m,n,F32, sinf((32.0f-row)/32.0f*M_PI)+sinf((64.0f-col)/64.0f*M_PI)); 71 71 72 72 // 2. perform a forward transform -
trunk/psLib/test/image/tst_psImageManip.c
r3682 r3884 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 4-07 20:27:42$8 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-11 22:02:16 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1315 1315 1316 1316 if (rot == 90) { 1317 radianRot = PS_PI_2;1317 radianRot = M_PI_2; 1318 1318 } else if (rot == -90) { 1319 radianRot = PS_PI+PS_PI_2;1319 radianRot = M_PI+M_PI_2; 1320 1320 } else if (rot == 180 || rot == -180) { 1321 radianRot = PS_PI;1321 radianRot = M_PI; 1322 1322 } else { 1323 radianRot = ((float)rot)* PS_PI/180.0;1323 radianRot = ((float)rot)*M_PI/180.0; 1324 1324 } 1325 1325
Note:
See TracChangeset
for help on using the changeset viewer.
