Mercurial > hg > octave-lojdl
changeset 5904:80d3933fb8b6
[project @ 2006-07-26 17:19:10 by jwe]
author | jwe |
---|---|
date | Wed, 26 Jul 2006 17:19:10 +0000 |
parents | 11bb9bf343a0 |
children | e5c0831a48bd |
files | ChangeLog configure.in liboctave/ChangeLog liboctave/CmplxDET.cc liboctave/dbleDET.cc liboctave/lo-mappers.cc liboctave/lo-mappers.h mkoctfile.in scripts/ChangeLog scripts/miscellaneous/mex.m scripts/miscellaneous/mkoctfile.m src/ChangeLog src/error.cc src/error.h src/octave.cc |
diffstat | 15 files changed, 140 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-07-26 John W. Eaton <jwe@octave.org> + + * mkoctfile.in (Options): Accept -g. + + * configure.in: Check for exp2 and log2. + 2006-07-25 David Bateman <dbateman@free.fr> * mysparse.c: New file.
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.515 $) +AC_REVISION($Revision: 1.516 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1412,7 +1412,7 @@ ### Check for nonstandard but common math functions that we need. -AC_CHECK_FUNCS(acosh asinh atanh erf erfc) +AC_CHECK_FUNCS(acosh asinh atanh erf erfc, exp2, log2) ### Checks for OS specific cruft.
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,21 @@ +2006-07-26 John W. Eaton <jwe@octave.org> + + * dbleDET.cc (DET::initialize10, DET::value_will_underflow, + DET::value_will_overflow): Use xlog2 instead of log2. + (DET::initialize2, DET::initialize10): Use xround instead of round. + (DET::initialize2, DET::value): Use xexp2 instead of exp2. + * CmplxDET.cc (ComplexDET::initialize10, + ComplexDET::value_will_underflow, + ComplexDET::value_will_overflow): Use xlog2 instead of log2. + (ComplexDET::initialize2, ComplexDET::initialize10): + Use xround instead of round. + (ComplexDET::initialize2, ComplexDET::value): + Use xexp2 instead of exp2. + + * lo-mappers.cc (M_LOG10E): Delete unused macro. + (xlog2, xexp2): New functions. + * lo-mappers.h: Provide decls. + 2006-07-22 John W. Eaton <jwe@octave.org> * Sparse.h (Sparse<T>::mex_get_data, Sparse<T>::mex_get_ir,
--- a/liboctave/CmplxDET.cc +++ b/liboctave/CmplxDET.cc @@ -37,7 +37,7 @@ ComplexDET::value_will_overflow (void) const { return base2 - ? (e2 + 1 > log2 (DBL_MAX) ? 1 : 0) + ? (e2 + 1 > xlog2 (DBL_MAX) ? 1 : 0) : (e10 + 1 > log10 (DBL_MAX) ? 1 : 0); } @@ -45,7 +45,7 @@ ComplexDET::value_will_underflow (void) const { return base2 - ? (e2 - 1 < log2 (DBL_MIN) ? 1 : 0) + ? (e2 - 1 < xlog2 (DBL_MIN) ? 1 : 0) : (e10 - 1 < log10 (DBL_MIN) ? 1 : 0); } @@ -54,8 +54,8 @@ { if (c2 != 0.0) { - double etmp = e2 / log2 (10); - e10 = static_cast<int> (round (etmp)); + double etmp = e2 / xlog2 (10); + e10 = static_cast<int> (xround (etmp)); etmp -= e10; c10 = c2 * pow (10.0, etmp); } @@ -67,16 +67,16 @@ if (c10 != 0.0) { double etmp = e10 / log10 (2); - e2 = static_cast<int> (round (etmp)); + e2 = static_cast<int> (xround (etmp)); etmp -= e2; - c2 = c10 * exp2 (etmp); + c2 = c10 * xexp2 (etmp); } } Complex ComplexDET::value (void) const { - return base2 ? c2 * exp2 (e2) : c10 * pow (10.0, e10); + return base2 ? c2 * xexp2 (e2) : c10 * pow (10.0, e10); } /*
--- a/liboctave/dbleDET.cc +++ b/liboctave/dbleDET.cc @@ -29,12 +29,13 @@ #include <cmath> #include "dbleDET.h" +#include "lo-mappers.h" bool DET::value_will_overflow (void) const { return base2 - ? (e2 + 1 > log2 (DBL_MAX) ? 1 : 0) + ? (e2 + 1 > xlog2 (DBL_MAX) ? 1 : 0) : (e10 + 1 > log10 (DBL_MAX) ? 1 : 0); } @@ -42,7 +43,7 @@ DET::value_will_underflow (void) const { return base2 - ? (e2 - 1 < log2 (DBL_MIN) ? 1 : 0) + ? (e2 - 1 < xlog2 (DBL_MIN) ? 1 : 0) : (e10 - 1 < log10 (DBL_MIN) ? 1 : 0); } @@ -51,8 +52,8 @@ { if (c2 != 0.0) { - double etmp = e2 / log2 (10); - e10 = static_cast<int> (round (etmp)); + double etmp = e2 / xlog2 (10); + e10 = static_cast<int> (xround (etmp)); etmp -= e10; c10 = c2 * pow (10.0, etmp); } @@ -64,16 +65,16 @@ if (c10 != 0.0) { double etmp = e10 / log10 (2); - e2 = static_cast<int> (round (etmp)); + e2 = static_cast<int> (xround (etmp)); etmp -= e2; - c2 = c10 * exp2 (etmp); + c2 = c10 * xexp2 (etmp); } } double DET::value (void) const { - return base2 ? c2 * exp2 (e2) : c10 * pow (10.0, e10); + return base2 ? c2 * xexp2 (e2) : c10 * pow (10.0, e10); } /*
--- a/liboctave/lo-mappers.cc +++ b/liboctave/lo-mappers.cc @@ -41,10 +41,6 @@ #include "f77-fcn.h" -#ifndef M_LOG10E -#define M_LOG10E 0.43429448190325182765 -#endif - // double -> double mappers. double @@ -100,6 +96,38 @@ return xisnan (x) ? octave_NaN : tmp; } +double +xlog2 (double x) +{ +#if defined (HAVE_LOG2) + return log2 (x); +#else +#if defined (M_LN2) + static double ln2 = M_LN2; +#else + static double ln2 = log2 (2); +#endif + + return log (x) / ln2; +#endif +} + +double +xexp2 (double x) +{ +#if defined (HAVE_EXP2) + return exp2 (x); +#else +#if defined (M_LN2) + static double ln2 = M_LN2; +#else + static double ln2 = log2 (2); +#endif + + return exp (x * ln2); +#endif +} + // double -> bool mappers. bool
--- a/liboctave/lo-mappers.h +++ b/liboctave/lo-mappers.h @@ -33,6 +33,8 @@ extern double real (double x); extern double xround (double x); extern double signum (double x); +extern double xlog2 (double x); +extern double xexp2 (double x); extern bool xisnan (double x); extern bool xfinite (double x);
--- a/mkoctfile.in +++ b/mkoctfile.in @@ -154,6 +154,8 @@ (or .mex if --mex is specified) unless linking a stand-alone executable. + -g Enable debugging options for compilers. + -p VAR, --print VAR Print configuration variable VAR. Recognized variables are: @@ -249,6 +251,11 @@ -c | --compile) link=false ;; + -g) + ALL_CFLAGS="$ALL_CFLAGS -g" + ALL_CXXFLAGS="$ALL_CXXFLAGS -g" + ALL_FFLAGS="$ALL_FFLAGS -g" + ;; --link-stand-alone) link_stand_alone=true ;;
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2006-07-26 John W. Eaton <jwe@octave.org> + + * miscellaneous/mex.m: New function. + 2006-07-22 John W. Eaton <jwe@octave.org> * special-matrix/hadamard.m: Coerce bool matrix to double.
new file mode 100644 --- /dev/null +++ b/scripts/miscellaneous/mex.m @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} mex [options] file ... +## Compile source code written in C, C++, or Fortran, to a MEX file. +## This is equivalent to @code {mkoctfile --mex [options] file}. +## @seealso{mkoctfile} +## @end deftypefn + +## PKG_ADD: mark_as_command mex + +function mex (varargin) + args = {"--mex", varargin{:}}; + mkoctfile (args{:}); +endfunction
--- a/scripts/miscellaneous/mkoctfile.m +++ b/scripts/miscellaneous/mkoctfile.m @@ -50,8 +50,13 @@ ## @item -c ## Compile but do not link. ## -## @item -o FILE|--output FILE -## Output file name; by default extension is .oct. +## @item -g +## Enable debugging options for compilers. +## +## @item -o FILE|--output FILE +## Output file name. Default extension is .oct +## (or .mex if --mex is specified) unless linking +## a stand-alone executable. ## ## @item -p VAR|--print VAR ## Print the configuration variable VAR. Recognized variables are: @@ -82,6 +87,10 @@ ## @item --link-stand-alone ## Link a stand-alone executable file. ## +## @item --mex +## Assume we are creating a MEX file. Set the default output extension +## to ".mex". +## ## @item -s|--strip ## Strip the output file. ##
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2006-07-26 John W. Eaton <jwe@octave.org> + + * octave.cc (maximum_braindamage): Use disable_warning instead of + bind_internal_variable to disable function-name-clash warning. + * error.cc (disable_warning): No longer static. + * error.h: Provide decl. + 2006-07-25 David Bateman <dbateman@free.fr> * mex.cc (mxArray_octave_value::get_class_id): Handle sparse.
--- a/src/error.cc +++ b/src/error.cc @@ -1076,7 +1076,7 @@ return retval; } -static void +void disable_warning (const std::string& id) { octave_value_list args;
--- a/src/error.h +++ b/src/error.h @@ -60,6 +60,7 @@ // Helper function for print_usage defined in defun.cc. extern void defun_usage_message (const std::string& msg); +extern void disable_warning (const std::string& id); extern void initialize_default_warning_state (void); // Current error state.
--- a/src/octave.cc +++ b/src/octave.cc @@ -492,7 +492,8 @@ "%%-- %D %I:%M %p --%%"); bind_internal_variable ("page_screen_output", false); bind_internal_variable ("print_empty_dimensions", false); - bind_internal_variable ("warn_function_name_clash", false); + + disable_warning ("Octave:function-name-clash"); } // You guessed it.