Commit 8888bb8d authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed issue with FFTW configure for custom library paths.

Fixed compilation warnings in pattern.c and lm.h.
Pushed version number to 2.9.9.
parent 63f8b6c5
...@@ -24,7 +24,7 @@ if test x$2 = x; then ...@@ -24,7 +24,7 @@ if test x$2 = x; then
if test x$1 = x; then if test x$1 = x; then
AC_CHECK_HEADER(fftw3.h,[acx_fftw_ok=yes]) AC_CHECK_HEADER(fftw3.h,[acx_fftw_ok=yes])
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
AC_DEFINE(FFTW_H, "fftw.h", [FFTW header filename.]) AC_DEFINE(FFTW_H, "fftw3.h", [FFTW header filename.])
else else
AC_CHECK_HEADER(fftw/fftw3.h,[acx_fftw_ok=yes]) AC_CHECK_HEADER(fftw/fftw3.h,[acx_fftw_ok=yes])
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
...@@ -36,11 +36,11 @@ if test x$2 = x; then ...@@ -36,11 +36,11 @@ if test x$2 = x; then
else else
AC_CHECK_HEADER($1/include/fftw3.h,[acx_fftw_ok=yes]) AC_CHECK_HEADER($1/include/fftw3.h,[acx_fftw_ok=yes])
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
AC_DEFINE(FFTW_H, "$1/include/fftw3.h", [FFTW header filename.]) AC_DEFINE(FFTW_H, $1"/include/fftw3.h, [FFTW header filename.])
else else
AC_CHECK_HEADER(fftw3.h,[acx_fftw_ok=yes]) AC_CHECK_HEADER(fftw3.h,[acx_fftw_ok=yes])
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
AC_DEFINE(FFTW_H, "fftw.h", [FFTW header filename.]) AC_DEFINE(FFTW_H, "fftw3.h", [FFTW header filename.])
else else
FFTW_ERROR="FFTW include files not found in $1/include!" FFTW_ERROR="FFTW include files not found in $1/include!"
fi fi
...@@ -49,7 +49,7 @@ if test x$2 = x; then ...@@ -49,7 +49,7 @@ if test x$2 = x; then
else else
AC_CHECK_HEADER($2/fftw3.h,[acx_fftw_ok=yes]) AC_CHECK_HEADER($2/fftw3.h,[acx_fftw_ok=yes])
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
AC_DEFINE(FFTW_H, "$2/fftw3.h", [FFTW header filename.]) AC_DEFINE_UNQUOTED(FFTW_H, "$2/fftw3.h", [FFTW header filename.])
else else
FFTW_ERROR="FFTW include files not found in $2!" FFTW_ERROR="FFTW include files not found in $2!"
fi fi
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for sextractor 2.9.8. # Generated by GNU Autoconf 2.63 for sextractor 2.9.9.
# #
# Report bugs to <bertin@iap.fr>. # Report bugs to <bertin@iap.fr>.
# #
...@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sextractor' PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor' PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.9.8' PACKAGE_VERSION='2.9.9'
PACKAGE_STRING='sextractor 2.9.8' PACKAGE_STRING='sextractor 2.9.9'
PACKAGE_BUGREPORT='bertin@iap.fr' PACKAGE_BUGREPORT='bertin@iap.fr'
   
ac_unique_file="src/makeit.c" ac_unique_file="src/makeit.c"
...@@ -1505,7 +1505,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1505,7 +1505,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sextractor 2.9.8 to adapt to many kinds of systems. \`configure' configures sextractor 2.9.9 to adapt to many kinds of systems.
   
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
   
...@@ -1575,7 +1575,7 @@ fi ...@@ -1575,7 +1575,7 @@ fi
   
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.9.8:";; short | recursive ) echo "Configuration of sextractor 2.9.9:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
   
...@@ -1706,7 +1706,7 @@ fi ...@@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sextractor configure 2.9.8 sextractor configure 2.9.9
generated by GNU Autoconf 2.63 generated by GNU Autoconf 2.63
   
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
...@@ -1720,7 +1720,7 @@ cat >config.log <<_ACEOF ...@@ -1720,7 +1720,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
   
It was created by sextractor $as_me 2.9.8, which was It was created by sextractor $as_me 2.9.9, which was
generated by GNU Autoconf 2.63. Invocation command line was generated by GNU Autoconf 2.63. Invocation command line was
   
$ $0 $@ $ $0 $@
...@@ -2423,7 +2423,7 @@ fi ...@@ -2423,7 +2423,7 @@ fi
   
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sextractor' PACKAGE='sextractor'
VERSION='2.9.8' VERSION='2.9.9'
   
   
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -20934,7 +20934,7 @@ fi ...@@ -20934,7 +20934,7 @@ fi
   
done done
   
if test $enable_icc = "yes" -a $CC = "icc"; then if test "$enable_icc" = "yes" -a "$CC" = "icc"; then
   
for ac_header in mathimf.h for ac_header in mathimf.h
do do
...@@ -24140,7 +24140,7 @@ fi ...@@ -24140,7 +24140,7 @@ fi
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
   
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define FFTW_H "fftw.h" #define FFTW_H "fftw3.h"
_ACEOF _ACEOF
   
else else
...@@ -24439,7 +24439,7 @@ fi ...@@ -24439,7 +24439,7 @@ fi
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
   
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define FFTW_H "$fftw_libdir/include/fftw3.h" #define FFTW_H $fftw_libdir"/include/fftw3.h
_ACEOF _ACEOF
   
else else
...@@ -24583,7 +24583,7 @@ fi ...@@ -24583,7 +24583,7 @@ fi
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
   
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define FFTW_H "fftw.h" #define FFTW_H "fftw3.h"
_ACEOF _ACEOF
   
else else
...@@ -24738,7 +24738,7 @@ fi ...@@ -24738,7 +24738,7 @@ fi
   
if test x$acx_fftw_ok = xyes; then if test x$acx_fftw_ok = xyes; then
   
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<_ACEOF
#define FFTW_H "$fftw_incdir/fftw3.h" #define FFTW_H "$fftw_incdir/fftw3.h"
_ACEOF _ACEOF
   
...@@ -28535,7 +28535,7 @@ exec 6>&1 ...@@ -28535,7 +28535,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sextractor $as_me 2.9.8, which was This file was extended by sextractor $as_me 2.9.9, which was
generated by GNU Autoconf 2.63. Invocation command line was generated by GNU Autoconf 2.63. Invocation command line was
   
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -28598,7 +28598,7 @@ Report bugs to <bug-autoconf@gnu.org>." ...@@ -28598,7 +28598,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
sextractor config.status 2.9.8 sextractor config.status 2.9.9
configured by $0, generated by GNU Autoconf 2.63, configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
   
......
...@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],) ...@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],) define([AC_CACHE_SAVE],)
# This is your standard Bertin source code... # This is your standard Bertin source code...
AC_INIT(sextractor, 2.9.8, [bertin@iap.fr]) AC_INIT(sextractor, 2.9.9, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c) AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
...@@ -74,7 +74,7 @@ AC_CHECK_LIB(m, sin) ...@@ -74,7 +74,7 @@ AC_CHECK_LIB(m, sin)
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \ AC_CHECK_HEADERS([fcntl.h limits.h malloc.h stdlib.h string.h sys/mman.h \
sys/types.h unistd.h]) sys/types.h unistd.h])
if test $enable_icc = "yes" -a $CC = "icc"; then if test "$enable_icc" = "yes" -a "$CC" = "icc"; then
AC_CHECK_HEADERS(mathimf.h) AC_CHECK_HEADERS(mathimf.h)
fi fi
......
.TH SEXTRACTOR "1" "November 2009" "SWarp 2.9.8" "User Commands" .TH SEXTRACTOR "1" "November 2009" "SWarp 2.9.9" "User Commands"
.SH NAME .SH NAME
sex \- extract a source catalog from an astronomical FITS image sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS .SH SYNOPSIS
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: Routines dealing with float precision FFT. * Contents: Routines dealing with float precision FFT.
* *
* Last modify: 08/10/2009 * Last modify: 17/11/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <fftw3.h> #include FFTW_H
#include "define.h" #include "define.h"
#include "globals.h" #include "globals.h"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
/* specify whether to use LAPACK or not. The first option is strongly recommended */ /* specify whether to use LAPACK or not. The first option is strongly recommended */
#define HAVE_LAPACK /* use LAPACK */ #define HAVE_LAPACK /* use LAPACK */
#undef HAVE_LAPACK */ /* uncomment this to force not using LAPACK */ #undef HAVE_LAPACK /* uncomment this to force not using LAPACK */
/* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to /* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to
* retain working memory between calls. Such a choice, however, renders these routines * retain working memory between calls. Such a choice, however, renders these routines
......
...@@ -53,7 +53,7 @@ INPUT Pointer to a profit structure, ...@@ -53,7 +53,7 @@ INPUT Pointer to a profit structure,
OUTPUT Pointer to the new pattern structure. OUTPUT Pointer to the new pattern structure.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 19/11/2008 VERSION 18/11/2009
***/ ***/
patternstruct *pattern_init(profitstruct *profit, pattypenum ptype, int ncomp) patternstruct *pattern_init(profitstruct *profit, pattypenum ptype, int ncomp)
{ {
...@@ -91,18 +91,18 @@ patternstruct *pattern_init(profitstruct *profit, pattypenum ptype, int ncomp) ...@@ -91,18 +91,18 @@ patternstruct *pattern_init(profitstruct *profit, pattypenum ptype, int ncomp)
ninpix = pattern->size[0]*pattern->size[1] * pattern->size[2]; ninpix = pattern->size[0]*pattern->size[1] * pattern->size[2];
noutpix = profit->objnaxisn[0]*profit->objnaxisn[1] * pattern->size[2]; noutpix = profit->objnaxisn[0]*profit->objnaxisn[1] * pattern->size[2];
QMALLOC(pattern->coeff, double, pattern->size[2]); QMALLOC(pattern->coeff, float, pattern->size[2]);
QMALLOC(pattern->norm, double, pattern->size[2]); QMALLOC(pattern->norm, float, pattern->size[2]);
QMALLOC(pattern->modpix, double, ninpix); QMALLOC(pattern->modpix, float, ninpix);
QMALLOC(pattern->lmodpix, PIXTYPE, noutpix); QMALLOC(pattern->lmodpix, PIXTYPE, noutpix);
if (pattern->ncomp) if (pattern->ncomp)
{ {
QMALLOC(pattern->r, double, pattern->ncomp); QMALLOC(pattern->r, float, pattern->ncomp);
} }
if (pattern->nfreq) if (pattern->nfreq)
{ {
QMALLOC(pattern->mcoeff, double, ncomp*pattern->nfreq); QMALLOC(pattern->mcoeff, float, ncomp*pattern->nfreq);
QMALLOC(pattern->acoeff, double, ncomp*pattern->nfreq); QMALLOC(pattern->acoeff, float, ncomp*pattern->nfreq);
} }
return pattern; return pattern;
...@@ -140,13 +140,14 @@ INPUT Pointer to pattern structure. ...@@ -140,13 +140,14 @@ INPUT Pointer to pattern structure.
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 18/03/2009 VERSION 18/11/2009
***/ ***/
void pattern_fit(patternstruct *pattern, profitstruct *profit) void pattern_fit(patternstruct *pattern, profitstruct *profit)
{ {
checkstruct *check; checkstruct *check;
double *inpix, *doutpix1, *alpha,*beta, double *alpha,*beta,*betat,
dval, dprod; dval, dprod;
float *inpix, *doutpix1, *coefft;
PIXTYPE *outpix,*outpix1,*outpix2; PIXTYPE *outpix,*outpix1,*outpix2;
PIXTYPE *weightpix; PIXTYPE *weightpix;
int n,p,p2, nvec, ninpix, noutpix; int n,p,p2, nvec, ninpix, noutpix;
...@@ -154,7 +155,7 @@ void pattern_fit(patternstruct *pattern, profitstruct *profit) ...@@ -154,7 +155,7 @@ void pattern_fit(patternstruct *pattern, profitstruct *profit)
nvec = pattern->size[2]; nvec = pattern->size[2];
pattern_create(pattern, profit); pattern_create(pattern, profit);
QMALLOC(alpha, double, nvec*nvec); QMALLOC(alpha, double, nvec*nvec);
beta = pattern->coeff; QMALLOC(beta, double, nvec);
inpix = pattern->modpix; inpix = pattern->modpix;
ninpix = pattern->size[0]*pattern->size[1]; ninpix = pattern->size[0]*pattern->size[1];
outpix = pattern->lmodpix; outpix = pattern->lmodpix;
...@@ -199,10 +200,15 @@ void pattern_fit(patternstruct *pattern, profitstruct *profit) ...@@ -199,10 +200,15 @@ void pattern_fit(patternstruct *pattern, profitstruct *profit)
/* Solve the system */ /* Solve the system */
clapack_dpotrf(CblasRowMajor,CblasUpper,nvec,alpha,nvec); clapack_dpotrf(CblasRowMajor,CblasUpper,nvec,alpha,nvec);
clapack_dpotrs(CblasRowMajor,CblasUpper,nvec,1,alpha,nvec,beta,nvec); clapack_dpotrs(CblasRowMajor,CblasUpper,nvec,1,alpha,nvec,beta,nvec);
betat = beta;
coefft = pattern->coeff;
for (p=nvec; p--;)
*(coefft++) = (float)*(betat++);
pattern_compmodarg(pattern, profit); pattern_compmodarg(pattern, profit);
free(alpha); free(alpha);
free(beta);
if ((check = prefs.check[CHECK_PATTERNS])) if ((check = prefs.check[CHECK_PATTERNS]))
{ {
...@@ -280,7 +286,7 @@ VERSION 20/11/2008 ...@@ -280,7 +286,7 @@ VERSION 20/11/2008
***/ ***/
void pattern_compmodarg(patternstruct *pattern, profitstruct *profit) void pattern_compmodarg(patternstruct *pattern, profitstruct *profit)
{ {
double *coeff,*mcoeff,*acoeff, *normt, float *coeff,*mcoeff,*acoeff, *normt,
arg,argo,darg, ima,rea; arg,argo,darg, ima,rea;
int f,p, nfreq; int f,p, nfreq;
...@@ -388,13 +394,12 @@ INPUT Pointer to pattern structure, ...@@ -388,13 +394,12 @@ INPUT Pointer to pattern structure,
OUTPUT -. OUTPUT -.
NOTES -. NOTES -.
AUTHOR E. Bertin (IAP) AUTHOR E. Bertin (IAP)
VERSION 20/11/2008 VERSION 18/11/2009
***/ ***/
void pattern_create(patternstruct *pattern, profitstruct *profit) void pattern_create(patternstruct *pattern, profitstruct *profit)
{ {
double *scbuf[PATTERN_FMAX],*scpix[PATTERN_FMAX], double *scbuf[PATTERN_FMAX],*scpix[PATTERN_FMAX],
*scpixt,*cpix,*spix, *pix, *r2buf,*r2pix,*modpix, *scpixt,*r2buf,*r2pix,
*normt, *pmodpix,
x1,x2, x1t,x2t, r,r2,r2min,r2max, x1,x2, x1t,x2t, r,r2,r2min,r2max,
mod,ang,ang0, cosang,sinang, angcoeff, posangle,flux, mod,ang,ang0, cosang,sinang, angcoeff, posangle,flux,
ctheta,stheta, saspect,xscale,yscale, scale, aspect, ctheta,stheta, saspect,xscale,yscale, scale, aspect,
...@@ -406,6 +411,8 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -406,6 +411,8 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
double *fr2,*fr2t,*fexpr2,*fexpr2t,*ftheta,*fthetat, double *fr2,*fr2t,*fexpr2,*fexpr2t,*ftheta,*fthetat,
dm,fac, beta, invbeta2; dm,fac, beta, invbeta2;
float *normt, *cpix,*spix, *pmodpix,*pix,*modpix,
fnorm;
int m,n, nmax, kmax,hnmm; int m,n, nmax, kmax,hnmm;
/* Compute Profile CD matrix */ /* Compute Profile CD matrix */
...@@ -513,12 +520,12 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -513,12 +520,12 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
sinang = sin(ang); sinang = sin(ang);
cosang = cos(ang); cosang = cos(ang);
#endif #endif
*(cpix++) = cmod = mod*cosang; *(cpix++) = (float)(cmod = mod*cosang);
*(spix++) = smod = mod*sinang; *(spix++) = (float)(smod = mod*sinang);
cnorm += cmod*cmod; cnorm += cmod*cmod;
snorm += smod*smod; snorm += smod*smod;
cpnorm += cmod*cmod**pmodpix**pmodpix; cpnorm += cmod*cmod*(double)(*pmodpix**pmodpix);
spnorm += smod*smod**pmodpix**pmodpix; spnorm += smod*smod*(double)(*pmodpix**pmodpix);
} }
else else
*(cpix++) = *(spix++) = 0.0; *(cpix++) = *(spix++) = 0.0;
...@@ -528,7 +535,7 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -528,7 +535,7 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
} }
cpix -= npix; cpix -= npix;
cnorm = (cnorm > 0.0? 1.0/sqrt(cnorm) : 1.0); cnorm = (cnorm > 0.0? 1.0/sqrt(cnorm) : 1.0);
*(normt++) = cnorm*sqrt(cpnorm); *(normt++) = (float)cnorm*sqrt(cpnorm);
for (i=npix; i--;) for (i=npix; i--;)
*(cpix++) *= cnorm; *(cpix++) *= cnorm;
spix -= npix; spix -= npix;
...@@ -596,8 +603,8 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -596,8 +603,8 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
{ {
r = sqrt(r2); r = sqrt(r2);
dval = (r<r0) ? (r-rl)/(r0-rl) : (rh-r)/(rh-r0); dval = (r<r0) ? (r-rl)/(r0-rl) : (rh-r)/(rh-r0);
*(pix++) = dval = (dval<0.5)? *(pix++) = (float)(dval = (dval<0.5)?
2.0*dval*dval : 1.0-2.0*(1.0-dval)*(1.0-dval); 2.0*dval*dval : 1.0-2.0*(1.0-dval)*(1.0-dval));
norm += dval*dval; norm += dval*dval;
} }
else else
...@@ -607,8 +614,9 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -607,8 +614,9 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
pnorm = norm*sbd*sbd; pnorm = norm*sbd*sbd;
norm0 = norm = (norm > 1.0/BIG? 1.0/sqrt(norm) : 1.0); norm0 = norm = (norm > 1.0/BIG? 1.0/sqrt(norm) : 1.0);
*(normt++) = pnorm > 1.0/BIG? 1.0/sqrt(pnorm) : 0.0; *(normt++) = pnorm > 1.0/BIG? 1.0/sqrt(pnorm) : 0.0;
fnorm = (float)norm;
for (i=npix; i--;) for (i=npix; i--;)
*(pix++) *= norm; *(pix++) *= fnorm;
modpix = pix; modpix = pix;
} }
else else
...@@ -617,22 +625,23 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -617,22 +625,23 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
scpixt = scbuf[f-1]; scpixt = scbuf[f-1];
for (i=npix; i--; pmodpix++) for (i=npix; i--; pmodpix++)
{ {
*(pix++) = dval = *(modpix++)**(scpixt++); *(pix++) = (float)(dval = *(modpix++)**(scpixt++));
norm += dval*dval; norm += dval*dval;
pnorm += dval*dval**pmodpix**pmodpix; pnorm += dval*dval**pmodpix**pmodpix;
} }
pix -= npix; pix -= npix;
pnorm = norm*sbd*sbd; pnorm = norm*sbd*sbd;
norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0); norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0);
*(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0; *(normt++) = (float)(pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0);
fnorm = (float)norm;
for (i=npix; i--;) for (i=npix; i--;)
*(pix++) *= norm; *(pix++) *= fnorm;
modpix -= npix; modpix -= npix;
norm = pnorm = 0.0; norm = pnorm = 0.0;
pmodpix = profit->modpix; pmodpix = profit->modpix;
for (i=npix; i--; pmodpix++) for (i=npix; i--; pmodpix++)
{ {
*(pix++) = dval = *(modpix++)**(scpixt++); *(pix++) = (float)(dval = *(modpix++)**(scpixt++));
norm += dval*dval; norm += dval*dval;
pnorm += dval*dval**pmodpix**pmodpix; pnorm += dval*dval**pmodpix**pmodpix;
} }
...@@ -640,8 +649,9 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -640,8 +649,9 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
pnorm = norm*sbd*sbd; pnorm = norm*sbd*sbd;
norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0); norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0);
*(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0; *(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0;
fnorm = (float)norm;
for (i=npix; i--;) for (i=npix; i--;)
*(pix++) *= norm; *(pix++) *= fnorm;
} }
} }
} }
...@@ -701,17 +711,18 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -701,17 +711,18 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
norm = 0.0; norm = 0.0;
for (i=npix; i--;fr2t++) for (i=npix; i--;fr2t++)
{ {
*(pix++) = dval = fac*pow(*fr2t, dm/2.0) *(pix++) = (float)(dval = fac*pow(*fr2t, dm/2.0)
*psf_laguerre(*fr2t, hnmm, m) *psf_laguerre(*fr2t, hnmm, m)
**(fexpr2t++)*cos(dm**(fthetat++)); **(fexpr2t++)*cos(dm**(fthetat++)));
norm += dval*dval; norm += dval*dval;
} }
pix -= npix; pix -= npix;
pnorm = norm*sbd*sbd; pnorm = norm*sbd*sbd;
norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0); norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0);
*(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0; *(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0;
fnorm = (float)norm;
for (i=npix; i--;) for (i=npix; i--;)
*(pix++) *= norm; *(pix++) *= fnorm;
if (m!=0) if (m!=0)
{ {
fr2t = fr2; fr2t = fr2;
...@@ -720,17 +731,18 @@ void pattern_create(patternstruct *pattern, profitstruct *profit) ...@@ -720,17 +731,18 @@ void pattern_create(patternstruct *pattern, profitstruct *profit)
norm = 0.0; norm = 0.0;
for (i=npix; i--; fr2t++) for (i=npix; i--; fr2t++)
{ {
*(pix++) = dval = fac*pow(*fr2t, dm/2.0) *(pix++) = (float)(dval = fac*pow(*fr2t, dm/2.0)
*psf_laguerre(*fr2t, hnmm, m) *psf_laguerre(*fr2t, hnmm, m)
**(fexpr2t++)*sin(dm**(fthetat++)); **(fexpr2t++)*sin(dm**(fthetat++)));
norm += dval*dval; norm += dval*dval;
} }
pix -= npix; pix -= npix;
pnorm = norm*sbd*sbd; pnorm = norm*sbd*sbd;
norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0); norm = (norm > 0.0? 1.0/sqrt(norm) : 1.0);
*(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0; *(normt++) = pnorm > 1.0/BIG? norm0/sqrt(pnorm) : 0.0;
fnorm = (float)norm;
for (i=npix; i--;) for (i=npix; i--;)
*(pix++) *= norm; *(pix++) *= fnorm;
} }
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Contents: Include file for pattern.c. * Contents: Include file for pattern.c.
* *
* Last modify: 19/11/2008 * Last modify: 18/11/2009
* *
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/ */
...@@ -52,14 +52,14 @@ typedef struct ...@@ -52,14 +52,14 @@ typedef struct
int ncomp; /* Number of independent components */ int ncomp; /* Number of independent components */
int nmodes; /* Number of modes per component */ int nmodes; /* Number of modes per component */
int nfreq; /* Number of waves per component */ int nfreq; /* Number of waves per component */
double x[2]; /* Coordinate vector */ float x[2]; /* Coordinate vector */
double rmax; /* Largest radius in units of scale */ float rmax; /* Largest radius in units of scale */
double *r; /* Reduced radius */ float *r; /* Reduced radius */
double *norm; /* Pattern vector norm */ float *norm; /* Pattern vector norm */
double *coeff; /* Fitted pattern coefficients */ float *coeff; /* Fitted pattern coefficients */
double *mcoeff; /* Modulus from pattern coefficients */ float *mcoeff; /* Modulus from pattern coefficients */
double *acoeff; /* Argument from pattern coefficients */ float *acoeff; /* Argument from pattern coefficients */
double *modpix; /* Pattern pixmaps */ float *modpix; /* Pattern pixmaps */
PIXTYPE *lmodpix; /* Low resolution pattern pixmaps */ PIXTYPE *lmodpix; /* Low resolution pattern pixmaps */
int size[3]; /* Pixmap size for each axis */ int size[3]; /* Pixmap size for each axis */
} patternstruct; } patternstruct;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment