./PaxHeaders.12771/communications-1.2.2 0000644 0000000 0000000 00000000132 13604150040 014353 x ustar 00 30 mtime=1578160160.353401177
30 atime=1578160213.541197341
30 ctime=1578160213.541197341
communications-1.2.2/ 0000755 0001750 0001750 00000000000 13604150040 014177 5 ustar 00nir nir 0000000 0000000 communications-1.2.2/PaxHeaders.12771/src 0000644 0000000 0000000 00000000132 13604150125 015011 x ustar 00 30 mtime=1578160213.541197341
30 atime=1578160213.541197341
30 ctime=1578160213.541197341
communications-1.2.2/src/ 0000755 0001750 0001750 00000000000 13604150125 014772 5 ustar 00nir nir 0000000 0000000 communications-1.2.2/src/PaxHeaders.12771/op-m-gm.cc 0000644 0000000 0000000 00000000074 13604150022 016647 x ustar 00 30 atime=1578160160.421400916
30 ctime=1578160213.541197341
communications-1.2.2/src/op-m-gm.cc 0000644 0001750 0001750 00000012512 13604150022 016547 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#include
#include
#include "galois.h"
#include "ov-galois.h"
#include "galois-ops.h"
// matrix by galois ops.
DEFBINOP_OP_G (add, matrix, galois, +)
DEFBINOP_OP_G (sub, matrix, galois, -)
DEFBINOP_OP_G (mul, matrix, galois, *)
DEFBINOP_FN_G (div, matrix, galois, xdiv)
DEFBINOP (pow, matrix, galois)
{
CAST_BINOP_ARGS (const octave_matrix&, const octave_galois&);
galois tmp (v1.matrix_value (), v2.m (), v2.primpoly ());
return new octave_galois (pow (tmp, v2.galois_value ()));
}
DEFBINOP_FN_G (ldiv, matrix, galois, xleftdiv)
DEFBINOP_FN (lt, matrix, galois, mx_el_lt)
DEFBINOP_FN (le, matrix, galois, mx_el_le)
DEFBINOP_FN (eq, matrix, galois, mx_el_eq)
DEFBINOP_FN (ge, matrix, galois, mx_el_ge)
DEFBINOP_FN (gt, matrix, galois, mx_el_gt)
DEFBINOP_FN (ne, matrix, galois, mx_el_ne)
DEFBINOP_FN_G (el_mul, matrix, galois, product)
DEFBINOP_FN_G (el_div, matrix, galois, quotient)
DEFBINOP (el_pow, matrix, galois)
{
CAST_BINOP_ARGS (const octave_matrix&, const octave_galois&);
galois tmp (v1.matrix_value (), v2.m (), v2.primpoly ());
return new octave_galois (elem_pow (tmp, v2.galois_value ()));
}
DEFBINOP (el_ldiv, matrix, galois)
{
CAST_BINOP_ARGS (const octave_matrix&, const octave_galois&);
return new octave_galois (quotient (v2.galois_value (), v1.matrix_value ()));
}
DEFBINOP_FN (el_and, matrix, galois, mx_el_and)
DEFBINOP_FN (el_or, matrix, galois, mx_el_or)
DEFCATOP_G_FN (m_gm, matrix, galois, concat)
DEFASSIGNOP_FN (assign, matrix, galois, assign)
#ifndef DEFMETHOD_DLD
void
install_m_gm_ops (void)
{
INSTALL_BINOP (op_add, octave_matrix, octave_galois, add);
INSTALL_BINOP (op_sub, octave_matrix, octave_galois, sub);
INSTALL_BINOP (op_mul, octave_matrix, octave_galois, mul);
INSTALL_BINOP (op_div, octave_matrix, octave_galois, div);
INSTALL_BINOP (op_pow, octave_matrix, octave_galois, pow);
INSTALL_BINOP (op_ldiv, octave_matrix, octave_galois, ldiv);
INSTALL_BINOP (op_lt, octave_matrix, octave_galois, lt);
INSTALL_BINOP (op_le, octave_matrix, octave_galois, le);
INSTALL_BINOP (op_eq, octave_matrix, octave_galois, eq);
INSTALL_BINOP (op_ge, octave_matrix, octave_galois, ge);
INSTALL_BINOP (op_gt, octave_matrix, octave_galois, gt);
INSTALL_BINOP (op_ne, octave_matrix, octave_galois, ne);
INSTALL_BINOP (op_el_mul, octave_matrix, octave_galois, el_mul);
INSTALL_BINOP (op_el_div, octave_matrix, octave_galois, el_div);
INSTALL_BINOP (op_el_pow, octave_matrix, octave_galois, el_pow);
INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_galois, el_ldiv);
INSTALL_BINOP (op_el_and, octave_matrix, octave_galois, el_and);
INSTALL_BINOP (op_el_or, octave_matrix, octave_galois, el_or);
INSTALL_G_CATOP (octave_matrix, octave_galois, m_gm);
INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_galois, assign);
//INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_galois);
}
#else
void
install_m_gm_ops (octave::type_info& ti)
{
INSTALL_BINOP_TI (ti, op_add, octave_matrix, octave_galois, add);
INSTALL_BINOP_TI (ti, op_sub, octave_matrix, octave_galois, sub);
INSTALL_BINOP_TI (ti, op_mul, octave_matrix, octave_galois, mul);
INSTALL_BINOP_TI (ti, op_div, octave_matrix, octave_galois, div);
INSTALL_BINOP_TI (ti, op_pow, octave_matrix, octave_galois, pow);
INSTALL_BINOP_TI (ti, op_ldiv, octave_matrix, octave_galois, ldiv);
INSTALL_BINOP_TI (ti, op_lt, octave_matrix, octave_galois, lt);
INSTALL_BINOP_TI (ti, op_le, octave_matrix, octave_galois, le);
INSTALL_BINOP_TI (ti, op_eq, octave_matrix, octave_galois, eq);
INSTALL_BINOP_TI (ti, op_ge, octave_matrix, octave_galois, ge);
INSTALL_BINOP_TI (ti, op_gt, octave_matrix, octave_galois, gt);
INSTALL_BINOP_TI (ti, op_ne, octave_matrix, octave_galois, ne);
INSTALL_BINOP_TI (ti, op_el_mul, octave_matrix, octave_galois, el_mul);
INSTALL_BINOP_TI (ti, op_el_div, octave_matrix, octave_galois, el_div);
INSTALL_BINOP_TI (ti, op_el_pow, octave_matrix, octave_galois, el_pow);
INSTALL_BINOP_TI (ti, op_el_ldiv, octave_matrix, octave_galois, el_ldiv);
INSTALL_BINOP_TI (ti, op_el_and, octave_matrix, octave_galois, el_and);
INSTALL_BINOP_TI (ti, op_el_or, octave_matrix, octave_galois, el_or);
INSTALL_CATOP_TI (ti, octave_matrix, octave_galois, m_gm);
INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_matrix, octave_galois, assign);
//INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_galois);
}
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/galoisfield.h 0000644 0000000 0000000 00000000062 13604150022 017517 x ustar 00 20 atime=1578160146
30 ctime=1578160213.541197341
communications-1.2.2/src/galoisfield.h 0000644 0001750 0001750 00000004204 13604150022 017421 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#if !defined (octave_galois_field_int_h)
#define octave_galois_field_int_h 1
#include
// Maximum value of m
#define __OCTAVE_GALOIS_MAX_M 16
// Maximum value of m. If you change the above, change here also
#define __OCTAVE_GALOIS_MAX_M_AS_STRING "16"
// A0 flag -inf value
#define __OCTAVE_GALOIS_A0 (n)
// The default primitive polynomials for GF(2^(indx+1))
extern int default_galois_primpoly[];
class
galois_field_node
{
friend class galois_field_list;
friend class galois;
private:
int m;
int primpoly;
int n;
MArray alpha_to;
MArray index_of;
galois_field_node *next;
galois_field_node *prev;
int count;
public:
galois_field_node (void);
galois_field_node (const int& _m = 1, const int& _primpoly = 0);
galois_field_node & operator = (const galois_field_node &t);
};
class
galois_field_list
{
private:
galois_field_node *first;
galois_field_node *last;
public:
galois_field_list (void) : first (NULL), last (NULL) { }
~galois_field_list (void);
galois_field_node * find_galois_field (const int& m, const int& primpoly);
galois_field_node * create_galois_field (const int& m, const int& primpoly);
int delete_galois_field (galois_field_node *field);
};
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/galoisfield.cc 0000644 0000000 0000000 00000000074 13604150022 017660 x ustar 00 30 atime=1578160160.421400916
30 ctime=1578160213.541197341
communications-1.2.2/src/galoisfield.cc 0000644 0001750 0001750 00000011367 13604150022 017567 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "galois.h"
#include "galoisfield.h"
#include "galois-def.h"
// The default primitive polynomials for GF(2^(indx+1))
int default_galois_primpoly[] = { 0x3, 0x7, 0xb, 0x13, 0x25,
0x43, 0x89, 0x11d, 0x211, 0x409,
0x805, 0x1053, 0x201b, 0x4443, 0x8003,
0x1100b};
galois_field_node::galois_field_node (void) :
m (0),
primpoly (0),
n (0),
next (NULL),
prev (NULL),
count (0) { }
galois_field_node::galois_field_node (const int& _m, const int& _primpoly)
{
int mask;
next = NULL;
prev = NULL;
count = 0; // Flag that field is currently bad...
// Initialize order of GF(2^m)
m = _m;
if ((m < 1) || (m > __OCTAVE_GALOIS_MAX_M))
{
gripe_order_galois (m);
return;
}
n = (1< n)
{
gripe_irred_galois (primpoly);
return;
}
count = 1; // Field is good now !!
return;
}
galois_field_node & galois_field_node::operator = (const galois_field_node &t)
{
m = t.m;
primpoly = t.primpoly;
n = t.n;
alpha_to = t.alpha_to;
index_of = t.index_of;
next = NULL;
prev = NULL;
count = 1;
return *this;
}
galois_field_list::~galois_field_list (void)
{
while (first)
{
galois_field_node * tmp = first->next;
delete first;
first = tmp;
}
}
galois_field_node*
galois_field_list::find_galois_field (const int& m, const int& primpoly)
{
galois_field_node* ptr = first;
while (ptr)
{
if ((ptr->m == m) && (ptr->primpoly == primpoly))
return ptr;
ptr = ptr->next;
}
return NULL;
}
galois_field_node*
galois_field_list::create_galois_field (const int& m, const int& primpoly)
{
galois_field_node* ptr = find_galois_field (m, primpoly);
if (ptr)
{
// We already have this field. Bump counter and return
ptr->count++;
return ptr;
}
// Create a new field and add it to the list
ptr = new galois_field_node (m, primpoly);
if (ptr->count == 0)
{
gripe_init_galois ();
return ptr;
}
if (first)
{
ptr->next = first;
first->prev = ptr;
}
else
last = ptr;
first = ptr;
return ptr;
}
int
galois_field_list::delete_galois_field (galois_field_node* field)
{
if (!field)
return 0;
field->count--;
if (field->count == 0)
{
if (field == first)
{
first = field->next;
if (first)
first->prev = NULL;
}
else if (field == last)
{
last = field->prev;
if (last)
last->next = NULL;
}
else
{
field->prev->next = field->next;
field->next->prev = field->prev;
}
delete field;
return 1;
}
else
return 0;
}
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/configure.ac 0000644 0000000 0000000 00000000074 13604150022 017355 x ustar 00 30 atime=1578160212.425201622
30 ctime=1578160213.541197341
communications-1.2.2/src/configure.ac 0000644 0001750 0001750 00000014516 13604150022 017263 0 ustar 00nir nir 0000000 0000000 AC_PREREQ([2.60])
AC_INIT([Octave-Forge communications package], [0])
AC_CONFIG_HEADERS([config.h])
# Avoid warnings for redefining AH-generated preprocessor symbols of
# Octave.
AH_TOP([#include "undef-ah-octave.h"])
AC_CONFIG_MACRO_DIRS([m4])
AC_ARG_VAR([MKOCTFILE], [mkoctfile compiler helper command])
AC_ARG_VAR([OCTAVE], [Octave interpreter command])
AC_CHECK_PROG([MKOCTFILE], mkoctfile, mkoctfile, [])
AC_CHECK_PROG([OCTAVE], octave, octave, [])
AC_PROG_CXX
AC_PROG_SED
# Checks for octave depreciated symbols
## Simple symbol alternatives of different Octave versions.
AC_LANG(C++)
save_altsyms_CXX="$CXX"
save_altsyms_CXXFLAGS="$CXXFLAGS"
save_altsyms_CPPFLAGS="$CPPFLAGS"
save_altsyms_LDFLAGS="$LDFLAGS"
save_altsyms_LIBS="$LIBS"
OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`}
OCTLIBDIR=${OCTLIBDIR:-`$MKOCTFILE -p OCTLIBDIR`}
CXX=`${MKOCTFILE} -p CXX`
CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS"
LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
LIBS="-loctinterp $LIBS"
OF_OCTAVE_LIST_ALT_SYMS([
[dnl
[gripe_nonconformant],
[octave::err_nonconformant],
[[octave::err_nonconformant ("a",0,0)]],
[OCTAVE__ERR_NONCONFORMANT],
[[#include ]],
[[#include ]]
],
[dnl
[gripe_wrong_type_arg],
[err_wrong_type_arg],
[[err_wrong_type_arg ("a", "b")]],
[OCTAVE__ERR_WRONG_TYPE_ARG],
[[#include ]],
[[#include ]]
],
[dnl
[gripe_square_matrix_required],
[err_square_matrix_required],
[[err_square_matrix_required ("a", "b")]],
[DELOCTAVE__ERR_SQUARE_MATRIX_REQUIRED],
[[#include ]],
[[#include ]]
],
[dnl
[gripe_invalid_conversion],
[err_invalid_conversion],
[[err_invalid_conversion ("a", "b")]],
[OCTAVE__ERR_INVALID_CONVERSION],
[[#include ]],
[[#include ]]
],
[dnl
[gripe_implicit_conversion],
[warn_implicit_conversion],
[[warn_implicit_conversion ("a", "b", "c")]],
[OCTAVE__WARN_INVALID_CONVERSION],
[[#include ]],
[[#include ]]
],
[dnl
[flush_octave_stdout],
[octave::flush_stdout],
[[octave::flush_stdout ();]],
[OCTAVE__FLUSH_STDOUT],
[[]],
[[]]
],
[dnl
[is_complex_type],
[iscomplex],
[[octave_value ().iscomplex ();]],
[OV_ISCOMPLEX],
[],
[]
],
[dnl
[is_real_type],
[isreal],
[[octave_value ().isreal ();]],
[OV_ISREAL],
[],
[]
],
[dnl
[is_numeric_type],
[isnumeric],
[[octave_value ().isnumeric ();]],
[OV_ISNUMERIC],
[],
[]
],
[dnl
[is_empty],
[isempty],
[[octave_value ().isempty ();]],
[OV_ISEMPTY],
[],
[]
],
[dnl
[oct_mach_info::float_format],
[octave::mach_info::float_format],
[[octave::mach_info::float_format fmt;]],
[OCTAVE_MACH_INFO_FLOAT_FORMAT],
[],
[]
]
],[oct-alt-includes.h])
AC_CHECK_HEADERS([octave/oct.h])
AC_CHECK_HEADERS([octave/base-lu.h])
AC_CHECK_HEADERS([octave/lu.h])
AC_CHECK_HEADERS([octave/gripes.h])
AC_CHECK_HEADERS([octave/errwarn.h])
AC_CHECK_HEADERS([octave/ovl.h])
AC_CHECK_HEADERS([octave/oct-obj.h])
AC_CHECK_HEADERS([octave/ls-oct-ascii.h])
AC_CHECK_HEADERS([octave/ls-oct-text.h])
AC_CHECK_HEADERS([octave/oct-obj.h])
AC_CHECK_HEADERS([octave/interpreter.h])
CXX=$save_altsyms_CXX
CXXFLAGS=$save_altsyms_CXXFLAGS
CPPFLAGS=$save_altsyms_CPPFLAGS
LDFLAGS=$save_altsyms_LDFLAGS
LIBS=$save_altsyms_LIBS
have_hdf5=no
# check for HDF5 using pkg-config
PKG_CHECK_MODULES([HDF5],[hdf5],
[have_hdf5=yes ],
[]
)
if test $have_hdf5 = no; then
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
AC_CHECK_LIB(hdf5,H5Fopen,
[
have_hdf5=yes
AC_CHECK_HEADERS([hdf5.h])
HDF5_LIBS=-lhdf5
],
[],
)
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
fi
if test $have_hdf5 = no; then
AC_MSG_ERROR([hdf5 not found])
fi
comm_OCT_EVAL="$OCTAVE --norc --no-history --silent --eval"
comm_CXXFLAGS=`$MKOCTFILE -p ALL_CXXFLAGS`
AC_CACHE_CHECK([for octave_hdf5_id type],
[comm_cv_octave_hdf5_id_type],
[comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include
#include
]], [[
octave_hdf5_id x;
]])],
[comm_cv_octave_hdf5_id_type=yes],
[comm_cv_octave_hdf5_id_type=no])
AC_LANG_POP(C++)
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS])
if test $comm_cv_octave_hdf5_id_type = yes; then
AC_DEFINE([HAVE_OCTAVE_HDF5_ID_TYPE],[1],[Define if have octave_hdf5_id])
fi
AC_CACHE_CHECK([for octave_base_value::gripe_load and octave_base_value::gripe_save],
[comm_cv_octave_base_value_gripe_load_save],
[comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include
#include
class foo : public octave_base_value
{
public:
foo () {}
void func () { gripe_load ("func"); gripe_save ("func"); }
};
]], [[
foo x;
]])],
[comm_cv_octave_base_value_gripe_load_save=yes],
[comm_cv_octave_base_value_gripe_load_save=no])
AC_LANG_POP(C++)
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS])
if test $comm_cv_octave_base_value_gripe_load_save = yes; then
AC_DEFINE([HAVE_OCTAVE_BASE_VALUE_GRIPE_LOAD_SAVE],[1],[Define if have gripe_load and gripe_save])
fi
AC_CACHE_CHECK([whether octave_base_value::print is const-qualified],
[comm_cv_octave_base_value_print_const_qualified],
[comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include
#include
#include
]], [[
const octave_base_value x; x.print (std::cout);
]])],
[comm_cv_octave_base_value_print_const_qualified=yes],
[comm_cv_octave_base_value_print_const_qualified=no])
AC_LANG_POP(C++)
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS])
if test $comm_cv_octave_base_value_print_const_qualified = yes; then
AC_DEFINE([HAVE_OCTAVE_BASE_VALUE_PRINT_CONST],[1],[Define if octave_base_value::print is const-qualified])
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
communications-1.2.2/src/PaxHeaders.12771/syndtable.cc 0000644 0000000 0000000 00000000074 13604150022 017363 x ustar 00 30 atime=1578160160.421400916
30 ctime=1578160213.541197341
communications-1.2.2/src/syndtable.cc 0000644 0001750 0001750 00000011642 13604150022 017266 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#ifndef SIZEOF_INT
#define SIZEOF_INT int(sizeof(int))
#endif
#define COL_MAJ(N) (N / (sizeof (int) << 3))
#define COL_MIN(N) (N % (sizeof (int) << 3))
Array
get_errs (const int& nmin, const int& nmax, const int &nerrs)
{
Array pos;
int cols = COL_MAJ (nmax)+1;
OCTAVE_QUIT;
if (nerrs == 1)
{
pos.resize (dim_vector (nmax-nmin, cols), 0);
for (int i = nmin; i < nmax; i++)
{
pos(i-nmin, COL_MAJ (i)) = (1< new_pos = get_errs (i+1, nmax, nerrs-1);
int l = pos.rows ();
pos.resize (dim_vector (l+new_pos.rows (), cols), 0);
for (int j=0; j (int)(sizeof (int) << 3))
{
error ("syndtable: codeword minus message length must be less than %d",
(int)(sizeof (int) << 3));
return retval;
}
// Check that the data in h is valid in GF(2)
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
if (((h(i, j) != 0) && (h(i, j) != 1)) ||
((h(i, j) - (double)((int)h(i, j))) != 0))
{
error ("syndtable: parity check matrix contains invalid data");
return retval;
}
RowVector filled (nrows, 0);
Matrix table (nrows, n, 0);
unsigned int nfilled = nrows;
int nerrs = 1;
// The first row of the table is for no errors
nfilled--;
filled(0) = 1;
while (nfilled != 0)
{
// Get all possible combinations of nerrs bit errors in n bits
Array errpos = get_errs (0, n, nerrs);
// Calculate the syndrome with the error vectors just calculated
for (int j = 0; j < errpos.rows (); j++)
{
int syndrome = 0;
for (int i = 0; i < m; i++)
{
for (int k = 0; k < n; k++)
syndrome ^= (errpos(j, COL_MAJ (k)) &
((unsigned int)h(i, k) << COL_MIN (k)) ?
((unsigned int)1<<(m-i-1)) : 0);
}
// Now use the syndrome as the rows indices to put the error vectors
// in place
if (((unsigned int)syndrome < nrows) && !filled(syndrome))
{
filled(syndrome) = 1;
nfilled--;
for (int i = 0; i < n; i++)
table(syndrome, i) = ((errpos(j, COL_MAJ (i)) &
((unsigned int)1 << COL_MIN (i))) != 0);
}
}
nerrs++;
}
retval = octave_value (table);
return retval;
}
/*
%% Test input validation
%!error syndtable ()
%!error syndtable (1, 2)
%!error syndtable ([1 2])
*/
communications-1.2.2/src/PaxHeaders.12771/gf.cc 0000644 0000000 0000000 00000000074 13604150022 015772 x ustar 00 30 atime=1578160160.421400916
30 ctime=1578160213.541197341
communications-1.2.2/src/gf.cc 0000644 0001750 0001750 00000243716 13604150022 015706 0 ustar 00nir nir 0000000 0000000 // Copyright (C) 1994-1997 Robert Morelos-Zaragoza
// Copyright (C) 2002 Phil Karn
// Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
/*
Part of the function rsenc and the function decode_rs are from Phil Karn. See
the website http://www.ka9q.net/code/fec for more details.
Parts of the function bchenco and bchdeco are from Robert Morelos-Zaragoza. See
the website http://www.eccpage.com for more details. Permission has been granted
for a GPL release of his code
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#ifdef HAVE_OCTAVE_INTERPRETER_H
#include
#endif
#include
#ifdef HAVE_OCTAVE_GRIPES_H
#include
#define OCTAVE__ERR_SQUARE_MATRIX_REQUIRED(a) gripe_square_matrix_required(a)
#endif
#ifdef HAVE_OCTAVE_ERRWARN_H
#include
#define OCTAVE__ERR_SQUARE_MATRIX_REQUIRED(a) err_square_matrix_required(a, "")
#endif
#include
#include
#include
#include
#include "galois.h"
#include "ov-galois.h"
static bool galois_type_loaded = false;
// PKG_ADD: autoload ("isgalois", "gf.oct");
// PKG_DEL: autoload ("isgalois", "gf.oct", "remove");
DEFUN_DLD (isgalois, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} isgalois (@var{expr})\n\
Return 1 if the value of the expression @var{expr} is a Galois Field.\n\
@end deftypefn")
{
if (args.length () != 1)
print_usage ();
else if (!galois_type_loaded)
// Can be of Galois type if the type isn't load :-/
return octave_value (0.);
else
return octave_value (args(0).type_id () ==
octave_galois::static_type_id ());
return octave_value ();
}
/*
%% Test input validation
%!error isgalois ()
%!error isgalois (1, 2)
*/
// FIXME:
// I want to replace the "16" below with __OCTAVE_GALOIS_MAX_M_AS_STRING,
// but as I don't run the preprocessor when getting the help from the
// functions, this can't be done at the point. So if more default primitive
// polynomials are added to galoisfield.cc, need to update the "16" here
// as well!!
#ifdef DEFMETHOD_DLD
DEFMETHOD_DLD (gf, interp, args, nargout,
#else
DEFUN_DLD (gf, args, nargout,
#endif
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{y} =} gf (@var{x})\n\
@deftypefnx {Loadable Function} {@var{y} =} gf (@var{x}, @var{m})\n\
@deftypefnx {Loadable Function} {@var{y} =} gf (@var{x}, @var{m}, @var{primpoly})\n\
Creates a Galois field array GF(2^@var{m}) from the matrix @var{x}. The\n\
Galois field has 2^@var{m} elements, where @var{m} must be between 1 and 16.\n\
The elements of @var{x} must be between 0 and 2^@var{m} - 1. If @var{m} is\n\
undefined it defaults to the value 1.\n\
\n\
The primitive polynomial to use in the creation of Galois field can be\n\
specified with the @var{primpoly} variable. If this is undefined a default\n\
primitive polynomial is used. It should be noted that the primitive\n\
polynomial must be of the degree @var{m} and it must be irreducible.\n\
\n\
The output of this function is recognized as a Galois field by Octave and\n\
other matrices will be converted to the same Galois field when used in an\n\
arithmetic operation with a Galois field.\n\
\n\
@seealso{isprimitive, primpoly}\n\
@end deftypefn")
{
Matrix data;
octave_value retval;
int nargin = args.length ();
int m = 1;
int primpoly = 0;
if (nargin < 1 || nargin > 3)
{
print_usage ();
return retval;
}
data = args(0).matrix_value ();
if (nargin > 1)
m = args(1).int_value ();
if (nargin > 2)
primpoly = args(2).int_value ();
if (!galois_type_loaded)
{
octave_galois::register_type ();
#ifndef DEFMETHOD_DLD
install_gm_gm_ops ();
install_m_gm_ops ();
install_gm_m_ops ();
install_s_gm_ops ();
install_gm_s_ops ();
galois_type_loaded = true;
mlock ();
#else
interp.mlock ();
octave::type_info& ti = interp.get_type_info ();
install_gm_gm_ops (ti);
install_m_gm_ops (ti);
install_gm_m_ops (ti);
install_s_gm_ops (ti);
install_gm_s_ops (ti);
galois_type_loaded = true;
#endif
}
retval = new octave_galois (data, m, primpoly);
return retval;
}
/*
%% Test input validation
%!error gf ()
%!error gf (1, 2, 3, 4)
*/
static octave_value
make_gdiag (const octave_value& a, const octave_value& b)
{
octave_value retval;
if ((!galois_type_loaded) || (a.type_id () !=
octave_galois::static_type_id ()))
OCTAVE__ERR_WRONG_TYPE_ARG ("gdiag", a);
else
{
galois m = ((const octave_galois&) a.get_rep ()).galois_value ();
int k = b.nint_value ();
if (! error_state)
{
int nr = m.rows ();
int nc = m.columns ();
if (nr == 0 || nc == 0)
retval = new octave_galois (m);
else if (nr == 1 || nc == 1)
{
int roff = 0;
int coff = 0;
if (k > 0)
{
roff = 0;
coff = k;
}
else if (k < 0)
{
k = -k;
roff = k;
coff = 0;
}
if (nr == 1)
{
int n = nc + k;
galois r (n, n, 0, m.m (), m.primpoly ());
for (int i = 0; i < nc; i++)
r (i+roff, i+coff) = m (0, i);
retval = new octave_galois (r);
}
else
{
int n = nr + k;
galois r (n, n, 0, m.m (), m.primpoly ());
for (int i = 0; i < nr; i++)
r (i+roff, i+coff) = m (i, 0);
retval = new octave_galois (r);
}
}
else
{
galois r = m.diag (k);
if (r.numel () > 0)
retval = new octave_galois (r);
}
}
else
OCTAVE__ERR_WRONG_TYPE_ARG ("gdiag", a);
}
return retval;
}
// PKG_ADD: autoload ("gdiag", "gf.oct");
// PKG_DEL: autoload ("gdiag", "gf.oct", "remove");
DEFUN_DLD (gdiag, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gdiag (@var{v}, @var{k})\n\
Return a diagonal matrix with Galois vector @var{v} on diagonal @var{k}.\n\
The second argument is optional. If it is positive, the vector is placed on\n\
the @var{k}-th super-diagonal. If it is negative, it is placed on the\n\
@var{-k}-th sub-diagonal. The default value of @var{k} is 0, and the\n\
vector is placed on the main diagonal. For example,\n\
\n\
@example\n\
gdiag (gf ([1, 2, 3], 2), 1)\n\
ans =\n\
GF(2^2) array. Primitive Polynomial = D^2+D+1 (decimal 7)\n\
\n\
Array elements =\n\
\n\
0 1 0 0\n\
0 0 2 0\n\
0 0 0 3\n\
0 0 0 0\n\
\n\
@end example\n\
@seealso{diag}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin == 1 && args(0).is_defined ())
retval = make_gdiag (args(0), octave_value (0.));
else if (nargin == 2 && args(0).is_defined () && args(1).is_defined ())
retval = make_gdiag (args(0), args(1));
else
print_usage ();
return retval;
}
/*
%% Test input validation
%!error gdiag ()
%!error gdiag (1, 2, 3)
*/
// PKG_ADD: autoload ("greshape", "gf.oct");
// PKG_DEL: autoload ("greshape", "gf.oct", "remove");
DEFUN_DLD (greshape, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} greshape (@var{a}, @var{m}, @var{n})\n\
Return a matrix with @var{m} rows and @var{n} columns whose elements are\n\
taken from the Galois array @var{a}. To decide how to order the elements,\n\
Octave pretends that the elements of a matrix are stored in column-major\n\
order (like Fortran arrays are stored).\n\
\n\
For example,\n\
\n\
@example\n\
greshape (gf ([1, 2, 3, 4], 3), 2, 2)\n\
ans =\n\
GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)\n\
\n\
Array elements =\n\
\n\
1 3\n\
2 4\n\
\n\
@end example\n\
\n\
The @code{greshape} function is equivalent to\n\
\n\
@example\n\
@group\n\
retval = gf (zeros (m, n), a.m, a.prim_poly);\n\
retval(:) = a;\n\
@end group\n\
@end example\n\
\n\
@noindent\n\
but it is somewhat less cryptic to use @code{reshape} instead of the\n\
colon operator. Note that the total number of elements in the original\n\
matrix must match the total number of elements in the new matrix.\n\
@seealso{reshape, :}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 2 && nargin != 3)
{
print_usage ();
}
else
{
int mr = 0, mc = 0;
if ((!galois_type_loaded) || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("greshape", args(0));
return retval;
}
galois a = ((const octave_galois&) args(0).get_rep ()).galois_value ();
if (nargin == 2)
{
RowVector tmp = args(1).row_vector_value ();
mr = (int)tmp(0);
mc = (int)tmp(1);
}
else if (nargin == 3)
{
mr = args(1).nint_value ();
mc = args(2).nint_value ();
}
int nr = a.rows ();
int nc = a.cols ();
if ((nr * nc) != (mr * mc))
error ("greshape: sizes must match");
else
{
RowVector tmp1 (mr*mc);
for (int i = 0; i < nr; i++)
for (int j = 0; j < nc; j++)
tmp1(i+j*nr) = (double)a(i, j);
galois tmp2 (mr, mc, 0, a.m (), a.primpoly ());
for (int i = 0; i < mr; i++)
for (int j = 0; j < mc; j++)
tmp2(i, j) = (int)tmp1(i+j*mr);
retval = new octave_galois (tmp2);
}
}
return retval;
}
/*
%% Test input validation
%!error greshape ()
%!error greshape (1)
%!error greshape (1, 2, 3, 4)
*/
#define DATA_REDUCTION(FCN) \
\
octave_value_list retval; \
\
int nargin = args.length (); \
\
if (nargin == 1 || nargin == 2) \
{ \
octave_value arg = args(0); \
\
int dim = (nargin == 1 ? -1 : args(1).int_value (true) - 1); \
\
if (! error_state) \
{ \
if (dim <= 1 && dim >= -1) \
{ \
if (galois_type_loaded && (arg.type_id () == \
octave_galois::static_type_id ())) \
{ \
galois tmp = ((const octave_galois&)arg.get_rep ()).galois_value (); \
\
if (! error_state) \
retval(0) = new octave_galois (tmp.FCN (dim)); \
} \
else \
{ \
OCTAVE__ERR_WRONG_TYPE_ARG (#FCN, arg); \
return retval; \
} \
} \
else \
error (#FCN ": invalid dimension argument = %d", dim + 1); \
} \
} \
else \
print_usage (); \
\
return retval
// PKG_ADD: autoload ("gprod", "gf.oct");
// PKG_DEL: autoload ("gprod", "gf.oct", "remove");
DEFUN_DLD (gprod, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gprod (@var{x}, @var{dim})\n\
Product of elements along dimension @var{dim} of Galois array. If\n\
@var{dim} is omitted, it defaults to 1 (column-wise products).\n\
@seealso{prod}\n\
@end deftypefn")
{
DATA_REDUCTION (prod);
}
/*
%% Test input validation
%!error gprod ()
%!error gprod (1, 2, 3)
*/
// PKG_ADD: autoload ("gsum", "gf.oct");
// PKG_DEL: autoload ("gsum", "gf.oct", "remove");
DEFUN_DLD (gsum, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gsum (@var{x}, @var{dim})\n\
Sum of elements along dimension @var{dim} of Galois array. If @var{dim}\n\
is omitted, it defaults to 1 (column-wise sum).\n\
@seealso{sum}\n\
@end deftypefn")
{
DATA_REDUCTION (sum);
}
/*
%% Test input validation
%!error gsum ()
%!error gsum (1, 2, 3)
*/
// PKG_ADD: autoload ("gsumsq", "gf.oct");
// PKG_DEL: autoload ("gsumsq", "gf.oct", "remove");
DEFUN_DLD (gsumsq, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gsumsq (@var{x}, @var{dim})\n\
Sum of squares of elements along dimension @var{dim} of Galois array.\n\
If @var{dim} is omitted, it defaults to 1 (column-wise sum of squares).\n\
\n\
This function is equivalent to computing\n\
@example\n\
gsum (x .* conj (x), dim)\n\
@end example\n\
but it uses less memory.\n\
@seealso{sumsq}\n\
@end deftypefn")
{
DATA_REDUCTION (sumsq);
}
/*
%% Test input validation
%!error gsumsq ()
%!error gsumsq (1, 2, 3)
*/
// PKG_ADD: autoload ("gsqrt", "gf.oct");
// PKG_DEL: autoload ("gsqrt", "gf.oct", "remove");
DEFUN_DLD (gsqrt, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gsqrt (@var{x})\n\
Compute the square root of @var{x}, element by element, in a Galois Field.\n\
@seealso{exp}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
if (!galois_type_loaded || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("gsqrt", args(0));
return retval;
}
galois a = ((const octave_galois&) args(0).get_rep ()).galois_value ();
retval = new octave_galois (a.sqrt ());
return retval;
}
/*
%% Test input validation
%!error gsqrt ()
%!error gsqrt (1, 2)
*/
// PKG_ADD: autoload ("glog", "gf.oct");
// PKG_DEL: autoload ("glog", "gf.oct", "remove");
DEFUN_DLD (glog, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} glog (@var{x})\n\
Compute the natural logarithm for each element of @var{x} for a Galois\n\
array.\n\
@seealso{log}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
if (!galois_type_loaded || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("glog", args(0));
return retval;
}
galois a = ((const octave_galois&) args(0).get_rep ()).galois_value ();
retval = new octave_galois (a.log ());
return retval;
}
/*
%% Test input validation
%!error glog ()
%!error glog (1, 2)
*/
// PKG_ADD: autoload ("gexp", "gf.oct");
// PKG_DEL: autoload ("gexp", "gf.oct", "remove");
DEFUN_DLD (gexp, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} gexp (@var{x})\n\
Compute the anti-logarithm for each element of @var{x} for a Galois\n\
array.\n\
@seealso{exp}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
if (!galois_type_loaded || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("gexp", args(0));
return retval;
}
galois a = ((const octave_galois&) args(0).get_rep ()).galois_value ();
retval = new octave_galois (a.exp ());
return retval;
}
/*
%% Test input validation
%!error gexp ()
%!error gexp (1, 2)
*/
static inline int
modn (int x, int m, int n)
{
while (x >= n)
{
x -= n;
x = (x >> m) + (x & n);
}
return x;
}
galois
filter (galois& b, galois& a, galois& x, galois& si)
{
int ab_len = (a.numel () > b.numel () ? a.numel () : b.numel ());
b.resize (dim_vector (ab_len, 1), 0);
galois retval (x.numel (), 1, 0, b.m (), b.primpoly ());
int norm = a(0, 0);
if (norm == 0)
{
error ("gfilter: the first element of a must be non-zero");
return galois ();
}
if (si.numel () != ab_len - 1)
{
error ("gfilter: si must be a vector of length max(length(a), length(b)) - 1");
return galois ();
}
if (norm != 1)
{
int idx_norm = b.index_of (norm);
for (int i = 0; i < b.numel (); i++)
{
if (b(i, 0) != 0)
b(i, 0) = b.alpha_to (modn (b.index_of (b(i, 0))-idx_norm+b.n (),
b.m (), b.n ()));
}
}
if (a.numel () > 1)
{
a.resize (dim_vector (ab_len, 1), 0);
if (norm != 1)
{
int idx_norm = a.index_of (norm);
for (int i = 0; i < a.numel (); i++)
if (a(i, 0) != 0)
a(i, 0) = a.alpha_to (modn (a.index_of (a(i, 0))-idx_norm+a.n (),
a.m (), a.n ()));
}
for (int i = 0; i < x.numel (); i++)
{
retval(i, 0) = si(0, 0);
if ((b(0, 0) != 0) && (x(i, 0) != 0))
retval(i, 0) ^= b.alpha_to (modn (b.index_of (b(0, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
if (si.numel () > 1)
{
for (int j = 0; j < si.numel () - 1; j++)
{
si(j, 0) = si(j+1, 0);
if ((a(j+1, 0) != 0) && (retval(i, 0) != 0))
si(j, 0) ^= a.alpha_to (modn (a.index_of (a(j+1, 0)) +
a.index_of (retval(i, 0)), a.m (), a.n ()));
if ((b(j+1, 0) != 0) && (x(i, 0) != 0))
si(j, 0) ^= b.alpha_to (modn (b.index_of (b(j+1, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
}
si(si.numel ()-1, 0) = 0;
if ((a(si.numel (), 0) != 0) && (retval(i, 0) != 0))
si(si.numel ()-1, 0) ^= a.alpha_to (modn (a.index_of (a(si.numel (), 0))
+ a.index_of (retval(i, 0)),
a.m (), a.n ()));
if ((b(si.numel (), 0) != 0) && (x(i, 0) != 0))
si(si.numel ()-1, 0) ^= b.alpha_to (modn (b.index_of (b(si.numel (), 0))
+ b.index_of (x(i, 0)),
b.m (), b.n ()));
}
else
{
si(0, 0) = 0;
if ((a(1, 0) != 0) && (retval(i, 0) != 0))
si(0, 0) ^= a.alpha_to (modn (a.index_of (a(1, 0))+
a.index_of (retval(i, 0)), a.m (), a.n ()));
if ((b(1, 0) != 0) && (x(i, 0) != 0))
si(0, 0) ^= b.alpha_to (modn (b.index_of (b(1, 0))+
b.index_of (x(i, 0)), b.m (), b.n ()));
}
}
}
else if (si.numel () > 0)
{
for (int i = 0; i < x.numel (); i++)
{
retval(i, 0) = si(0, 0);
if ((b(0, 0) != 0) && (x(i, 0) != 0))
retval(i, 0) ^= b.alpha_to (modn (b.index_of (b(0, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
if (si.numel () > 1)
{
for (int j = 0; j < si.numel () - 1; j++)
{
si(j, 0) = si(j+1, 0);
if ((b(j+1, 0) != 0) && (x(i, 0) != 0))
si(j, 0) ^= b.alpha_to (modn (b.index_of (b(j+1, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
}
si(si.numel ()-1, 0) = 0;
if ((b(si.numel (), 0) != 0) && (x(i, 0) != 0))
si(si.numel ()-1, 0) ^= b.alpha_to (modn (b.index_of (b(si.numel (), 0))
+ b.index_of (x(i, 0)),
b.m (), b.n ()));
}
else
{
si(0, 0) = 0;
if ((b(1, 0) != 0) && (x(i, 0) != 0))
si(0, 0) ^= b.alpha_to (modn (b.index_of (b(1, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
}
}
}
else
for (int i = 0; i < x.numel (); i++)
if ((b(0, 0) != 0) && (x(i, 0) != 0))
retval(i, 0) = b.alpha_to (modn (b.index_of (b(0, 0)) +
b.index_of (x(i, 0)), b.m (), b.n ()));
return retval;
}
// PKG_ADD: autoload ("gfilter", "gf.oct");
// PKG_DEL: autoload ("gfilter", "gf.oct", "remove");
DEFUN_DLD (gfilter, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {y =} gfilter (@var{b}, @var{a}, @var{x})\n\
@deftypefnx {Loadable Function} {[@var{y}, @var{sf}] =} gfilter (@var{b}, @var{a}, @var{x}, @var{si})\n\
Digital filtering of vectors in a Galois Field. Returns the solution to\n\
the following linear, time-invariant difference equation over a Galois\n\
Field:\n\
@tex\n\
$$\n\
\\sum_{k=0}^N a_{k+1} y_{n-k} = \\sum_{k=0}^M b_{k+1} x_{n-k}, \\qquad\n\
1 \\le n \\le P\n\
$$\n\
@end tex\n\
@ifnottex\n\
\n\
@smallexample\n\
@group\n\
N M\n\
SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k) for 1<=n<=length(x)\n\
k=0 k=0\n\
@end group\n\
@end smallexample\n\
@end ifnottex\n\
\n\
@noindent\n\
where\n\
@tex\n\
$a \\in \\Re^{N-1}$, $b \\in \\Re^{M-1}$, and $x \\in \\Re^P$.\n\
@end tex\n\
@ifnottex\n\
N=length(a)-1 and M=length(b)-1.\n\
@end ifnottex\n\
An equivalent form of this equation is:\n\
@tex\n\
$$\n\
y_n = -\\sum_{k=1}^N c_{k+1} y_{n-k} + \\sum_{k=0}^M d_{k+1} x_{n-k}, \\qquad\n\
1 \\le n \\le P\n\
$$\n\
@end tex\n\
@ifnottex\n\
\n\
@smallexample\n\
@group\n\
N M\n\
y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k) for 1<=n<=length(x)\n\
k=1 k=0\n\
@end group\n\
@end smallexample\n\
@end ifnottex\n\
\n\
@noindent\n\
where\n\
@tex\n\
$c = a/a_1$ and $d = b/a_1$.\n\
@end tex\n\
@ifnottex\n\
c = a/a(1) and d = b/a(1).\n\
@end ifnottex\n\
\n\
If the fourth argument @var{si} is provided, it is taken as the initial\n\
state of the system and the final state is returned as @var{sf}. The\n\
state vector is a column vector whose length is equal to the length of\n\
the longest coefficient vector minus one. If @var{si} is not supplied,\n\
the initial state vector is set to all zeros.\n\
@seealso{filter}\n\
@end deftypefn")
{
octave_value_list retval;
int nargin = args.length ();
if (nargin < 3 || nargin > 4)
{
print_usage ();
return retval;
}
if (!galois_type_loaded)
{
error ("gfilter: wrong argument types");
return retval;
}
bool x_is_row_vector = (args(2).rows () == 1);
bool si_is_row_vector = (nargin == 4 && args(3).rows () == 1);
galois b, a, x, si;
bool ib=false, ia=false, ix = false, isi=false;
if (args(0).type_id () == octave_galois::static_type_id ())
{
b = ((const octave_galois&) args(0).get_rep ()).galois_value ();
ib = true;
}
if (args(1).type_id () == octave_galois::static_type_id ())
{
a = ((const octave_galois&) args(1).get_rep ()).galois_value ();
ia = true;
}
if (args(2).type_id () == octave_galois::static_type_id ())
{
x = ((const octave_galois&) args(2).get_rep ()).galois_value ();
ix = true;
}
if (nargin == 4)
{
if (args(3).type_id () == octave_galois::static_type_id ())
{
si = ((const octave_galois&) args(3).get_rep ()).galois_value ();
isi = true;
}
}
if (!ib && !ia && !ix && !isi)
{
error ("gfilter: wrong argument types");
return retval;
}
if (!ib)
{
if (ia)
b = galois (args(0).matrix_value (), a.m (), a.primpoly ());
else if (ix)
b = galois (args(0).matrix_value (), x.m (), x.primpoly ());
else if (isi)
b = galois (args(0).matrix_value (), si.m (), si.primpoly ());
}
if (!ia)
a = galois (args(1).matrix_value (), b.m (), b.primpoly ());
if (!ix)
x = galois (args(2).matrix_value (), b.m (), b.primpoly ());
if (nargin == 4)
{
if (!isi)
si = galois (args(3).matrix_value (), b.m (), b.primpoly ());
}
else
{
int a_len = a.numel ();
int b_len = b.numel ();
int si_len = (a_len > b_len ? a_len : b_len) - 1;
si = galois (si_len, 1, 0, b.m (), b.primpoly ());
}
if ((b.m () != a.m ()) || (b.m () != x.m ()) || (b.m () != si.m ()) ||
(b.primpoly () != a.primpoly ()) || (b.primpoly () != x.primpoly ()) ||
(b.primpoly () != si.primpoly ()))
{
error ("gfilter: arguments must be in same galois field");
return retval;
}
if (b.cols () > 1)
b = b.transpose ();
if (a.cols () > 1)
a = a.transpose ();
if (x.cols () > 1)
x = x.transpose ();
if (si.cols () > 1)
si = si.transpose ();
if (b.cols () > 1 || a.cols () > 1 || x.cols () > 1 || si.cols () > 1)
{
error ("gfilter: arguments must be vectors");
return retval;
}
galois y (filter (b, a, x, si));
if (nargout == 2)
{
if (si_is_row_vector)
retval(1) = new octave_galois (si.transpose ());
else
retval(1) = new octave_galois (si);
}
if (x_is_row_vector)
retval(0) = new octave_galois (y.transpose ());
else
retval(0) = new octave_galois (y);
return retval;
}
/*
%% Test input validation
%!error gfilter ()
%!error gfilter (1)
%!error gfilter (1, 2)
%!error gfilter (1, 2, 3, 4, 5)
*/
// PKG_ADD: autoload ("glu", "gf.oct");
// PKG_DEL: autoload ("glu", "gf.oct", "remove");
DEFUN_DLD (glu, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {[@var{l}, @var{u}, @var{p}] =} glu (@var{a})\n\
@cindex LU decomposition of Galois matrix\n\
Compute the LU decomposition of @var{a} in a Galois Field. The result is\n\
returned in a permuted form, according to the optional return value\n\
@var{p}. For example, given the matrix\n\
@code{a = gf ([1, 2; 3, 4], 3)},\n\
\n\
@example\n\
[l, u, p] = glu (a)\n\
@end example\n\
\n\
@noindent\n\
returns\n\
\n\
@example\n\
l =\n\
GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)\n\
\n\
Array elements =\n\
\n\
1 0\n\
6 1\n\
\n\
u =\n\
GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)\n\
\n\
Array elements =\n\
\n\
3 4\n\
0 7\n\
\n\
p =\n\
\n\
Permutation Matrix\n\
\n\
0 1\n\
1 0\n\
\n\
@end example\n\
\n\
Such that @code{@var{p} * @var{a} = @var{l} * @var{u}}. If the argument\n\
@var{p} is not included then the permutations are applied to @var{l}\n\
so that @code{@var{a} = @var{l} * @var{u}}. @var{l} is then a pseudo-\n\
lower triangular matrix. The matrix @var{a} can be rectangular.\n\
@seealso{lu}\n\
@end deftypefn")
{
octave_value_list retval;
int nargin = args.length ();
if (nargin != 1 || nargout > 3)
{
print_usage ();
return retval;
}
octave_value arg = args(0);
if (!galois_type_loaded || (arg.type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("glu", arg);
return retval;
}
galois m = ((const octave_galois&) arg.get_rep ()).galois_value ();
int nr = arg.rows ();
int nc = arg.columns ();
int arg_is_empty = arg.OV_ISEMPTY();
if (arg_is_empty < 0)
return retval;
else if (arg_is_empty > 0)
{
retval(0) = new octave_galois (galois (0, 0, 0, m.m (), m.primpoly ()));
retval(1) = new octave_galois (galois (0, 0, 0, m.m (), m.primpoly ()));
retval(2) = new octave_galois (galois (0, 0, 0, m.m (), m.primpoly ()));
return retval;
}
if (! error_state)
{
galoisLU fact (m);
switch (nargout)
{
case 0:
case 1:
case 2:
{
// While we don't have sparse galois matrices converting the
// permutation matrix to a full matrix is the best we can do.
Matrix P = Matrix (fact.P ());
galois L = P.transpose () * fact.L ();
retval(1) = new octave_galois (fact.U ());
retval(0) = new octave_galois (L);
}
break;
case 3:
default:
retval(2) = fact.P ();
retval(1) = new octave_galois (fact.U ());
retval(0) = new octave_galois (fact.L ());
break;
}
}
return retval;
}
/*
%% Test input validation
%!error glu ()
%!error glu (1, 2)
*/
// PKG_ADD: autoload ("ginv", "gf.oct");
// PKG_DEL: autoload ("ginv", "gf.oct", "remove");
DEFUN_DLD (ginv, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {[@var{x}, @var{rcond}] =} ginv (@var{a})\n\
Compute the inverse of the square matrix @var{a}. Return an estimate\n\
of the reciprocal condition number if requested, otherwise warn of an\n\
ill-conditioned matrix if the reciprocal condition number is small.\n\
@seealso{inv}\n\
@end deftypefn")
{
octave_value_list retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
octave_value arg = args(0);
int nr = arg.rows ();
int nc = arg.columns ();
if (!galois_type_loaded || (arg.type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("ginverse", arg);
return retval;
}
galois m = ((const octave_galois&) arg.get_rep ()).galois_value ();
int arg_is_empty = arg.OV_ISEMPTY ();
if (arg_is_empty < 0)
return retval;
else if (arg_is_empty > 0)
{
retval(0) = new octave_galois (galois (0, 0, 0, m.m (), m.primpoly ()));
return retval;
}
if (nr != nc)
{
OCTAVE__ERR_SQUARE_MATRIX_REQUIRED ("ginverse");
return retval;
}
if (! error_state)
{
int info;
double rcond = 0.0;
galois result = m.inverse (info, 1);
if (nargout > 1)
retval(1) = rcond;
retval(0) = new octave_galois (result);
if (nargout < 2 && info == -1)
warning ("inverse: matrix singular to machine precision, rcond = %g", rcond);
}
return retval;
}
/*
%% Test input validation
%!error ginv ()
%!error ginv (1, 2)
*/
// FIXME: this should really be done with an alias, but
// alias_builtin() won't do the right thing if we are actually using
// dynamic linking.
// PKG_ADD: autoload ("ginverse", "gf.oct");
// PKG_DEL: autoload ("ginverse", "gf.oct", "remove");
DEFUN_DLD (ginverse, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} ginverse (@var{a})\n\
Compute the inverse of the square matrix @var{a}. Return an estimate\n\
of the reciprocal condition number if requested, otherwise warn of an\n\
ill-conditioned matrix if the reciprocal condition number is small.\n\
@seealso{ginv}\n\
@end deftypefn")
{
return Fginv (args, nargout);
}
/*
%% Test input validation
%!error ginverse ()
%!error ginverse (1, 2)
*/
// PKG_ADD: autoload ("gdet", "gf.oct");
// PKG_DEL: autoload ("gdet", "gf.oct", "remove");
DEFUN_DLD (gdet, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{d} =} gdet (@var{a})\n\
Compute the determinant of the Galois array @var{a}.\n\
@seealso{det}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
octave_value arg = args(0);
if (!galois_type_loaded || (arg.type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("gdet", arg);
return retval;
}
int nr = arg.rows ();
int nc = arg.columns ();
galois m = ((const octave_galois&) arg.get_rep ()).galois_value ();
int arg_is_empty = arg.OV_ISEMPTY ();
if (arg_is_empty < 0)
return retval;
else if (arg_is_empty > 0)
{
retval = new octave_galois (galois (1, 1, 1, m.m (), m.primpoly ()));
return retval;
}
if (nr != nc)
{
OCTAVE__ERR_SQUARE_MATRIX_REQUIRED ("det");
return retval;
}
retval = new octave_galois (m.determinant ());
return retval;
}
/*
%% Test input validation
%!error gdet ()
%!error gdet (1, 2)
*/
// PKG_ADD: autoload ("grank", "gf.oct");
// PKG_DEL: autoload ("grank", "gf.oct", "remove");
DEFUN_DLD (grank, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{d} =} grank (@var{a})\n\
Compute the rank of the Galois array @var{a} by counting the independent\n\
rows and columns.\n\
@seealso{rank}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin != 1)
{
print_usage ();
return retval;
}
octave_value arg = args(0);
if (!galois_type_loaded || (arg.type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("grank", arg);
return retval;
}
int nr = arg.rows ();
int nc = arg.columns ();
galois m = ((const octave_galois&) arg.get_rep ()).galois_value ();
int arg_is_empty = arg.OV_ISEMPTY ();
if (arg_is_empty > 0)
retval = 0.0;
else if (arg_is_empty == 0)
{
int d = 0;
int mm = m.m ();
int mn = m.n ();
OCTAVE_LOCAL_BUFFER (int, ci, nr);
for (int i = 0; i < nc; i++)
{
int idx = -1;
int iel = 0;
for (int j = 0; j < nr; j++)
{
ci[j] = m.elem (j, i);
if (ci[j] != 0 && idx == -1)
{
iel = ci[j];
idx = j;
}
}
if (idx != -1)
{
d++;
int indx = m.index_of (iel);
for (int j = 0; j < nr; j++)
if (ci[j] != 0)
ci[j] = m.alpha_to (modn (m.index_of (ci[j]) - indx + mn, mm, mn));
for (int j = i+1; j < nc; j++)
{
if (m.elem (idx, j) != 0)
{
indx = m.index_of (m.elem (idx, j));
for (int k = 0; k < nr; k++)
if (ci[k] != 0)
m.elem (k, j) ^= m.alpha_to (modn (m.index_of (ci[k]) + indx +
mn, mm, mn));
}
}
}
}
retval = (double)d;
}
return retval;
}
/*
%% Test input validation
%!error grank ()
%!error grank (1, 2)
*/
// PKG_ADD: autoload ("rsenc", "gf.oct");
// PKG_DEL: autoload ("rsenc", "gf.oct", "remove");
DEFUN_DLD (rsenc, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{code} =} rsenc (@var{msg}, @var{n}, @var{k})\n\
@deftypefnx {Loadable Function} {@var{code} =} rsenc (@var{msg}, @var{n}, @var{k}, @var{g})\n\
@deftypefnx {Loadable Function} {@var{code} =} rsenc (@var{msg}, @var{n}, @var{k}, @var{fcr}, @var{prim})\n\
@deftypefnx {Loadable Function} {@var{code} =} rsenc (@dots{}, @var{parpos})\n\
Encodes the message @var{msg} using a [@var{n},@var{k}] Reed-Solomon coding.\n\
The variable @var{msg} is a Galois array with @var{k} columns and an arbitrary\n\
number of rows. Each row of @var{msg} represents a single block to be coded\n\
by the Reed-Solomon coder. The coded message is returned in the Galois\n\
array @var{code} containing @var{n} columns and the same number of rows as\n\
@var{msg}.\n\
\n\
The use of @code{rsenc} can be seen in the following short example.\n\
\n\
@example\n\
m = 3; n = 2^m -1; k = 3;\n\
msg = gf ([1 2 3; 4 5 6], m);\n\
code = rsenc (msg, n, k);\n\
@end example\n\
\n\
If @var{n} does not equal @code{2^@var{m}-1}, where m is an integer, then a\n\
shorten Reed-Solomon coding is used where zeros are added to the start of\n\
each row to obtain an allowable codeword length. The returned @var{code}\n\
has these prepending zeros stripped.\n\
\n\
By default the generator polynomial used in the Reed-Solomon coding is based\n\
on the properties of the Galois Field in which @var{msg} is given. This\n\
default generator polynomial can be overridden by a polynomial in @var{g}.\n\
Suitable generator polynomials can be constructed with @code{rsgenpoly}.\n\
@var{fcr} is an integer value, and it is taken to be the first consecutive\n\
root of the generator polynomial. The variable @var{prim} is then the\n\
primitive element used to construct the generator polynomial, such that\n\
@tex\n\
$g = (x - A^b) (x - A^{b+p}) \\cdots (x - A ^{b+2tp-1})$.\n\
@end tex\n\
@ifnottex\n\
\n\
@var{g} = (@var{x} - A^@var{b}) * (@var{x} - A^(@var{b}+@var{prim})) * ... * (@var{x} - A^(@var{b}+2*@var{t}*@var{prim}-1)).\n\
@end ifnottex\n\
\n\
where @var{b} is equal to @code{@var{fcr} * @var{prim}}. By default @var{fcr}\n\
and @var{prim} are both 1.\n\
\n\
By default the parity symbols are placed at the end of the coded message.\n\
The variable @var{parpos} controls this positioning and can take the values\n\
@code{\"beginning\"} or @code{\"end\"}.\n\
@seealso{gf, rsdec, rsgenpoly}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin < 3 || nargin > 5)
{
print_usage ();
return retval;
}
if (!galois_type_loaded || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("rsenc", args(0));
return retval;
}
galois msg = ((const octave_galois&) args(0).get_rep ()).galois_value ();
int nsym = msg.rows ();
int primpoly = msg.primpoly ();
int n = args(1).nint_value ();
int k = args(2).nint_value ();
int m = 1;
while (n > (1< __OCTAVE_GALOIS_MAX_M))
{
error ("rsenc: invalid values of message and codeword length");
return retval;
}
if ((n-k) & 1)
{
error ("rsenc: difference of message and codeword length must be even");
return retval;
}
int nroots = n-k;
galois genpoly;
bool have_genpoly = false;
bool parity_at_end = true;
int fcr = 0;
int prim = 0;
for (int i = 3; i < nargin; i++)
{
if (args(i).is_string ())
{
std::string parstr = args(i).string_value ();
for (int j = 0; j < (int)parstr.length (); j++)
parstr[j] = toupper (parstr[j]);
if (!parstr.compare("END"))
{
parity_at_end = true;
}
else if (!parstr.compare("BEGINNING"))
{
parity_at_end = false;
}
else
{
error ("rsenc: unrecoginized parity position");
return retval;
}
}
else
{
if (args(i).type_id () == octave_galois::static_type_id ())
{
if (have_genpoly)
{
print_usage ();
return retval;
}
genpoly = ((const octave_galois&) args(i).get_rep ()).galois_value ();
if (genpoly.cols () > genpoly.rows ())
genpoly = genpoly.transpose ();
}
else
{
if (have_genpoly)
{
if (prim != 0)
{
print_usage ();
return retval;
}
prim = args(i).nint_value ();
}
else
fcr = args(i).nint_value ();
}
have_genpoly = true;
}
}
if ((genpoly.rows () == 0) || (genpoly.cols () == 0))
{
if (fcr == 0)
fcr = 1;
if (prim == 0)
prim = 1;
// Create polynomial of right length.
genpoly = galois (nroots+1, 1, 0, m, primpoly);
genpoly(nroots, 0) = 1;
int i, root;
for (i = 0, root=fcr*prim; i < nroots; i++, root += prim)
{
genpoly(nroots-i-1, 0) = 1;
// Multiply genpoly by @**(root + x)
for (int j = i; j > 0; j--)
{
int k = nroots - j;
if (genpoly(k, 0) != 0)
genpoly(k, 0) = genpoly(k+1, 0)
^ genpoly.alpha_to (modn (genpoly.index_of (genpoly(k, 0))
+ root, m, n));
else
genpoly(k, 0) = genpoly(k+1, 0);
}
// genpoly(nroots,0) can never be zero
genpoly(nroots, 0) = genpoly.alpha_to (modn (genpoly.index_of (genpoly(nroots, 0))
+ root, m, n));
}
}
else
{
if (genpoly.cols () != 1)
{
error ("rsenc: the generator polynomial must be a vector");
return retval;
}
if (genpoly.primpoly () != primpoly)
{
error ("rsenc: the generator polynomial must be same galois field "
"as the message");
return retval;
}
if (genpoly.rows () != nroots+1)
{
error ("rsenc: generator polynomial has incorrect order");
return retval;
}
}
int norm = genpoly(0, 0);
// Take logarithm of generator polynomial, for faster coding
for (int i = 0; i < nroots+1; i++)
genpoly(i, 0) = genpoly.index_of (genpoly(i, 0));
// Add space for parity block
msg.resize (dim_vector (nsym, n), 0);
// The code below basically finds the parity bits by treating the
// message as a polynomial and dividing it by the generator polynomial.
// The parity bits are then the remainder of this division. If the parity
// is at the end the polynomial is treat MSB first, otherwise it is
// treated LSB first
//
// This code could just as easily be written as
// [ignore par] = gdeconv(msg, genpoly);
// But the code below has the advantage of being 20 times faster :-)
if (parity_at_end)
{
for (int l = 0; l < nsym; l++)
{
galois par (nroots, 1, 0, m, primpoly);
for (int i = 0; i < k; i++)
{
int feedback = par.index_of (par(0, 0) ^ msg(l, i));
if (feedback != nn)
{
if (norm != 1)
feedback = modn (nn-genpoly(0, 0)+feedback, m, nn);
for (int j = 1; j < nroots; j++)
par(j, 0) ^= par.alpha_to (modn (feedback +
genpoly(j, 0), m, nn));
}
for (int j = 1; j < nroots; j++)
par(j-1, 0) = par(j, 0);
if (feedback != nn)
par(nroots-1, 0) = par.alpha_to (modn (feedback+
genpoly(nroots, 0), m, nn));
else
par(nroots-1, 0) = 0;
}
for (int j = 0; j < nroots; j++)
msg(l, k+j) = par(j, 0);
}
}
else
{
for (int l = 0; l < nsym; l++)
{
for (int i=k; i > 0; i--)
msg(l, i+nroots-1) = msg(l, i-1);
for (int i = 0; i nroots; i--)
{
int feedback = par.index_of (par(0, 0) ^ msg(l, i-1));
if (feedback != nn)
{
if (norm != 1)
feedback = modn (nn-genpoly(0, 0)+feedback, m, nn);
for (int j = 1; j < nroots; j++)
par(j, 0) ^= par.alpha_to (modn (feedback +
genpoly(j, 0), m, nn));
}
for (int j = 1; j < nroots; j++)
par(j-1, 0) = par(j, 0);
if (feedback != nn)
par(nroots-1, 0) = par.alpha_to (modn (feedback+
genpoly(nroots, 0), m, nn));
else
par(nroots-1, 0) = 0;
}
for (int j = 0; j < nroots; j++)
msg(l, j) = par(nroots-j-1, 0);
}
}
retval = new octave_galois (msg);
return retval;
}
/*
%% Test input validation
%!error rsenc ()
%!error rsenc (1)
%!error rsenc (1, 2)
%!error rsenc (1, 2, 3, 4, 5, 6)
*/
int
decode_rs(galois& data, const int prim, const int iprim, const int nroots,
const int fcr, const int drow, const bool msb_first)
{
int deg_lambda, el, deg_omega;
int i, j, r, k;
int q, tmp, num1, num2, den, discr_r;
int syn_error, count;
int m = data.m ();
int n = data.n ();
int A0 = n;
/* Err Locator and syndrome poly */
OCTAVE_LOCAL_BUFFER (int, lambda, nroots+1);
OCTAVE_LOCAL_BUFFER (int, s, nroots);
OCTAVE_LOCAL_BUFFER (int, b, nroots+1);
OCTAVE_LOCAL_BUFFER (int, t, nroots+1);
OCTAVE_LOCAL_BUFFER (int, omega, nroots+1);
OCTAVE_LOCAL_BUFFER (int, root, nroots);
OCTAVE_LOCAL_BUFFER (int, reg, nroots+1);
OCTAVE_LOCAL_BUFFER (int, loc, nroots);
/* form the syndromes; i.e., evaluate data(x) at roots of g(x) */
if (msb_first)
{
for (i = 0; i < nroots; i++)
s[i] = data(drow, 0);
for (j = 1; j < n; j++)
for (i = 0; i0; j--)
for (i = 0; i < nroots; i++)
if(s[i] == 0)
s[i] = data(drow, j-1);
else
s[i] = data(drow, j-1) ^ data.alpha_to (modn (data.index_of (s[i]) +
(fcr+i)*prim, m, n));
}
/* Convert syndromes to index form, checking for nonzero condition */
syn_error = 0;
for (i = 0; i < nroots; i++)
{
syn_error |= s[i];
s[i] = data.index_of (s[i]);
}
if (!syn_error)
/* if syndrome is zero, data(drow,:) is a codeword and there are no
* errors to correct. So return data(drow,:) unmodified
*/
return 0;
memset(&lambda[1], 0, nroots*sizeof (lambda[0]));
lambda[0] = 1;
for (i = 0; i < nroots+1; i++)
b[i] = data.index_of (lambda[i]);
/*
* Begin Berlekamp-Massey algorithm to determine error locator polynomial
*/
r = 0;
el = 0;
while (++r <= nroots)
{/* r is the step number */
/* Compute discrepancy at the r-th step in poly-form */
discr_r = 0;
for (i = 0; i < r; i++)
{
if ((lambda[i] != 0) && (s[r-i-1] != A0))
{
discr_r ^= data.alpha_to (modn (data.index_of (lambda[i]) +
s[r-i-1], m, n));
}
}
discr_r = data.index_of (discr_r); /* Index form */
if (discr_r == A0)
{
/* 2 lines below: B(x) <-- x*B(x) */
memmove(&b[1], b, nroots*sizeof (b[0]));
b[0] = A0;
}
else
{
/* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
t[0] = lambda[0];
for (i = 0 ; i < nroots; i++)
{
if(b[i] != A0)
t[i+1] = lambda[i+1] ^ data.alpha_to (modn (discr_r + b[i], m, n));
else
t[i+1] = lambda[i+1];
}
if (2 * el <= r - 1)
{
el = r - el;
/*
* 2 lines below: B(x) <-- inv(discr_r) *
* lambda(x)
*/
for (i = 0; i <= nroots; i++)
b[i] = (lambda[i] == 0) ? A0 : modn (data.index_of (lambda[i]) -
discr_r + n, m, n);
}
else
{
/* 2 lines below: B(x) <-- x*B(x) */
memmove(&b[1], b, nroots*sizeof (b[0]));
b[0] = A0;
}
memcpy(lambda, t, (nroots+1)*sizeof (t[0]));
}
}
/* Convert lambda to index form and compute deg(lambda(x)) */
deg_lambda = 0;
for (i = 0; i < nroots+1; i++)
{
lambda[i] = data.index_of (lambda[i]);
if(lambda[i] != A0)
deg_lambda = i;
}
/* Find roots of the error locator polynomial by Chien search */
memcpy(®[1], &lambda[1], nroots*sizeof (reg[0]));
count = 0; /* Number of roots of lambda(x) */
for (i = 1, k = iprim-1; i <= n; i++, k = modn (k+iprim, m, n))
{
q = 1; /* lambda[0] is always 0 */
for (j = deg_lambda; j > 0; j--)
{
if (reg[j] != A0)
{
reg[j] = modn (reg[j] + j, m, n);
q ^= data.alpha_to (reg[j]);
}
}
if (q != 0)
continue; /* Not a root */
/* store root (index-form) and error location number */
root[count] = i;
loc[count] = k;
/* If we've already found max possible roots,
* abort the search to save time
*/
if(++count == deg_lambda)
break;
}
if (deg_lambda != count)
{
/*
* deg(lambda) unequal to number of roots => uncorrectable
* error detected
*/
return -1;
}
/*
* Compute err evaluator poly omega(x) = s(x)*lambda(x) (modulo
* x**nroots). in index form. Also find deg(omega).
*/
deg_omega = 0;
for (i = 0; i < nroots; i++)
{
tmp = 0;
j = (deg_lambda < i) ? deg_lambda : i;
for (; j >= 0; j--)
{
if ((s[i - j] != A0) && (lambda[j] != A0))
tmp ^= data.alpha_to (modn (s[i - j] + lambda[j], m, n));
}
if(tmp != 0)
deg_omega = i;
omega[i] = data.index_of (tmp);
}
omega[nroots] = A0;
/*
* Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
* inv(X(l))**(fcr-1) and den = lambda_pr(inv(X(l))) all in poly-form
*/
for (j = count-1; j >= 0; j--)
{
num1 = 0;
for (i = deg_omega; i >= 0; i--)
{
if (omega[i] != A0)
num1 ^= data.alpha_to (modn (omega[i] + i * root[j], m, n));
}
num2 = data.alpha_to (modn (root[j] * (fcr - 1) + n, m, n));
den = 0;
/* lambda[i+1] for i even is the formal deriv lambda_pr of lambda[i] */
for (i = (deg_lambda < nroots-1 ? deg_lambda : nroots-1) & ~1; i >= 0;
i -=2)
{
if(lambda[i+1] != A0)
den ^= data.alpha_to (modn (lambda[i+1] + i * root[j], m, n));
}
if (den == 0)
{
count = -1;
break;
}
/* Apply error to data */
if (num1 != 0)
{
if (msb_first)
data(drow, loc[j]) ^= data.alpha_to (modn (data.index_of (num1)
+ data.index_of (num2)
+ n - data.index_of (den),
m, n));
else
data(drow, n-loc[j]-1) ^= data.alpha_to (modn (data.index_of (num1)
+ data.index_of (num2)
+ n - data.index_of (den),
m, n));
}
}
return count;
}
// PKG_ADD: autoload ("rsdec", "gf.oct");
// PKG_DEL: autoload ("rsdec", "gf.oct", "remove");
DEFUN_DLD (rsdec, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{msg} =} rsdec (@var{code}, @var{n}, @var{k})\n\
@deftypefnx {Loadable Function} {@var{msg} =} rsdec (@var{code}, @var{n}, @var{k}, @var{g})\n\
@deftypefnx {Loadable Function} {@var{msg} =} rsdec (@var{code}, @var{n}, @var{k}, @var{fcr}, @var{prim})\n\
@deftypefnx {Loadable Function} {@var{msg} =} rsdec (@dots{}, @var{parpos})\n\
@deftypefnx {Loadable Function} {[@var{msg}, @var{nerr}] =} rsdec (@dots{})\n\
@deftypefnx {Loadable Function} {[@var{msg}, @var{nerr}, @var{ccode}] =} rsdec (@dots{})\n\
Decodes the message contained in @var{code} using a [@var{n},@var{k}]\n\
Reed-Solomon code. The variable @var{code} must be a Galois array with\n\
@var{n} columns and an arbitrary number of rows. Each row of @var{code}\n\
represents a single block to be decoded by the Reed-Solomon coder. The\n\
decoded message is returned in the variable @var{msg} containing @var{k}\n\
columns and the same number of rows as @var{code}.\n\
\n\
If @var{n} does not equal @code{2^@var{m}-1}, where m is an integer, then a\n\
shorten Reed-Solomon decoding is used where zeros are added to the start of\n\
each row to obtain an allowable codeword length. The returned @var{msg}\n\
has these prepending zeros stripped.\n\
\n\
By default the generator polynomial used in the Reed-Solomon coding is based\n\
on the properties of the Galois Field in which @var{msg} is given. This\n\
default generator polynomial can be overridden by a polynomial in @var{g}.\n\
Suitable generator polynomials can be constructed with @code{rsgenpoly}.\n\
@var{fcr} is an integer value, and it is taken to be the first consecutive\n\
root of the generator polynomial. The variable @var{prim} is then the\n\
primitive element used to construct the generator polynomial. By default\n\
@var{fcr} and @var{prim} are both 1. It is significantly faster to specify\n\
the generator polynomial in terms of @var{fcr} and @var{prim}, since @var{g}\n\
is converted to this form in any case.\n\
\n\
By default the parity symbols are placed at the end of the coded message.\n\
The variable @var{parpos} controls this positioning and can take the values\n\
@code{\"beginning\"} or @code{\"end\"}. If the parity symbols are at the end, the message is\n\
treated with the most-significant symbol first, otherwise the message is\n\
treated with the least-significant symbol first.\n\
@seealso{gf, rsenc, rsgenpoly}\n\
@end deftypefn")
{
octave_value_list retval;
int nargin = args.length ();
if (nargin < 3 || nargin > 5)
{
print_usage ();
return retval;
}
if (!galois_type_loaded || (args(0).type_id () !=
octave_galois::static_type_id ()))
{
OCTAVE__ERR_WRONG_TYPE_ARG ("rsdec", args(0));
return retval;
}
galois code = ((const octave_galois&) args(0).get_rep ()).galois_value ();
int nsym = code.rows ();
int primpoly = code.primpoly ();
int n = args(1).nint_value ();
int k = args(2).nint_value ();
int m = 1;
while (n > (1< __OCTAVE_GALOIS_MAX_M))
{
error ("rsdec: invalid values of message and codeword length");
return retval;
}
if ((n-k) & 1)
{
error ("rsdec: difference of message and codeword length must be even");
return retval;
}
int nroots = n-k;
galois genpoly;
bool have_genpoly = false;
bool parity_at_end = true;
int fcr = 0;
int prim = 0;
int iprim;
for (int i = 3; i < 6; i++)
{
if (nargin > i)
{
if (args(i).is_string ())
{
std::string parstr = args(i).string_value ();
for (int j = 0; j < (int)parstr.length (); j++)
parstr[j] = toupper (parstr[j]);
if (!parstr.compare("END"))
{
parity_at_end = true;
}
else if (!parstr.compare("BEGINNING"))
{
parity_at_end = false;
}
else
{
error ("rsdec: unrecoginized parrity position");
return retval;
}
}
else
{
if (args(i).type_id () == octave_galois::static_type_id ())
{
if (have_genpoly)
{
print_usage ();
return retval;
}
genpoly = ((const octave_galois&) args(i).get_rep ()).galois_value ();
}
else
{
if (have_genpoly)
{
if (prim != 0)
{
print_usage ();
return retval;
}
prim = args(i).nint_value ();
}
else
fcr = args(i).nint_value ();
}
have_genpoly = true;
}
}
}
if (have_genpoly)
{
if (fcr != 0)
{
if ((fcr < 1) || (fcr > nn))
{
error ("rsdec: invalid first consecutive root of generator polynomial");
return retval;
}
if ((prim < 1) || (prim > nn))
{
error ("rsdec: invalid primitive element of generator polynomial");
return retval;
}
}
else
{
if (genpoly.cols () > genpoly.rows ())
genpoly = genpoly.transpose ();
if (genpoly.cols () != 1)
{
error ("rsdec: the generator polynomial must be a vector");
return retval;
}
if (genpoly.primpoly () != primpoly)
{
error ("rsdec: the generator polynomial must be same galois "
"field as the message");
return retval;
}
if (genpoly.rows () != nroots+1)
{
error ("rsdec: generator polynomial has incorrect order");
return retval;
}
// Find the roots of the generator polynomial
int count = 0;
OCTAVE_LOCAL_BUFFER (int, roots, nroots);
for (int j = 0; j <= nn; j++)
{
// Evaluate generator polynomial at j
int val = genpoly(0, 0);
int indx = genpoly.index_of (j);
for (int i = 0; i 0; i--)
code(l, i+nn-n-1) = code(l, i-1);
}
for (int l = 0; l < nsym; l++)
nerr(l) = decode_rs (code, prim, iprim, nroots, fcr, l, parity_at_end);
if (nn != n)
{
if (parity_at_end)
for (int l = 0; l < nsym; l++)
for (int i = 0; i > n; i--)
code(l, i) = code(l, i+nn-n);
code.resize (dim_vector (nsym, n), 0);
}
if (parity_at_end)
{
for (int l = 0; l < nsym; l++)
for (int i = 0; i < k; i++)
msg(l, i) = code(l, i);
}
else
{
for (int l = 0; l < nsym; l++)
for (int i = 0; i < k; i++)
msg(l, i) = code(l, nroots+i);
}
retval(0) = new octave_galois (msg);
retval(1) = octave_value (nerr);
retval(2) = new octave_galois (code);
return retval;
}
/*
%% Test input validation
%!error rsdec ()
%!error rsdec (1)
%!error rsdec (1, 2)
%!error rsdec (1, 2, 3, 4, 5, 6)
*/
// PKG_ADD: autoload ("bchenco", "gf.oct");
// PKG_DEL: autoload ("bchenco", "gf.oct", "remove");
DEFUN_DLD (bchenco, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{code} =} bchenco (@var{msg}, @var{n}, @var{k})\n\
@deftypefnx {Loadable Function} {@var{code} =} bchenco (@var{msg}, @var{n}, @var{k}, @var{g})\n\
@deftypefnx {Loadable Function} {@var{code} =} bchenco (@dots{}, @var{parpos})\n\
Encodes the message @var{msg} using a [@var{n},@var{k}] BCH coding.\n\
The variable @var{msg} is a binary array with @var{k} columns and an\n\
arbitrary number of rows. Each row of @var{msg} represents a single symbol\n\
to be coded by the BCH coder. The coded message is returned in the binary\n\
array @var{code} containing @var{n} columns and the same number of rows as\n\
@var{msg}.\n\
\n\
The use of @code{bchenco} can be seen in the following short example.\n\
\n\
@example\n\
m = 3; n = 2^m -1; k = 4;\n\
msg = randint (10,k);\n\
code = bchenco (msg, n, k);\n\
@end example\n\
\n\
Valid codes can be found using @code{bchpoly}. In general the codeword\n\
length @var{n} should be of the form @code{2^@var{m}-1}, where m is an\n\
integer. However, shortened BCH codes can be used such that if\n\
@code{[2^@var{m}-1,@var{k}]} is a valid code\n\
@code{[2^@var{m}-1-@var{x},@var{k}-@var{x}]}\n is also a valid code using\n\
the same generator polynomial.\n\
\n\
By default the generator polynomial used in the BCH coding is\n\
based on the properties of the Galois Field GF(2^@var{m}). This\n\
default generator polynomial can be overridden by a polynomial in @var{g}.\n\
Suitable generator polynomials can be constructed with @code{bchpoly}.\n\
\n\
By default the parity symbols are placed at the beginning of the coded\n\
message. The variable @var{parpos} controls this positioning and can take\n\
the values @code{\"beginning\"} or @code{\"end\"}.\n\
@seealso{bchpoly, bchdeco, encode}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
if (nargin < 3 || nargin > 5)
{
print_usage ();
return retval;
}
Matrix msg = args(0).matrix_value ();
int nsym = msg.rows ();
int nn = args(1).nint_value ();
int k = args(2).nint_value ();
int m = 1;
while (nn > (1< __OCTAVE_GALOIS_MAX_M))
{
error ("bchenco: invalid values of message or codeword length");
return retval;
}
galois genpoly;
bool have_genpoly = false;
bool parity_at_end = false;
for (int i = 3; i < nargin; i++)
{
if (args(i).is_string ())
{
std::string parstr = args(i).string_value ();
for (int j = 0; j < (int)parstr.length (); j++)
parstr[j] = toupper (parstr[j]);
if (!parstr.compare("END"))
{
parity_at_end = true;
}
else if (!parstr.compare("BEGINNING"))
{
parity_at_end = false;
}
else
{
error ("bchenco: unrecoginized parity position");
return retval;
}
}
else
{
have_genpoly = true;
genpoly = galois (args(i).matrix_value (), m);
if (genpoly.cols () > genpoly.rows ())
genpoly = genpoly.transpose ();
if (genpoly.cols () != 1)
{
error ("bchenco: the generator polynomial must be a vector");
return retval;
}
if (genpoly.rows () != nn-k+1)
{
error ("bchenco: generator polynomial has incorrect order");
return retval;
}
}
}
if (!have_genpoly)
{
// The code below is basically bchpoly.m in C++, so if there is a need
// it can be used to rewrite bchpoly as an oct-file...
RowVector found (n, 0);
found(0) = 1;
galois c (1, m, 0, m);
c(0, 0) = c.index_of (1);
Array cs (dim_vector (1, 1), 1);
int nc = 1;
// Find the cyclotomic cosets of GF(2^m)
while (found.min () == 0)
{
int idx = n;
for (int i = 0; i idx)
{
c(nc, cs(nc)) = r;
found(c.alpha_to (r)-1) = 1;
cs(nc) += 1;
}
nc++;
}
// Re-use the found vector with 1==not-found !!!
found.resize (nc);
galois f (1, 0, 0, m);
int t = 0;
int nf = 0;
do
{
t++;
for (int i = 0; i < nc; i++)
{
if (found(i) == 1)
{
for (int j = 2*(t-1); j<2*t; j++)
{
int flag = 0;
for (int l = 0; l < cs(i); l++)
{
if (c(i, l) == j+1)
{
f.resize (dim_vector (1, nf+cs(i)));
for (int ll = 0; ll < cs(i); ll++)
f(0, nf+ll) = c(i, ll);
found(i) = 0;
nf += cs(i);
flag = 1;
break;
}
}
if (flag) break;
}
}
}
}
while (nf < nn - k);
if (nf != nn - k)
{
error ("bchenco: can not find valid generator polynomial for parameters");
return retval;
}
// Create polynomial of right length.
genpoly = galois (nf+1, 1, 0, m);
genpoly(0, 0) = 1;
for (int i = 0; i < nf; i++)
{
genpoly(i+1, 0) = 1;
// Multiply genpoly by @**(root + x)
for (int l = i; l > 0; l--)
{
if (genpoly(l, 0) != 0)
genpoly(l, 0) = genpoly(l-1, 0)
^ genpoly.alpha_to (modn (genpoly.index_of (genpoly(l, 0)) + f(0, i),
m, n));
else
genpoly(l, 0) = genpoly(l-1, 0);
}
// genpoly(0,0) can never be zero
genpoly(0, 0) = genpoly.alpha_to (modn (genpoly.index_of (genpoly(0, 0))
+ f(0, i),
m, n));
}
}
// Add space for parity block
msg.resize (nsym, nn, 0);
// The code below basically finds the parity bits by treating the
// message as a polynomial and dividing it by the generator polynomial.
// The parity bits are then the remainder of this division.
//
// This code could just as easily be written as
// [ignore par] = gdeconv(gf(msg), gf(genpoly));
// But the code below has the advantage of being 20 times faster :-)
if (parity_at_end)
{
for (int l = 0; l < nsym; l++)
{
for (int i = 0; i < k; i++)
{
int feedback = (int)msg(l, i) ^ (int)msg(l, k);
if (feedback != 0)
{
for (int j = 0; j < nn-k-1; j++)
if (genpoly(nn-k-j-1, 0) != 0)
msg(l, k+j) = (int)msg(l, k+j+1) ^ feedback;
else
msg(l, k+j) = msg(l, k+j+1);
msg(l, nn-1) = genpoly(0, 0) & feedback;
}
else
{
for (int j = k; j < nn-1; j++)
msg(l, j) = msg(l, j+1);
msg(l, nn-1) = 0;
}
}
}
}
else
{
for (int l = 0; l < nsym; l++)
{
for (int i=k; i > 0; i--)
msg(l, i+nn-k-1) = msg(l, i-1);
for (int i = 0; i= 0; i--)
{
int feedback = (int)msg(l, nn-k+i) ^ (int)msg(l, nn-k-1);
if (feedback != 0)
{
for (int j = nn - k -1; j > 0; j--)
if (genpoly(j, 0) != 0)
msg(l, j) = (int)msg(l, j-1) ^ feedback;
else
msg(l, j) = msg(l, j-1);
msg(l, 0) = genpoly(0, 0) & feedback;
}
else
{
for (int j = nn - k - 1; j > 0; j--)
msg(l, j) = msg(l, j-1);
msg(l, 0) = 0;
}
}
}
}
retval = msg;
return retval;
}
/*
%% Test input validation
%!error bchenco ()
%!error bchenco (1)
%!error bchenco (1, 2)
%!error bchenco (1, 2, 3, 4, 5, 6)
*/
// PKG_ADD: autoload ("bchdeco", "gf.oct");
// PKG_DEL: autoload ("bchdeco", "gf.oct", "remove");
DEFUN_DLD (bchdeco, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{msg} =} bchdeco (@var{code}, @var{k}, @var{t})\n\
@deftypefnx {Loadable Function} {@var{msg} =} bchdeco (@var{code}, @var{k}, @var{t}, @var{prim})\n\
@deftypefnx {Loadable Function} {@var{msg} =} bchdeco (@dots{}, @var{parpos})\n\
@deftypefnx {Loadable Function} {[@var{msg}, @var{err}] =} bchdeco (@dots{})\n\
@deftypefnx {Loadable Function} {[@var{msg}, @var{err}, @var{ccode}] =} bchdeco (@dots{})\n\
Decodes the coded message @var{code} using a BCH coder. The message length\n\
of the coder is defined in variable @var{k}, and the error correction\n\
capability of the code is defined in @var{t}.\n\
\n\
The variable @var{code} is a binary array with @var{n} columns and an\n\
arbitrary number of rows. Each row of @var{code} represents a single symbol\n\
to be decoded by the BCH coder. The decoded message is returned in the\n\
binary array @var{msg} containing @var{k} columns and the same number of\n\
rows as @var{code}.\n\
\n\
The use of @code{bchdeco} can be seen in the following short example.\n\
\n\
@example\n\
m = 3; n = 2^m -1; k = 4; t = 1;\n\
msg = randint (10, k);\n\
code = bchenco (msg, n, k);\n\
noisy = mod (randerr (10,n) + code, 2);\n\
[dec, err] = bchdeco (msg, k, t);\n\
@end example\n\
\n\
Valid codes can be found using @code{bchpoly}. In general the codeword\n\
length @var{n} should be of the form @code{2^@var{m}-1}, where m is an\n\
integer. However, shortened BCH codes can be used such that if\n\
@code{[2^@var{m}-1,@var{k}]} is a valid code\n\
@code{[2^@var{m}-1-@var{x},@var{k}-@var{x}]}\n is also a valid code using\n\
the same generator polynomial.\n\
\n\
By default the BCH coding is based on the properties of the Galois\n\
Field GF(2^@var{m}). The primitive polynomial used in the Galois\n\
can be overridden by a primitive polynomial in @var{prim}. Suitable\n\
primitive polynomials can be constructed with @code{primpoly}. The form\n\
of @var{prim} maybe be either a integer representation of the primitive\n\
polynomial as given by @code{primpoly}, or a binary representation that\n\
might be constructed like\n\
\n\
@example\n\
m = 3;\n\
prim = de2bi (primpoly (m));\n\
@end example\n\
\n\
By default the parity symbols are assumed to be placed at the beginning of\n\
the coded message. The variable @var{parpos} controls this positioning and\n\
can take the values @code{\"beginning\"} or @code{\"end\"}.\n\
@seealso{bchpoly, bchenco, decode, primpoly}\n\
@end deftypefn")
{
octave_value_list retval;
int nargin = args.length ();
if (nargin < 3 || nargin > 5)
{
print_usage ();
return retval;
}
Matrix code = args(0).matrix_value ();
int nsym = code.rows ();
int nn = code.cols ();
int k = args(1).nint_value ();
int t = args(2).nint_value ();
int t2 = t << 1;
int m = 1;
while (nn > (1< __OCTAVE_GALOIS_MAX_M))
{
error ("bchdeco: invalid values of message or codeword length");
return retval;
}
int prim = 0; // primitve polynomial of zero flags default
bool parity_at_end = false;
for (int i = 3; i < nargin; i++)
{
if (args(i).is_string ())
{
std::string parstr = args(i).string_value ();
for (int j = 0; j < (int)parstr.length (); j++)
parstr[j] = toupper (parstr[j]);
if (!parstr.compare("END"))
{
parity_at_end = true;
}
else if (!parstr.compare("BEGINNING"))
{
parity_at_end = false;
}
else
{
error ("bchdeco: unrecoginized parity position");
return retval;
}
}
else
{
if (args(i).is_real_scalar ())
prim = args(i).int_value ();
else
{
Matrix tmp = args(i).matrix_value ();
if (tmp.cols () > tmp.rows ())
tmp = tmp.transpose ();
if (tmp.cols () != 1)
{
error ("bchdeco: the primitve polynomial must be a scalar "
"or a vector");
return retval;
}
prim = 0;
for (int i = 0; i < tmp.rows (); i++)
if ((int)tmp(i, 0) & 1)
prim |= (1< s (dim_vector(t2+1, 1), 0);
bool syn_error = false;
for (int i = 1; i <= t2; i++)
{
for (int j = 0; j < nn; j++)
{
if (parity_at_end)
{
if (code(lsym, nn-j-1) != 0)
s(i) ^= tables.alpha_to (modn (i*j, m, n));
}
else
{
if (code(lsym, j) != 0)
s(i) ^= tables.alpha_to (modn (i*j, m, n));
}
}
if (s(i) != 0)
syn_error = true; /* set error flag if non-zero syndrome */
}
if (syn_error)
{ /* if there are errors, try to correct them */
int q, u;
Array d (dim_vector (t2+2, 1)), l(dim_vector (t2+2, 1)),
u_lu(dim_vector (t2+2, 1)), reg(dim_vector (t2+2, 1)),
elp(dim_vector (t2+2, t2+2));
/* convert syndrome from polynomial form to index form */
for (int i = 1; i <= t2; i++)
s(i) = tables.index_of (s(i));
/*
* Compute the error location polynomial via the Berlekamp
* iterative algorithm. Following the terminology of Lin and
* Costello's book : d(u) is the 'mu'th discrepancy, where
* u='mu'+1 and 'mu' (the Greek letter!) is the step number
* ranging from -1 to 2*t (see L&C), l(u) is the degree of
* the elp at that step, and u_l(u) is the difference between
* the step number and the degree of the elp.
*/
/* initialise table entries */
d(0) = 0; /* index form */
d(1) = s(1); /* index form */
elp(0, 0) = 0; /* index form */
elp(1, 0) = 1; /* polynomial form */
for (int i = 1; i < t2; i++)
{
elp(0, i) = n; /* index form */
elp(1, i) = 0; /* polynomial form */
}
l(0) = 0;
l(1) = 0;
u_lu(0) = -1;
u_lu(1) = 0;
u = 0;
do
{
u++;
if (d(u) == n)
{
l(u + 1) = l(u);
for (int i = 0; i <= l(u); i++)
{
elp(u + 1, i) = elp(u, i);
elp(u, i) = tables.index_of (elp(u, i));
}
}
else
/*
* search for words with greatest u_lu(q) for
* which d(q)!=0
*/
{
q = u - 1;
while ((d(q) == n) && (q > 0))
q--;
/* have found first non-zero d(q) */
if (q > 0)
{
int j = q;
do
{
j--;
if ((d(j) != n) && (u_lu(q) < u_lu(j)))
q = j;
}
while (j > 0);
}
/*
* have now found q such that d(u)!=0 and
* u_lu(q) is maximum
*/
/* store degree of new elp polynomial */
if (l(u) > l(q) + u - q)
l(u + 1) = l(u);
else
l(u + 1) = l(q) + u - q;
/* form new elp(x) */
for (int i = 0; i < t2; i++)
elp(u + 1, i) = 0;
for (int i = 0; i <= l(q); i++)
if (elp(q, i) != n)
elp(u + 1, i + u - q) =
tables.alpha_to (modn ((d(u) + n - d(q) + elp(q, i)), m, n));
for (int i = 0; i <= l(u); i++)
{
elp(u + 1, i) ^= elp(u, i);
elp(u, i) = tables.index_of (elp(u, i));
}
}
u_lu(u + 1) = u - l(u + 1);
/* form (u+1)th discrepancy */
if (u < t2)
{
/* no discrepancy computed on last iteration */
d(u + 1) = tables.alpha_to (s(u + 1));
for (int i = 1; i <= l(u + 1); i++)
if ((s(u + 1 - i) != n) && (elp(u + 1, i) != 0))
d(u + 1) ^= tables.alpha_to (modn (s(u + 1 - i)
+ tables.index_of (elp(u + 1, i)),
m, n));
/* put d(u+1) into index form */
d(u + 1) = tables.index_of (d(u + 1));
}
}
while ((u < t2) && (l(u + 1) <= t));
u++;
if (l(u) <= t)
{/* Can correct errors */
int count;
Array loc (dim_vector (t+2, 1));
/* put elp into index form */
for (int i = 0; i <= l(u); i++)
elp(u, i) = tables.index_of (elp(u, i));
/* Chien search: find roots of the error location polynomial */
for (int i = 1; i <= l(u); i++)
reg(i) = elp(u, i);
count = 0;
for (int i = 1; i <= n; i++)
{
q = 1;
for (int j = 1; j <= l(u); j++)
if (reg(j) != n)
{
reg(j) = modn ((reg(j) + j), m, n);
q ^= tables.alpha_to (reg(j));
}
if (!q)
{ /* store root and error
* location number indices */
loc(count) = n - i;
count++;
if (count > l(u))
break;
}
}
if (count == l(u))
{
/* no. roots = degree of elp hence <= t errors */
nerr(lsym) = l(u);
for (int i = 0; i < l(u); i++)
if (parity_at_end)
code(lsym, nn-loc(i)-1) =
(int)code(lsym, nn-loc(i)-1) ^ 1;
else
code(lsym, loc(i)) = (int)code(lsym, loc(i)) ^ 1;
}
else /* elp has degree >t hence cannot solve */
nerr(lsym) = -1;
}
else
nerr(lsym) = -1;
}
}
Matrix msg (nsym, k);
if (parity_at_end)
{
for (int l = 0; l < nsym; l++)
for (int i = 0; i < k; i++)
msg(l, i) = code(l, i);
}
else
{
for (int l = 0; l < nsym; l++)
for (int i = 0; i < k; i++)
msg(l, i) = code(l, nn-k+i);
}
retval(0) = octave_value (msg);
retval(1) = octave_value (nerr);
retval(2) = octave_value (code);
return retval;
}
/*
%% Test input validation
%!error bchdeco ()
%!error bchdeco (1)
%!error bchdeco (1, 2)
%!error bchdeco (1, 2, 3, 4, 5, 6)
*/
communications-1.2.2/src/PaxHeaders.12771/Makefile.in 0000644 0000000 0000000 00000000062 13604150022 017131 x ustar 00 20 atime=1578160146
30 ctime=1578160213.541197341
communications-1.2.2/src/Makefile.in 0000644 0001750 0001750 00000002343 13604150022 017035 0 ustar 00nir nir 0000000 0000000 MKOCTFILE ?= @MKOCTFILE@
OCTAVE ?= @OCTAVE@
SED ?= @SED@
HDF5_CPPFLAGS = @HDF5_CFLAGS@
HDF5_LIBS = @HDF5_LIBS@
PKG_CPPFLAGS = -DGALOIS_DISP_PRIVATES @DEFS@
OCT_FILES = \
__errcore__.oct \
__gfweight__.oct \
cyclgen.oct \
cyclpoly.oct \
genqamdemod.oct \
gf.oct \
isprimitive.oct \
primpoly.oct \
syndtable.oct
GF_OBJECTS = \
galois-def.o \
galois.o \
galoisfield.o \
gf.o \
op-gm-gm.o \
op-gm-m.o \
op-gm-s.o \
op-m-gm.o \
op-s-gm.o \
ov-galois.o
GF_HEADERS = \
galois-def.h \
galois-ops.h \
galois.h \
galoisfield.h \
ov-galois.h
OCT_SOURCES = $(patsubst %.oct,%.cc,$(OCT_FILES))
all: $(OCT_FILES)
%.o: %.cc
$(MKOCTFILE) $(PKG_CPPFLAGS) -c $< -o $@
%.oct: %.cc
$(MKOCTFILE) $(PKG_CPPFLAGS) $< -o $@
gf.oct: $(GF_OBJECTS)
$(MKOCTFILE) $^ $(HDF5_LIBS) -o $@
ov-galois.o: PKG_CPPFLAGS += $(HDF5_CPPFLAGS)
$(GF_OBJECTS): $(GF_HEADERS)
PKG_ADD PKG_DEL: $(OCT_SOURCES)
$(SED) -n -e 's/.*$@: \(.*\)/\1/p' $^ > $@-t
mv $@-t $@
clean:
-rm -f *.o *.oct PKG_*
distclean: clean
-rm -f Makefile config.h config.log config.status oct-alt-includes.h
maintainer-clean: distclean
-rm -rf autom4te.cache configure config.h.in aclocal.m4
.PHONY: all clean distclean maintainer-clean
communications-1.2.2/src/PaxHeaders.12771/ov-galois.cc 0000644 0000000 0000000 00000000074 13604150022 017276 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/ov-galois.cc 0000644 0001750 0001750 00000045707 13604150022 017212 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#include
#include
#ifdef HAVE_OCTAVE_GRIPES_H
#include
#endif
#ifdef HAVE_OCTAVE_ERRWARN_H
#include
#endif
#include
#include
#ifdef HAVE_OCTAVE_OVL_H
#include
#elif HAVE_OCTAVE_OCT_OBJ_H
#include
#endif
#include
#include
#if defined(HAVE_OCTAVE_LS_OCT_TEXT_H)
# include
#else
# include
#endif
#include "galois.h"
#include "ov-galois.h"
#if defined (HAVE_HDF5)
# if defined (HAVE_HDF5_H)
# include
# endif
# if defined (HAVE_OCTAVE_OCT_HDF5_TYPES_H)
# include "oct-hdf5-types.h"
# endif
# if defined (OCTAVE_ENABLE_64)
# define H5T_NATIVE_IDX H5T_NATIVE_INT64
# else
# define H5T_NATIVE_IDX H5T_NATIVE_INT
# endif
#endif
#if ! defined (X_CAST)
# define X_CAST(T, E) (T) (E)
#endif
#if defined (DEFINE_OCTAVE_ALLOCATOR)
DEFINE_OCTAVE_ALLOCATOR (octave_galois);
#endif
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_galois, "galois", "galois");
octave_value
octave_galois::resize (const dim_vector& dv, bool) const
{
if (dv.length () > 2)
{
error ("Can not resize galois structure to NDArray");
return octave_value ();
}
galois retval (gval);
retval.resize (dv);
return new octave_galois (retval);
}
octave_value_list
octave_galois::dotref (const octave_value_list& idx)
{
octave_value_list retval;
assert (idx.length () == 1);
std::string nm = idx(0).string_value ();
if (nm == __GALOIS_PRIMPOLY_STR)
retval(0) = octave_value ((double)gval.primpoly ());
else if (nm == __GALOIS_ORDER_STR)
retval(0) = octave_value ((double)gval.m ());
else if (nm == __GALOIS_DATA_STR)
{
int r = gval.rows ();
int c = gval.columns ();
Matrix data (r, c);
for (int i = 0; i < r; i++)
for (int j = 0; j < c; j++)
data(i, j) = (double)gval(i, j);
retval(0) = octave_value (data);
}
#ifdef GALOIS_DISP_PRIVATES
else if (nm == __GALOIS_LENGTH_STR)
retval(0) = octave_value ((double)gval.n ());
else if (nm == __GALOIS_ALPHA_TO_STR)
{
int n = gval.n ();
Matrix data (n+1, 1);
for (int i = 0; i < n+1; i++)
data(i, 0) = (double)gval.alpha_to (i);
retval(0) = octave_value (data);
}
else if (nm == __GALOIS_INDEX_OF_STR)
{
int n = gval.n ();
Matrix data (n+1, 1);
for (int i = 0; i < n+1; i++)
data(i, 0) = (double)gval.index_of (i);
retval(0) = octave_value (data);
}
#endif
else
error ("galois structure has no member `%s'", nm.c_str ());
return retval;
}
octave_value
octave_galois::do_index_op (const octave_value_list& idx,
bool resize_ok)
{
octave_value retval;
int len = idx.length ();
switch (len)
{
case 2:
{
idx_vector i = idx (0).index_vector ();
idx_vector j = idx (1).index_vector ();
retval = new octave_galois (gval.index (i, j, resize_ok));
}
break;
case 1:
{
idx_vector i = idx (0).index_vector ();
retval = new octave_galois (gval.index (i, resize_ok));
}
break;
default:
{
std::string n = type_name ();
error ("invalid number of indices (%d) for %s value",
len, n.c_str ());
}
break;
}
return retval;
}
octave_value
octave_galois::subsref (const std::string &type,
const std::list& idx)
{
octave_value retval;
int skip = 1;
switch (type[0])
{
case '(':
retval = do_index_op (idx.front (), true);
break;
case '.':
{
octave_value_list t = dotref (idx.front ());
retval = (t.length () == 1) ? t(0) : octave_value (t);
}
break;
case '{':
error ("%s cannot be indexed with %c", type_name ().c_str (), type[0]);
break;
default:
panic_impossible ();
}
if (! error_state)
retval = retval.next_subsref (type, idx, skip);
return retval;
}
bool
octave_galois::is_true (void) const
{
bool retval = false;
if (rows () > 0 && columns () > 0)
{
boolMatrix m = (gval.all () . all ());
retval = (m.rows () == 1 && m.columns () == 1 && m(0, 0));
}
return retval;
}
bool
octave_galois::print_as_scalar (void) const
{
int nr = rows ();
int nc = columns ();
return ((nr == 1 && nc == 1) || (nr == 0 || nc == 0));
}
void
#if defined (HAVE_OCTAVE_BASE_VALUE_PRINT_CONST)
octave_galois::print (std::ostream& os, bool) const
#else
octave_galois::print (std::ostream& os, bool)
#endif
{
print_raw (os);
}
void
octave_galois::print_raw (std::ostream& os, bool) const
{
bool first = true;
int m = gval.m ();
int primpoly = gval.primpoly ();
Matrix data (gval.rows (), gval.cols ());
indent (os);
if (m == 1)
os << "GF(2) array.";
else
{
os << "GF(2^" << m << ") array. Primitive Polynomial = ";
for (int i = m; i >= 0; i--)
{
if (primpoly & (1< 0)
{
if (first)
{
first = false;
os << "D";
}
else
os << "+D";
if (i != 1)
os << "^" << i;
}
else
{
if (first)
{
first = false;
os << "1";
}
else
os << "+1";
}
}
}
os << " (decimal " << primpoly << ")";
}
newline (os);
newline (os);
indent (os);
os << "Array elements = ";
newline (os);
newline (os);
for (int i = 0; i < gval.rows (); i++)
for (int j = 0; j < gval.columns (); j++)
data(i, j) = (double)gval(i, j);
octave_print_internal (os, data, false, current_print_indent_level ());
newline (os);
}
bool
octave_galois::print_name_tag (std::ostream& os, const std::string& name) const
{
bool retval = false;
indent (os);
// Vstruct_levels_to_print was made static in Octave 3.4, which means
// the name_tag might be printed on a seperate line when it shouldn't be.
#if 0
if (Vstruct_levels_to_print < 0)
#else
if (false)
#endif
os << name << " = ";
else
{
os << name << " =";
newline (os);
retval = true;
}
return retval;
}
void
octave_galois::print_info (std::ostream& os, const std::string& prefix) const
{
gval.print_info (os, prefix);
}
double
octave_galois::double_value (bool) const
{
double retval = octave_NaN;
if (rows () > 0 && columns () > 0)
{
OCTAVE__WARN_INVALID_CONVERSION ("Octave:array-as-scalar",
"real matrix", "real scalar");
retval = (double) gval (0, 0);
}
else
OCTAVE__ERR_INVALID_CONVERSION ("galois", "real scalar");
return retval;
}
Complex
octave_galois::complex_value (bool) const
{
double tmp = octave_NaN;
Complex retval (tmp, tmp);
if (rows () > 0 && columns () > 0)
{
OCTAVE__WARN_INVALID_CONVERSION ("Octave:array-as-scalar",
"real matrix", "real scalar");
retval = (double) gval (0, 0);
}
else
OCTAVE__ERR_INVALID_CONVERSION ("galois", "complex scalar");
return retval;
}
Matrix
octave_galois::matrix_value (bool) const
{
Matrix retval;
retval.resize (rows (), columns ());
for (int i = 0; i < rows (); i++)
for (int j = 0; j < columns (); j++)
retval(i, j) = gval(i, j);
return retval;
}
NDArray
octave_galois::array_value (bool) const
{
int nr = rows ();
int nc = columns ();
dim_vector dv (nr, nc);
NDArray retval (dv);
for (int i = 0; i < nr; i++)
for (int j = 0; j < nc; j++)
retval(i + j*nr) = gval(i, j);
return retval;
}
void
octave_galois::assign (const octave_value_list& idx,
const galois& rhs)
{
int len = idx.length ();
if (gval.have_field () && rhs.have_field ())
{
if ((gval.m () != rhs.m ()) || (gval.primpoly () != rhs.primpoly ()))
{
(*current_liboctave_error_handler) ("can not assign data between two different Galois Fields");
return;
}
}
switch (len)
{
case 2:
{
idx_vector i = idx (0).index_vector ();
if (! error_state)
{
idx_vector j = idx (1).index_vector ();
if (! error_state)
gval.assign (i, j, rhs);
}
}
break;
case 1:
{
idx_vector i = idx (0).index_vector ();
if (! error_state)
gval.assign (i, rhs);
}
break;
default:
error ("invalid number of indices (%d) for galois assignment",
len);
break;
}
}
bool
octave_galois::save_ascii (std::ostream& os)
{
dim_vector d = dims ();
Matrix tmp = matrix_value ();
// Note use N-D way of writing matrix for eventual conversion
// of octave_galois to handle N-D arrays
os << "# m: " << m () << "\n";
os << "# prim: " << primpoly () << "\n";
os << "# ndims: " << d.length () << "\n";
for (int i = 0; i < d.length (); i++)
os << " " << d (i);
os << "\n" << tmp;
return true;
}
bool
octave_galois::load_ascii (std::istream& is)
{
int mord, prim, mdims;
bool success = true;
if (extract_keyword (is, "m", mord) && extract_keyword (is, "prim", prim) &&
extract_keyword (is, "ndims", mdims))
{
dim_vector dv;
dv.resize (mdims);
for (int i = 0; i < mdims; i++)
is >> dv(i);
if (dv.length () != 2)
{
error ("load: N-D galois matrix not supported");
success = false;
}
else
{
Matrix tmp (dv(0), dv(1));
is >> tmp;
if (!is)
{
error ("load: failed to load matrix constant");
success = false;
}
gval = galois (tmp, mord, prim);
}
}
else
{
error ("load: failed to extract galois field order, primitive and/or imension");
success = false;
}
return success;;
}
bool
octave_galois::save_binary (std::ostream& os, bool& save_as_floats)
{
char tmp = m ();
os.write (X_CAST (char *, &tmp), 1);
int32_t itmp = primpoly ();
os.write (X_CAST (char *, &itmp), 4);
dim_vector d = dims ();
// Don't handle N-D arrays yet
if (d.length () != 2)
return false;
// Use negative value for ndims to be consistent with other formats
itmp = - d.length ();
os.write (X_CAST (char *, &itmp), 4);
for (int i = 0; i < d.length (); i++)
{
itmp = d(i);
os.write (X_CAST (char *, &itmp), 4);
}
Matrix m = matrix_value ();
save_type st;
if (tmp < 8)
st = LS_U_CHAR;
else if (tmp < 16)
st = LS_U_SHORT;
else
st = LS_U_INT;
const double *mtmp = m.data ();
write_doubles (os, mtmp, st, d.numel ());
return true;
}
bool
octave_galois::load_binary (std::istream& is, bool swap,
OCTAVE_MACH_INFO_FLOAT_FORMAT fmt)
{
char mord;
int32_t prim, mdims;
if (! is.read (X_CAST (char *, &mord), 1))
return false;
if (! is.read (X_CAST (char *, &prim), 4))
return false;
if (swap)
swap_bytes <4> (X_CAST (char *, &prim));
if (! is.read (X_CAST (char *, &mdims), 4))
return false;
if (swap)
swap_bytes <4> (X_CAST (char *, &mdims));
// Don't treat N-D arrays yet
if (mdims == -2)
{
mdims = - mdims;
int32_t di;
dim_vector dv;
dv.resize (mdims);
for (int i = 0; i < mdims; i++)
{
if (! is.read (X_CAST (char *, &di), 4))
return false;
if (swap)
swap_bytes <4> (X_CAST (char *, &di));
dv(i) = di;
}
char tmp;
if (! is.read (X_CAST (char *, &tmp), 1))
return false;
Matrix m (dv(0), dv(1));
double *re = m.fortran_vec ();
read_doubles (is, re, X_CAST (save_type, tmp), dv.numel (), swap, fmt);
if (error_state || ! is)
return false;
gval = galois (m, mord, prim);
}
return true;
}
bool
octave_galois::save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats)
{
bool retval = true;
#if defined (HAVE_HDF5)
Matrix mval = matrix_value ();
hid_t group_hid = -1;
#if HAVE_HDF5_18
group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#else
group_hid = H5Gcreate (loc_id, name, 0);
#endif
if (group_hid < 0 ) return false;
dim_vector d = dims ();
OCTAVE_LOCAL_BUFFER (hsize_t, hdims, d.length () > 2 ? d.length () : 3);
hid_t space_hid = -1, data_hid = -1;
char tmp;
int32_t itmp;
space_hid = H5Screate_simple (0, hdims, (hsize_t*) 0);
if (space_hid < 0)
{
H5Gclose (group_hid);
return false;
}
#if HAVE_HDF5_18
data_hid = H5Dcreate (group_hid, "m", H5T_NATIVE_UCHAR, space_hid,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#else
data_hid = H5Dcreate (group_hid, "m", H5T_NATIVE_UCHAR, space_hid,
H5P_DEFAULT);
#endif
if (data_hid < 0)
{
H5Sclose (space_hid);
H5Gclose (group_hid);
return false;
}
tmp = m ();
retval = H5Dwrite (data_hid, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT,
(void*) &tmp) >= 0;
H5Dclose (data_hid);
if (!retval)
{
H5Sclose (space_hid);
H5Gclose (group_hid);
return false;
}
#if HAVE_HDF5_18
data_hid = H5Dcreate (group_hid, "prim", H5T_NATIVE_UINT, space_hid,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#else
data_hid = H5Dcreate (group_hid, "prim", H5T_NATIVE_UINT, space_hid,
H5P_DEFAULT);
#endif
if (data_hid < 0)
{
H5Sclose (space_hid);
H5Gclose (group_hid);
return false;
}
itmp = primpoly ();
retval = H5Dwrite (data_hid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
(void*) &itmp) >= 0;
H5Dclose (data_hid);
if (!retval)
{
H5Sclose (space_hid);
H5Gclose (group_hid);
return false;
}
H5Sclose (space_hid);
// Octave uses column-major, while HDF5 uses row-major ordering
for (int i = 0, j = d.length () - 1; i < d.length (); i++, j--)
hdims[i] = d (j);
space_hid = H5Screate_simple (d.length (), hdims, (hsize_t*) 0);
if (space_hid < 0) return false;
double *mtmp = mval.fortran_vec ();
OCTAVE_LOCAL_BUFFER (uint32_t, vtmp, d.numel ());
hid_t save_type_hid = H5T_NATIVE_UINT;
if (tmp <= 8)
{
save_type_hid = H5T_NATIVE_UCHAR;
char *wtmp = (char *)vtmp;
for (int i = 0; i < d.numel (); i++)
wtmp[i] = (char) mtmp[i];
}
else if (tmp <= 16)
{
save_type_hid = H5T_NATIVE_USHORT;
uint16_t *wtmp = (uint16_t *)vtmp;
for (int i = 0; i < d.numel (); i++)
wtmp[i] = (uint16_t) mtmp[i];
}
else
{
for (int i = 0; i < d.numel (); i++)
vtmp[i] = (uint32_t) mtmp[i];
}
#if HAVE_HDF5_18
data_hid = H5Dcreate (group_hid, "val", save_type_hid, space_hid,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#else
data_hid = H5Dcreate (group_hid, "val", save_type_hid, space_hid,
H5P_DEFAULT);
#endif
if (data_hid < 0)
{
H5Sclose (space_hid);
H5Gclose (group_hid);
return false;
}
retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
H5P_DEFAULT, (void*) vtmp) >= 0;
H5Dclose (data_hid);
H5Sclose (space_hid);
H5Gclose (group_hid);
#elif defined (HAVE_OCTAVE_BASE_VALUE_GRIPE_LOAD_SAVE)
gripe_save ("hdf5");
#else
warning ("galois: saving hdf5 files not available");
#endif
return retval;
}
bool
octave_galois::load_hdf5 (octave_hdf5_id loc_id, const char *name)
{
bool retval = false;
#if defined (HAVE_HDF5)
char mord;
unsigned int prim;
hid_t group_hid, data_hid, space_id;
hsize_t rank;
#if HAVE_HDF5_18
group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
#else
group_hid = H5Gopen (loc_id, name);
#endif
if (group_hid < 0 ) return false;
#if HAVE_HDF5_18
data_hid = H5Dopen (group_hid, "m", H5P_DEFAULT);
#else
data_hid = H5Dopen (group_hid, "m");
#endif
space_id = H5Dget_space (data_hid);
rank = H5Sget_simple_extent_ndims (space_id);
if (rank != 0)
{
H5Dclose (data_hid);
H5Gclose (group_hid);
return false;
}
if (H5Dread (data_hid, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
H5P_DEFAULT, (void *) &mord) < 0)
{
H5Dclose (data_hid);
H5Gclose (group_hid);
return false;
}
H5Dclose (data_hid);
#if HAVE_HDF5_18
data_hid = H5Dopen (group_hid, "prim", H5P_DEFAULT);
#else
data_hid = H5Dopen (group_hid, "prim");
#endif
space_id = H5Dget_space (data_hid);
rank = H5Sget_simple_extent_ndims (space_id);
if (rank != 0)
{
H5Dclose (data_hid);
H5Gclose (group_hid);
return false;
}
if (H5Dread (data_hid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL,
H5P_DEFAULT, (void *) &prim) < 0)
{
H5Dclose (data_hid);
H5Gclose (group_hid);
return false;
}
H5Dclose (data_hid);
#if HAVE_HDF5_18
data_hid = H5Dopen (group_hid, "val", H5P_DEFAULT);
#else
data_hid = H5Dopen (group_hid, "val");
#endif
space_id = H5Dget_space (data_hid);
rank = H5Sget_simple_extent_ndims (space_id);
// Only handle matrices for now
if (rank != 2)
{
H5Sclose (space_id);
H5Dclose (data_hid);
H5Gclose (group_hid);
return false;
}
OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
H5Sget_simple_extent_dims (space_id, hdims, maxdims);
MArray m (dim_vector (hdims[1], hdims[0]));
int *re = m.fortran_vec ();
if (H5Dread (data_hid, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL,
H5P_DEFAULT, (void *) re) >= 0)
{
retval = true;
gval = galois (m, mord, prim);
}
H5Sclose (space_id);
H5Dclose (data_hid);
#elif defined (HAVE_OCTAVE_BASE_VALUE_GRIPE_LOAD_SAVE)
gripe_load ("hdf5");
#else
warning ("galois: loading hdf5 files not available");
#endif
return retval;
}
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/primpoly.cc 0000644 0000000 0000000 00000000074 13604150022 017251 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/primpoly.cc 0000644 0001750 0001750 00000020340 13604150022 017147 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#include
#include
enum primpoly_type
{
PRIMPOLY_MIN=0,
PRIMPOLY_MAX,
PRIMPOLY_ALL,
PRIMPOLY_K
};
static bool
do_isprimitive (const int& a, const int& m)
{
// Fast return since primitive polynomial can't be even
if (!(a & 1))
return false;
RowVector repr (1< 3)
{
print_usage ();
return retval;
}
m = args(0).int_value ();
// The upper limit is an artifical limit caused by memory requirements
// in do_is_primitive. m=22 uses an array of 32MBytes!!
if ((m < 1) || (m > 22))
{
error ("primpoly: m must be greater than 1 and less than 22");
return retval;
}
if (nargin > 1)
{
if (args(1).is_scalar_type ())
{
k = args(1).int_value ();
type = PRIMPOLY_K;
}
else if (args(1).is_string ())
{
std::string s_arg = args(1).string_value ();
if (s_arg == "nodisplay")
disp = false;
else if (s_arg == "min")
type = PRIMPOLY_MIN;
else if (s_arg == "max")
type = PRIMPOLY_MAX;
else if (s_arg == "all")
type = PRIMPOLY_ALL;
else {
error ("primpoly: invalid argument");
return retval;
}
}
else
{
error ("primpoly: incorrect argument type");
return retval;
}
}
if (nargin > 2)
{
if (args(2).is_scalar_type ())
{
if (type == PRIMPOLY_K) {
error ("primpoly: invalid arguments");
return retval;
}
k = args(2).int_value ();
type = PRIMPOLY_K;
}
else if (args(2).is_string ())
{
std::string s_arg = args(2).string_value ();
if (s_arg == "nodisplay") {
if (!disp) {
error ("primpoly: invalid arguments");
return retval;
}
disp = false;
} else if (!disp) {
if (s_arg == "min")
type = PRIMPOLY_MIN;
else if (s_arg == "max")
type = PRIMPOLY_MAX;
else if (s_arg == "all")
type = PRIMPOLY_ALL;
else {
error ("primpoly: invalid argument");
return retval;
}
} else {
error ("primpoly: invalid arguments");
return retval;
}
}
else
{
error ("primpoly: incorrect argument type");
return retval;
}
}
switch (type)
{
case PRIMPOLY_MIN:
primpolys.resize (1);
for (int i = (1< (1<= 0; j--)
{
if ((int)primpolys(i) & (1< 0)
{
if (first)
{
first = false;
octave_stdout << "D";
}
else
octave_stdout << "+D";
if (j != 1)
octave_stdout << "^" << j;
}
else
{
if (first)
{
first = false;
octave_stdout << "1";
}
else
octave_stdout << "+1";
}
}
}
octave_stdout << std::endl;
}
}
octave_stdout << std::endl;
}
retval = octave_value (primpolys);
return retval;
}
/*
%% Test input validation
%!error primpoly ()
%!error primpoly (1, 2, 3, 4)
%!error primpoly (1, "invalid")
%!error primpoly (1, 2, "invalid")
%!error primpoly (1, "nodisplay", "invalid")
*/
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/configure 0000644 0000000 0000000 00000000132 13604150125 016772 x ustar 00 30 mtime=1578160213.249198461
30 atime=1578160213.205198629
30 ctime=1578160213.541197341
communications-1.2.2/src/configure 0000755 0001750 0001750 00000462073 13604150125 016715 0 ustar 00nir nir 0000000 0000000 #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Octave-Forge communications package 0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Octave-Forge communications package'
PACKAGE_TARNAME='octave-forge-communications-package'
PACKAGE_VERSION='0'
PACKAGE_STRING='Octave-Forge communications package 0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_SYS_TYPES_H
# include
#endif
#ifdef HAVE_SYS_STAT_H
# include
#endif
#ifdef STDC_HEADERS
# include
# include
#else
# ifdef HAVE_STDLIB_H
# include
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include
# endif
# include
#endif
#ifdef HAVE_STRINGS_H
# include
#endif
#ifdef HAVE_INTTYPES_H
# include
#endif
#ifdef HAVE_STDINT_H
# include
#endif
#ifdef HAVE_UNISTD_H
# include
#endif"
ac_subst_vars='LTLIBOBJS
LIBOBJS
HDF5_LIBS
HDF5_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
EGREP
GREP
CXXCPP
SED
OBJEXT
EXEEXT
ac_ct_CXX
CPPFLAGS
LDFLAGS
CXXFLAGS
CXX
OCTAVE
MKOCTFILE
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
'
ac_precious_vars='build_alias
host_alias
target_alias
MKOCTFILE
OCTAVE
CXX
CXXFLAGS
LDFLAGS
LIBS
CPPFLAGS
CCC
CXXCPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
HDF5_CFLAGS
HDF5_LIBS'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
# 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.
cat <<_ACEOF
\`configure' configures Octave-Forge communications package 0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root
[DATAROOTDIR/doc/octave-forge-communications-package]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Octave-Forge communications package 0:";;
esac
cat <<\_ACEOF
Some influential environment variables:
MKOCTFILE mkoctfile compiler helper command
OCTAVE Octave interpreter command
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CXXCPP C++ preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
HDF5_CFLAGS C compiler flags for HDF5, overriding pkg-config
HDF5_LIBS linker flags for HDF5, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
if test -f "$ac_srcdir/configure.gnu"; then
echo &&
$SHELL "$ac_srcdir/configure.gnu" --help=recursive
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Octave-Forge communications package configure 0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_cxx_try_compile LINENO
# ----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
# ac_fn_cxx_try_cpp LINENO
# ------------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_cpp ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } > conftest.i && {
test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
test ! -s conftest.err
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_cpp
# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
# ---------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_cxx_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
# Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_header_compiler=yes
else
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }
# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <$2>
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
ac_header_preproc=yes
else
ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
yes:no: )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
no:yes:* )
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_mongrel
# ac_fn_cxx_try_run LINENO
# ------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_cxx_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_run
# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES
# ---------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_cxx_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_compile
# ac_fn_cxx_try_link LINENO
# -------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext conftest$ac_exeext
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_link
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Octave-Forge communications package $as_me 0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
$as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
$as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
$as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
$as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
$as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
$as_echo "$as_me: caught signal $ac_signal"
$as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
$as_echo "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
cat >>confdefs.h <<_ACEOF
#define PACKAGE_URL "$PACKAGE_URL"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
# We do not want a PATH search for config.site.
case $CONFIG_SITE in #((
-*) ac_site_file1=./$CONFIG_SITE;;
*/*) ac_site_file1=$CONFIG_SITE;;
*) ac_site_file1=./$CONFIG_SITE;;
esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
else
ac_site_file1=$ac_default_prefix/share/config.site
ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
. "$ac_site_file" \
|| { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
fi
done
if test -r "$cache_file"; then
# Some versions of bash will fail to source /dev/null (special files
# actually), so we avoid doing that. DJGPP emulates it as a regular file.
if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
ac_old_val_w=`echo x $ac_old_val`
ac_new_val_w=`echo x $ac_new_val`
if test "$ac_old_val_w" != "$ac_new_val_w"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
ac_cache_corrupted=:
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
eval $ac_var=\$ac_old_val
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
*\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
# Avoid warnings for redefining AH-generated preprocessor symbols of
# Octave.
# Extract the first word of "mkoctfile", so it can be a program name with args.
set dummy mkoctfile; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_MKOCTFILE+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$MKOCTFILE"; then
ac_cv_prog_MKOCTFILE="$MKOCTFILE" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_MKOCTFILE="mkoctfile"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
MKOCTFILE=$ac_cv_prog_MKOCTFILE
if test -n "$MKOCTFILE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKOCTFILE" >&5
$as_echo "$MKOCTFILE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Extract the first word of "octave", so it can be a program name with args.
set dummy octave; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OCTAVE+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OCTAVE"; then
ac_cv_prog_OCTAVE="$OCTAVE" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OCTAVE="octave"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OCTAVE=$ac_cv_prog_OCTAVE
if test -n "$OCTAVE"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCTAVE" >&5
$as_echo "$OCTAVE" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -z "$CXX"; then
if test -n "$CCC"; then
CXX=$CCC
else
if test -n "$ac_tool_prefix"; then
for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
$as_echo "$CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
$as_echo "$ac_ct_CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CXX" && break
done
if test "x$ac_ct_CXX" = x; then
CXX="g++"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_ct_CXX
fi
fi
fi
fi
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5
$as_echo_n "checking whether the C++ compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
if test -z "$ac_file"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C++ compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5
$as_echo_n "checking for C++ compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
{ { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
if { ac_try='./conftest$ac_cv_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C++ compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }
rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
if ${ac_cv_cxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GXX=yes
else
GXX=
fi
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_cv_prog_cxx_g=no
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
else
CXXFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
else
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_prog_cxx_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
$as_echo "$ac_cv_prog_cxx_g" >&6; }
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
for ac_i in 1 2 3 4 5 6 7; do
ac_script="$ac_script$as_nl$ac_script"
done
echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
{ ac_script=; unset ac_script;}
if test -z "$SED"; then
ac_path_SED_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_SED" || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
*GNU*)
ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo '' >> "conftest.nl"
"$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_SED_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_SED="$ac_path_SED"
ac_path_SED_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_SED_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_SED"; then
as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
fi
else
ac_cv_path_SED=$SED
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
$as_echo "$ac_cv_path_SED" >&6; }
SED="$ac_cv_path_SED"
rm -f conftest.sed
# Checks for octave depreciated symbols
## Simple symbol alternatives of different Octave versions.
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_altsyms_CXX="$CXX"
save_altsyms_CXXFLAGS="$CXXFLAGS"
save_altsyms_CPPFLAGS="$CPPFLAGS"
save_altsyms_LDFLAGS="$LDFLAGS"
save_altsyms_LIBS="$LIBS"
OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`}
OCTLIBDIR=${OCTLIBDIR:-`$MKOCTFILE -p OCTLIBDIR`}
CXX=`${MKOCTFILE} -p CXX`
CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS"
LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
LIBS="-loctinterp $LIBS"
echo '/* generated by configure */' > oct-alt-includes.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gripe_nonconformant or octave::err_nonconformant" >&5
$as_echo_n "checking gripe_nonconformant or octave::err_nonconformant... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
octave::err_nonconformant ("a",0,0)
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE__ERR_NONCONFORMANT octave::err_nonconformant" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::err_nonconformant" >&5
$as_echo "octave::err_nonconformant" >&6; }
echo '#include
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE__ERR_NONCONFORMANT gripe_nonconformant" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gripe_nonconformant" >&5
$as_echo " gripe_nonconformant" >&6; }
echo '#include ' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gripe_wrong_type_arg or err_wrong_type_arg" >&5
$as_echo_n "checking gripe_wrong_type_arg or err_wrong_type_arg... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
err_wrong_type_arg ("a", "b")
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE__ERR_WRONG_TYPE_ARG err_wrong_type_arg" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: err_wrong_type_arg" >&5
$as_echo "err_wrong_type_arg" >&6; }
echo '#include
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE__ERR_WRONG_TYPE_ARG gripe_wrong_type_arg" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gripe_wrong_type_arg" >&5
$as_echo " gripe_wrong_type_arg" >&6; }
echo '#include ' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gripe_square_matrix_required or err_square_matrix_required" >&5
$as_echo_n "checking gripe_square_matrix_required or err_square_matrix_required... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
err_square_matrix_required ("a", "b")
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define DELOCTAVE__ERR_SQUARE_MATRIX_REQUIRED err_square_matrix_required" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: err_square_matrix_required" >&5
$as_echo "err_square_matrix_required" >&6; }
echo '#include
' >> oct-alt-includes.h
else
$as_echo "#define DELOCTAVE__ERR_SQUARE_MATRIX_REQUIRED gripe_square_matrix_required" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gripe_square_matrix_required" >&5
$as_echo " gripe_square_matrix_required" >&6; }
echo '#include ' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gripe_invalid_conversion or err_invalid_conversion" >&5
$as_echo_n "checking gripe_invalid_conversion or err_invalid_conversion... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
err_invalid_conversion ("a", "b")
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE__ERR_INVALID_CONVERSION err_invalid_conversion" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: err_invalid_conversion" >&5
$as_echo "err_invalid_conversion" >&6; }
echo '#include
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE__ERR_INVALID_CONVERSION gripe_invalid_conversion" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gripe_invalid_conversion" >&5
$as_echo " gripe_invalid_conversion" >&6; }
echo '#include ' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gripe_implicit_conversion or warn_implicit_conversion" >&5
$as_echo_n "checking gripe_implicit_conversion or warn_implicit_conversion... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
warn_implicit_conversion ("a", "b", "c")
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE__WARN_INVALID_CONVERSION warn_implicit_conversion" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: warn_implicit_conversion" >&5
$as_echo "warn_implicit_conversion" >&6; }
echo '#include
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE__WARN_INVALID_CONVERSION gripe_implicit_conversion" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: gripe_implicit_conversion" >&5
$as_echo " gripe_implicit_conversion" >&6; }
echo '#include ' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking flush_octave_stdout or octave::flush_stdout" >&5
$as_echo_n "checking flush_octave_stdout or octave::flush_stdout... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave::flush_stdout ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE__FLUSH_STDOUT octave::flush_stdout" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::flush_stdout" >&5
$as_echo "octave::flush_stdout" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE__FLUSH_STDOUT flush_octave_stdout" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: flush_octave_stdout" >&5
$as_echo " flush_octave_stdout" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking is_complex_type or iscomplex" >&5
$as_echo_n "checking is_complex_type or iscomplex... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave_value ().iscomplex ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OV_ISCOMPLEX iscomplex" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: iscomplex" >&5
$as_echo "iscomplex" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OV_ISCOMPLEX is_complex_type" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: is_complex_type" >&5
$as_echo " is_complex_type" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking is_real_type or isreal" >&5
$as_echo_n "checking is_real_type or isreal... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave_value ().isreal ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OV_ISREAL isreal" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: isreal" >&5
$as_echo "isreal" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OV_ISREAL is_real_type" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: is_real_type" >&5
$as_echo " is_real_type" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking is_numeric_type or isnumeric" >&5
$as_echo_n "checking is_numeric_type or isnumeric... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave_value ().isnumeric ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OV_ISNUMERIC isnumeric" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: isnumeric" >&5
$as_echo "isnumeric" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OV_ISNUMERIC is_numeric_type" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: is_numeric_type" >&5
$as_echo " is_numeric_type" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking is_empty or isempty" >&5
$as_echo_n "checking is_empty or isempty... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave_value ().isempty ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OV_ISEMPTY isempty" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: isempty" >&5
$as_echo "isempty" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OV_ISEMPTY is_empty" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: is_empty" >&5
$as_echo " is_empty" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking oct_mach_info::float_format or octave::mach_info::float_format" >&5
$as_echo_n "checking oct_mach_info::float_format or octave::mach_info::float_format... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main ()
{
octave::mach_info::float_format fmt;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
$as_echo "#define OCTAVE_MACH_INFO_FLOAT_FORMAT octave::mach_info::float_format" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: octave::mach_info::float_format" >&5
$as_echo "octave::mach_info::float_format" >&6; }
echo '
' >> oct-alt-includes.h
else
$as_echo "#define OCTAVE_MACH_INFO_FLOAT_FORMAT oct_mach_info::float_format" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: oct_mach_info::float_format" >&5
$as_echo " oct_mach_info::float_format" >&6; }
echo '' >> oct-alt-includes.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
if test -z "$CXXCPP"; then
if ${ac_cv_prog_CXXCPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CXXCPP needs to be expanded
for CXXCPP in "$CXX -E" "/lib/cpp"
do
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
done
ac_cv_prog_CXXCPP=$CXXCPP
fi
CXXCPP=$ac_cv_prog_CXXCPP
else
ac_cv_prog_CXXCPP=$CXXCPP
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
$as_echo "$CXXCPP" >&6; }
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# Prefer to if __STDC__ is defined, since
# exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __STDC__
# include
#else
# include
#endif
Syntax error
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
else
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if ac_fn_cxx_try_cpp "$LINENO"; then :
# Broken: success on invalid input.
continue
else
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
ac_path_GREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
ac_path_GREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_GREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
if test -z "$EGREP"; then
ac_path_EGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
$as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
$as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
ac_path_EGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_EGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
#include
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_header_stdc=yes
else
ac_cv_header_stdc=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "memchr" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "free" >/dev/null 2>&1; then :
else
ac_cv_header_stdc=no
fi
rm -f conftest*
fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then :
:
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
(('a' <= (c) && (c) <= 'i') \
|| ('j' <= (c) && (c) <= 'r') \
|| ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
return 2;
return 0;
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
else
ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in octave/oct.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/oct.h" "ac_cv_header_octave_oct_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_oct_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_OCT_H 1
_ACEOF
fi
done
for ac_header in octave/base-lu.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/base-lu.h" "ac_cv_header_octave_base_lu_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_base_lu_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_BASE_LU_H 1
_ACEOF
fi
done
for ac_header in octave/lu.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/lu.h" "ac_cv_header_octave_lu_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_lu_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_LU_H 1
_ACEOF
fi
done
for ac_header in octave/gripes.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/gripes.h" "ac_cv_header_octave_gripes_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_gripes_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_GRIPES_H 1
_ACEOF
fi
done
for ac_header in octave/errwarn.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/errwarn.h" "ac_cv_header_octave_errwarn_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_errwarn_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_ERRWARN_H 1
_ACEOF
fi
done
for ac_header in octave/ovl.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/ovl.h" "ac_cv_header_octave_ovl_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_ovl_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_OVL_H 1
_ACEOF
fi
done
for ac_header in octave/oct-obj.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/oct-obj.h" "ac_cv_header_octave_oct_obj_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_oct_obj_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_OCT_OBJ_H 1
_ACEOF
fi
done
for ac_header in octave/ls-oct-ascii.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/ls-oct-ascii.h" "ac_cv_header_octave_ls_oct_ascii_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_ls_oct_ascii_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_LS_OCT_ASCII_H 1
_ACEOF
fi
done
for ac_header in octave/ls-oct-text.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/ls-oct-text.h" "ac_cv_header_octave_ls_oct_text_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_ls_oct_text_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_LS_OCT_TEXT_H 1
_ACEOF
fi
done
for ac_header in octave/oct-obj.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/oct-obj.h" "ac_cv_header_octave_oct_obj_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_oct_obj_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_OCT_OBJ_H 1
_ACEOF
fi
done
for ac_header in octave/interpreter.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "octave/interpreter.h" "ac_cv_header_octave_interpreter_h" "$ac_includes_default"
if test "x$ac_cv_header_octave_interpreter_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OCTAVE_INTERPRETER_H 1
_ACEOF
fi
done
CXX=$save_altsyms_CXX
CXXFLAGS=$save_altsyms_CXXFLAGS
CPPFLAGS=$save_altsyms_CPPFLAGS
LDFLAGS=$save_altsyms_LDFLAGS
LIBS=$save_altsyms_LIBS
have_hdf5=no
# check for HDF5 using pkg-config
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for HDF5" >&5
$as_echo_n "checking for HDF5... " >&6; }
if test -n "$HDF5_CFLAGS"; then
pkg_cv_HDF5_CFLAGS="$HDF5_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hdf5\""; } >&5
($PKG_CONFIG --exists --print-errors "hdf5") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_HDF5_CFLAGS=`$PKG_CONFIG --cflags "hdf5" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$HDF5_LIBS"; then
pkg_cv_HDF5_LIBS="$HDF5_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hdf5\""; } >&5
($PKG_CONFIG --exists --print-errors "hdf5") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_HDF5_LIBS=`$PKG_CONFIG --libs "hdf5" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
HDF5_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "hdf5" 2>&1`
else
HDF5_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "hdf5" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$HDF5_PKG_ERRORS" >&5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
else
HDF5_CFLAGS=$pkg_cv_HDF5_CFLAGS
HDF5_LIBS=$pkg_cv_HDF5_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_hdf5=yes
fi
if test $have_hdf5 = no; then
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for H5Fopen in -lhdf5" >&5
$as_echo_n "checking for H5Fopen in -lhdf5... " >&6; }
if ${ac_cv_lib_hdf5_H5Fopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lhdf5 $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char H5Fopen ();
int
main ()
{
return H5Fopen ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_hdf5_H5Fopen=yes
else
ac_cv_lib_hdf5_H5Fopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hdf5_H5Fopen" >&5
$as_echo "$ac_cv_lib_hdf5_H5Fopen" >&6; }
if test "x$ac_cv_lib_hdf5_H5Fopen" = xyes; then :
have_hdf5=yes
for ac_header in hdf5.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "hdf5.h" "ac_cv_header_hdf5_h" "$ac_includes_default"
if test "x$ac_cv_header_hdf5_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_HDF5_H 1
_ACEOF
fi
done
HDF5_LIBS=-lhdf5
fi
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
fi
if test $have_hdf5 = no; then
as_fn_error $? "hdf5 not found" "$LINENO" 5
fi
comm_OCT_EVAL="$OCTAVE --norc --no-history --silent --eval"
comm_CXXFLAGS=`$MKOCTFILE -p ALL_CXXFLAGS`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for octave_hdf5_id type" >&5
$as_echo_n "checking for octave_hdf5_id type... " >&6; }
if ${comm_cv_octave_hdf5_id_type+:} false; then :
$as_echo_n "(cached) " >&6
else
comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
int
main ()
{
octave_hdf5_id x;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
comm_cv_octave_hdf5_id_type=yes
else
comm_cv_octave_hdf5_id_type=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $comm_cv_octave_hdf5_id_type" >&5
$as_echo "$comm_cv_octave_hdf5_id_type" >&6; }
if test $comm_cv_octave_hdf5_id_type = yes; then
$as_echo "#define HAVE_OCTAVE_HDF5_ID_TYPE 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for octave_base_value::gripe_load and octave_base_value::gripe_save" >&5
$as_echo_n "checking for octave_base_value::gripe_load and octave_base_value::gripe_save... " >&6; }
if ${comm_cv_octave_base_value_gripe_load_save+:} false; then :
$as_echo_n "(cached) " >&6
else
comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
class foo : public octave_base_value
{
public:
foo () {}
void func () { gripe_load ("func"); gripe_save ("func"); }
};
int
main ()
{
foo x;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
comm_cv_octave_base_value_gripe_load_save=yes
else
comm_cv_octave_base_value_gripe_load_save=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $comm_cv_octave_base_value_gripe_load_save" >&5
$as_echo "$comm_cv_octave_base_value_gripe_load_save" >&6; }
if test $comm_cv_octave_base_value_gripe_load_save = yes; then
$as_echo "#define HAVE_OCTAVE_BASE_VALUE_GRIPE_LOAD_SAVE 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether octave_base_value::print is const-qualified" >&5
$as_echo_n "checking whether octave_base_value::print is const-qualified... " >&6; }
if ${comm_cv_octave_base_value_print_const_qualified+:} false; then :
$as_echo_n "(cached) " >&6
else
comm_save_CPPFLAGS=$CPPFLAGS
comm_save_CXXFLAGS=$CXXFLAGS
CPPFLAGS="$CPPFLAGS $HDF5_CFLAGS"
CXXFLAGS="$CXXFLAGS $comm_CXXFLAGS"
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
int
main ()
{
const octave_base_value x; x.print (std::cout);
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
comm_cv_octave_base_value_print_const_qualified=yes
else
comm_cv_octave_base_value_print_const_qualified=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
CPPFLAGS=$comm_save_CPPFLAGS
CXXFLAGS=$comm_save_CXXFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $comm_cv_octave_base_value_print_const_qualified" >&5
$as_echo "$comm_cv_octave_base_value_print_const_qualified" >&6; }
if test $comm_cv_octave_base_value_print_const_qualified = yes; then
$as_echo "#define HAVE_OCTAVE_BASE_VALUE_PRINT_CONST 1" >>confdefs.h
fi
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
if test ! -f "$cache_file" || test -h "$cache_file"; then
cat confcache >"$cache_file"
else
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Octave-Forge communications package $as_me 0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Report bugs to the package provider."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Octave-Forge communications package config.status 0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
$as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
$as_echo "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
$as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`$as_echo "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
"$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$ac_tmp/stdin"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
communications-1.2.2/src/PaxHeaders.12771/undef-ah-octave.h 0000644 0000000 0000000 00000000062 13604150022 020203 x ustar 00 20 atime=1578160146
30 ctime=1578160213.541197341
communications-1.2.2/src/undef-ah-octave.h 0000644 0001750 0001750 00000000706 13604150022 020110 0 ustar 00nir nir 0000000 0000000 /* To be included at the top of config.h (by autoheader). Avoid
warnings for redefining AH-generated preprocessor symbols of
Octave. */
#ifdef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif
#ifdef PACKAGE_NAME
#undef PACKAGE_NAME
#endif
#ifdef PACKAGE_STRING
#undef PACKAGE_STRING
#endif
#ifdef PACKAGE_TARNAME
#undef PACKAGE_TARNAME
#endif
#ifdef PACKAGE_URL
#undef PACKAGE_URL
#endif
#ifdef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif
communications-1.2.2/src/PaxHeaders.12771/base-lu.h 0000644 0000000 0000000 00000000062 13604150022 016565 x ustar 00 20 atime=1578160146
30 ctime=1578160213.541197341
communications-1.2.2/src/base-lu.h 0000644 0001750 0001750 00000003347 13604150022 016476 0 ustar 00nir nir 0000000 0000000 /*
Copyright (C) 1996-2015 John W. Eaton
Copyright (C) 2009 VZLU Prague
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 3 of the License, 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, see
.
*/
#if !defined (octave_base_lu_h)
#define octave_base_lu_h 1
#include "MArray.h"
#include "dColVector.h"
#include "PermMatrix.h"
template
class
base_lu
{
public:
typedef typename lu_type::element_type lu_elt_type;
base_lu (void)
: a_fact (), l_fact (), ipvt () { }
base_lu (const base_lu& a)
: a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { }
base_lu (const lu_type& l, const lu_type& u,
const PermMatrix& p);
base_lu& operator = (const base_lu& a)
{
if (this != &a)
{
a_fact = a.a_fact;
l_fact = a.l_fact;
ipvt = a.ipvt;
}
return *this;
}
virtual ~base_lu (void) { }
bool packed (void) const;
void unpack (void);
lu_type L (void) const;
lu_type U (void) const;
lu_type Y (void) const;
PermMatrix P (void) const;
ColumnVector P_vec (void) const;
bool regular (void) const;
protected:
Array getp (void) const;
lu_type a_fact;
lu_type l_fact;
Array ipvt;
};
#endif
communications-1.2.2/src/PaxHeaders.12771/m4 0000644 0000000 0000000 00000000132 13604150040 015325 x ustar 00 30 mtime=1578160160.361401146
30 atime=1578160213.541197341
30 ctime=1578160213.541197341
communications-1.2.2/src/m4/ 0000755 0001750 0001750 00000000000 13604150040 015306 5 ustar 00nir nir 0000000 0000000 communications-1.2.2/src/m4/PaxHeaders.12771/octave-forge.m4 0000644 0000000 0000000 00000000074 13604150022 020232 x ustar 00 30 atime=1578160212.669200687
30 ctime=1578160213.541197341
communications-1.2.2/src/m4/octave-forge.m4 0000644 0001750 0001750 00000005760 13604150022 020141 0 ustar 00nir nir 0000000 0000000 # Copyright (C) 2017-2018 Olaf Till
# Modifications to print what is searching for by JohnD
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, see .
# arguments of OF_OCTAVE_ALT_SYMS (see also description of
# OF_OCTAVE_LIST_ALT_SYMS below):
#
# $1: symbol version 1
# $2: symbol version 2
# $3: test for symbol version 2
# $4: macro name to access alternative symbols
# $5: include directives for symbol version 1
# $6: include directives for symbol version 2
# (a list of lists of args 1--6 is $1 of OF_OCTAVE_LIST_ALT_SYMS)
# $7: name of generated include file with alternatives of Octave headers
# (arg7 is $2 of OF_OCTAVE_LIST_ALT_SYMS)
AC_DEFUN([OF_OCTAVE_ALT_SYMS], [
AC_MSG_CHECKING([$1 or $2])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include ]
$6],
[$3])],
[AC_DEFINE($4,
[[$2]],
[macro for alternative Octave symbols])
AC_MSG_RESULT([$2])
echo '$6' >> $7],
[AC_DEFINE($4,
[[$1]],
[macro for alternative Octave symbols])
AC_MSG_RESULT([$1])
echo '$5' >> $7]
)
])
# OF_OCTAVE_LIST_ALT_SYMS is called in the following way:
#
# OF_OCTAVE_LIST_ALT_SYMS([
# [dnl
# [old_octave_symbol],
# [new_octave_symbol],
# [[compilation test]
# [for new_octave_symbol]],
# [NAME_OF_GENERATED_MACRO____WILL_EXPAND_TO_OLD_OR_NEW_SYMBOL],
# [[include directives]
# [except #include ]
# [necessary to compile with old_octave_symbol]],
# [[include directives]
# [except #include ]
# [nessary to compile with new_octave_symbol]
# [and to compile the test]]
# ],
#
# ... further such lists as the above
#
# ],
#
# [name-of-header-file-for-alternative-octave-iclude-directives.h])
#
#
# This file should be put into src/m4/, and the line
#
# AC_CONFIG_MACRO_DIRS([m4])
#
# should be put into src/configure.ac. The package should use
# autoheader to generate config.h.in (src/bootstrap should contain the
# lines 'aclocal', 'autoconf', and 'autoheader -f'). Package code
# should include config.h and use the generated macros to access the
# alternative symbols of Octave. An example of a call to
# OF_OCTAVE_LIST_ALT_SYMS in src/configure.ac is available together
# with this file.
AC_DEFUN([OF_OCTAVE_LIST_ALT_SYMS], [
echo '/* generated by configure */' > $2
m4_foreach([it], [$1], [m4_apply([OF_OCTAVE_ALT_SYMS], [it, $2])])
AH_BOTTOM([#include "$2"])
])
communications-1.2.2/src/PaxHeaders.12771/config.h.in 0000644 0000000 0000000 00000000132 13604150125 017111 x ustar 00 30 mtime=1578160213.541197341
30 atime=1578160213.541197341
30 ctime=1578160213.541197341
communications-1.2.2/src/config.h.in 0000644 0001750 0001750 00000006705 13604150125 017025 0 ustar 00nir nir 0000000 0000000 /* config.h.in. Generated from configure.ac by autoheader. */
#include "undef-ah-octave.h"
/* macro for alternative Octave symbols */
#undef DELOCTAVE__ERR_SQUARE_MATRIX_REQUIRED
/* Define to 1 if you have the header file. */
#undef HAVE_HDF5_H
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_BASE_LU_H
/* Define if have gripe_load and gripe_save */
#undef HAVE_OCTAVE_BASE_VALUE_GRIPE_LOAD_SAVE
/* Define if octave_base_value::print is const-qualified */
#undef HAVE_OCTAVE_BASE_VALUE_PRINT_CONST
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_ERRWARN_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_GRIPES_H
/* Define if have octave_hdf5_id */
#undef HAVE_OCTAVE_HDF5_ID_TYPE
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_INTERPRETER_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_LS_OCT_ASCII_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_LS_OCT_TEXT_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_LU_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_OCT_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_OCT_OBJ_H
/* Define to 1 if you have the header file. */
#undef HAVE_OCTAVE_OVL_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
/* macro for alternative Octave symbols */
#undef OCTAVE_MACH_INFO_FLOAT_FORMAT
/* macro for alternative Octave symbols */
#undef OCTAVE__ERR_INVALID_CONVERSION
/* macro for alternative Octave symbols */
#undef OCTAVE__ERR_NONCONFORMANT
/* macro for alternative Octave symbols */
#undef OCTAVE__ERR_WRONG_TYPE_ARG
/* macro for alternative Octave symbols */
#undef OCTAVE__FLUSH_STDOUT
/* macro for alternative Octave symbols */
#undef OCTAVE__WARN_INVALID_CONVERSION
/* macro for alternative Octave symbols */
#undef OV_ISCOMPLEX
/* macro for alternative Octave symbols */
#undef OV_ISEMPTY
/* macro for alternative Octave symbols */
#undef OV_ISNUMERIC
/* macro for alternative Octave symbols */
#undef OV_ISREAL
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
#include "oct-alt-includes.h"
communications-1.2.2/src/PaxHeaders.12771/galois.cc 0000644 0000000 0000000 00000000074 13604150022 016654 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/galois.cc 0000644 0001750 0001750 00000104167 13604150022 016564 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#include
#ifdef HAVE_OCTAVE_GRIPES_H
#include
#endif
#ifdef HAVE_OCTAVE_ERRWARN_H
#include
#endif
#include
#include "galois.h"
#include "galoisfield.h"
#include "galois-def.h"
#ifdef HAVE_OCTAVE_BASE_LU_H
# include
#else
# include "base-lu.cc"
#endif
galois_field_list stored_galois_fields;
// galois class
galois::galois (const Array& a, const int& _m,
const int& _primpoly) : MArray (a.dims ()), field (NULL)
{
int _n = (1<<_m) - 1;
// Check the validity of the data in the matrix
for (int i = 0; i < rows (); i++)
{
for (int j = 0; j < columns (); j++)
{
if ((a(i, j) < 0) || (a(i, j) > _n))
{
gripe_range_galois (_m);
return;
}
xelem(i, j) = (int)a(i, j);
}
}
field = stored_galois_fields.create_galois_field (_m, _primpoly);
}
galois::galois (const MArray& a, const int& _m,
const int& _primpoly) : MArray (a.dims ()), field (NULL)
{
int _n = (1<<_m) - 1;
// Check the validity of the data in the matrix
for (int i = 0; i < rows (); i++)
{
for (int j = 0; j < columns (); j++)
{
if ((a(i, j) < 0) || (a(i, j) > _n))
{
gripe_range_galois (_m);
return;
}
xelem(i, j) = (int)a(i, j);
}
}
field = stored_galois_fields.create_galois_field (_m, _primpoly);
}
galois::galois (const Matrix& a, const int& _m,
const int& _primpoly) : MArray (a.dims ()), field (NULL)
{
int _n = (1<<_m) - 1;
// Check the validity of the data in the matrix
for (int i = 0; i < rows (); i++)
{
for (int j = 0; j < columns (); j++)
{
if ((a(i, j) < 0) || (a(i, j) > _n))
{
gripe_range_galois (_m);
return;
}
if ((a(i, j) - (double)((int)a(i, j))) != 0.)
{
gripe_integer_galois ();
return;
}
xelem(i, j) = (int)a(i, j);
}
}
field = stored_galois_fields.create_galois_field (_m, _primpoly);
}
galois::galois (int nr, int nc, const int& val, const int& _m,
const int& _primpoly)
: MArray (dim_vector (nr, nc), val), field (NULL)
{
int _n = (1<<_m) - 1;
// Check the validity of the data in the matrix
if ((val < 0) || (val > _n))
{
gripe_range_galois (_m);
return;
}
field = stored_galois_fields.create_galois_field (_m, _primpoly);
}
galois::galois (int nr, int nc, double val, const int& _m,
const int& _primpoly)
: MArray (dim_vector (nr, nc), (int)val), field (NULL)
{
int _n = (1<<_m) - 1;
// Check the validity of the data in the matrix
if ((val < 0) || (val > _n))
{
gripe_range_galois (_m);
return;
}
if ((val - (double)((int)val)) != 0.)
{
gripe_integer_galois ();
return;
}
field = stored_galois_fields.create_galois_field (_m, _primpoly);
}
galois::galois (const galois& a) : MArray (a)
{
if (!a.have_field ())
{
gripe_copy_invalid_galois ();
field = NULL;
return;
}
// This call to create_galois_field will just increment the usage counter
field = stored_galois_fields.create_galois_field (a.m (), a.primpoly ());
}
galois::~galois (void)
{
stored_galois_fields.delete_galois_field (field);
field = NULL;
}
galois&
galois::operator = (const galois& t)
{
if (!t.have_field ())
{
gripe_copy_invalid_galois ();
if (have_field ())
stored_galois_fields.delete_galois_field (field);
field = NULL;
return *this;
}
if (have_field ())
{
if ((m () != t.m ()) || (primpoly () != t.primpoly ()))
{
stored_galois_fields.delete_galois_field (field);
field = stored_galois_fields.create_galois_field (t.m (), t.primpoly ());
}
}
else
field = stored_galois_fields.create_galois_field (t.m (), t.primpoly ());
// Copy the data
MArray::operator = (t);
return *this;
}
galois&
galois::operator += (const galois& a)
{
int nr = rows ();
int nc = cols ();
int a_nr = a.rows ();
int a_nc = a.cols ();
if (have_field () && a.have_field ())
{
if ((m () != a.m ()) || (primpoly () != a.primpoly ()))
{
gripe_differ_galois ();
return *this;
}
}
else
{
gripe_invalid_galois ();
return *this;
}
if (nr != a_nr || nc != a_nc)
{
OCTAVE__ERR_NONCONFORMANT ("operator +=", nr, nc, a_nr, a_nc);
return *this;
}
for (int i = 0; i < rows (); i++)
for (int j = 0; j < columns (); j++)
xelem(i, j) ^= a (i, j);
return *this;
}
galois&
galois::operator -= (const galois& a)
{
int nr = rows ();
int nc = cols ();
int a_nr = a.rows ();
int a_nc = a.cols ();
if (have_field () && a.have_field ())
{
if ((m () != a.m ()) || (primpoly () != a.primpoly ()))
{
gripe_differ_galois ();
return *this;
}
}
else
{
gripe_invalid_galois ();
return *this;
}
if (nr != a_nr || nc != a_nc)
{
OCTAVE__ERR_NONCONFORMANT ("operator -=", nr, nc, a_nr, a_nc);
return *this;
}
for (int i = 0; i < rows (); i++)
for (int j = 0; j < columns (); j++)
xelem(i, j) ^= a (i, j);
return *this;
}
galois
galois::index (idx_vector& i, int resize_ok, const int& rfv) const
{
galois retval (MArray::index(i, resize_ok, rfv), m (), primpoly ());
return retval;
}
galois
galois::index (idx_vector& i, idx_vector& j, int resize_ok,
const int& rfv) const
{
galois retval (MArray::index(i, j, resize_ok, rfv), m (), primpoly ());
return retval;
}
galois
galois::concat (const galois& rb, const Array& ra_idx)
{
if (rb.numel () > 0)
insert (rb, ra_idx(0), ra_idx(1));
return *this;
}
galois
galois::concat (const Matrix& rb, const Array& ra_idx)
{
if (numel () == 1)
return *this;
galois tmp (0, 0, 0, m (), primpoly ());
int _n = (1< _n))
{
gripe_range_galois (m ());
return *this;
}
if ((rb(i, j) - (double)((int)rb(i, j))) != 0.)
{
gripe_integer_galois ();
return *this;
}
tmp(i, j) = (int)rb(i, j);
}
}
insert (tmp, ra_idx(0), ra_idx(1));
return *this;
}
galois
concat (const Matrix& ra, const galois& rb, const Array& ra_idx)
{
galois retval (0, 0, 0, rb.m (), rb.primpoly ());
int _n = (1< _n))
{
gripe_range_galois (rb.m ());
return retval;
}
if ((ra(i, j) - (double)((int)ra(i, j))) != 0.)
{
gripe_integer_galois ();
return retval;
}
retval(i, j) = (int)ra(i, j);
#else
int tmp = (int)ra(i, j);
if (tmp < 0)
retval(i, j) = 0;
else if (tmp > _n)
retval(i, j) = _n;
else
retval(i, j) = tmp;
#endif
}
}
retval.insert (rb, ra_idx(0), ra_idx(1));
return retval;
}
galois&
galois::insert (const galois& t, int r, int c)
{
if ((m () != t.m ()) || (primpoly () != t.primpoly ()))
(*current_liboctave_error_handler) ("inserted galois variable must "
"be in the same field");
else
Array::insert (t, r, c);
return *this;
}
galois
galois::diag (void) const
{
return diag (0);
}
galois
galois::diag (int k) const
{
int nnr = rows ();
int nnc = cols ();
galois retval (0, 0, 0, m (), primpoly ());
if (k > 0)
nnc -= k;
else if (k < 0)
nnr += k;
if (nnr > 0 && nnc > 0)
{
int ndiag = (nnr < nnc) ? nnr : nnc;
retval.resize (dim_vector (ndiag, 1));
if (k > 0)
{
for (int i = 0; i < ndiag; i++)
retval(i, 0) = xelem (i, i+k);
}
else if ( k < 0)
{
for (int i = 0; i < ndiag; i++)
retval(i, 0) = xelem (i-k, i);
}
else
{
for (int i = 0; i < ndiag; i++)
retval(i, 0) = xelem (i, i);
}
}
else
error ("diag: requested diagonal out of range");
return retval;
}
// unary operations
boolMatrix
galois::operator ! (void) const
{
int nr = rows ();
int nc = cols ();
boolMatrix b (nr, nc);
for (int j = 0; j < nc; j++)
for (int i = 0; i < nr; i++)
b (i, j) = ! xelem (i, j);
return b;
}
galois
galois::transpose (void) const
{
galois a (Matrix (0, 0), m (), primpoly ());
int d1 = rows ();
int d2 = cols ();
a.resize (dim_vector (d2, d1));
for (int j = 0; j < d2; j++)
for (int i = 0; i < d1; i++)
a (j, i) = xelem (i, j);
return a;
}
static inline int
modn (int x, int m, int n)
{
while (x >= n)
{
x -= n;
x = (x >> m) + (x & n);
}
return x;
}
galois
elem_pow (const galois& a, const galois& b)
{
int a_nr = a.rows ();
int a_nc = a.cols ();
galois result (a_nr, a_nc, 0, a.m (), a.primpoly ());
int b_nr = b.rows ();
int b_nc = b.cols ();
if (a.have_field () && b.have_field ())
{
if ((a.m () != b.m ()) || (a.primpoly () != b.primpoly ()))
{
gripe_differ_galois ();
return galois ();
}
}
else
{
gripe_invalid_galois ();
return galois ();
}
if (a_nr == 1 && a_nc == 1)
{
result.resize (dim_vector (b_nr, b_nc), 0);
int tmp = a.index_of (a(0, 0));
for (int j = 0; j < b_nc; j++)
for (int i = 0; i < b_nr; i++)
if (b(i, j) == 0)
result(i, j) = 1;
else if (a(0, 0) != 0)
result(i, j) = a.alpha_to (modn (tmp * b(i, j), a.m (), a.n ()));
}
else if (b_nr == 1 && b_nc == 1)
{
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < a_nr; i++)
if (b(0, 0) == 0)
result(i, j) = 1;
else if (a(i, j) != 0)
result(i, j) = a.alpha_to (modn (a.index_of (a(i, j)) *
b(0, 0), a.m (), a.n ()));
}
else
{
if (a_nr != b_nr || a_nc != b_nc)
{
OCTAVE__ERR_NONCONFORMANT ("operator .^", a_nr, a_nc, a_nr, a_nc);
return galois ();
}
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < a_nr; i++)
if (b(i, j) == 0)
result(i, j) = 1;
else if (a(i, j) != 0)
result(i, j) = a.alpha_to (modn (a.index_of (a(i, j)) *
b(i, j), a.m (), a.n ()));
}
return result;
}
galois
elem_pow (const galois& a, const Matrix& b)
{
int a_nr = a.rows ();
int a_nc = a.cols ();
galois result (a_nr, a_nc, 0, a.m (), a.primpoly ());
int b_nr = b.rows ();
int b_nc = b.cols ();
if (b_nr == 1 && b_nc == 1)
return elem_pow (a, b(0, 0));
if (a_nr != b_nr || a_nc != b_nc)
{
OCTAVE__ERR_NONCONFORMANT ("operator .^", a_nr, a_nc, b_nr, b_nc);
return galois ();
}
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < a_nr; i++)
{
int tmp = (int)b(i, j);
while (tmp < 0)
tmp += a.n ();
if (tmp == 0)
result(i, j) = 1;
else if (a(i, j) != 0)
result(i, j) = a.alpha_to (modn (a.index_of (a(i, j)) * tmp,
a.m (), a.n ()));
}
return result;
}
galois
elem_pow (const galois& a, double b)
{
int a_nr = a.rows ();
int a_nc = a.cols ();
galois result (a_nr, a_nc, 0, a.m (), a.primpoly ());
int bi = (int) b;
if ((double)bi != b)
{
gripe_integer_galois ();
return galois ();
}
while (bi < 0)
bi += a.n ();
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < a_nr; i++)
{
if (bi == 0)
result(i, j) = 1;
else if (a(i, j) != 0)
result(i, j) = a.alpha_to (modn (a.index_of (a(i, j)) *
bi, a.m (), a.n ()));
}
return result;
}
galois
elem_pow (const galois &a, int b)
{
int a_nr = a.rows ();
int a_nc = a.cols ();
galois result (a_nr, a_nc, 0, a.m (), a.primpoly ());
while (b < 0)
b += a.n ();
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < a_nr; i++)
{
if (b == 0)
result(i, j) = 1;
else if (a(i, j) != 0)
result(i, j) = a.alpha_to (modn (a.index_of (a(i, j)) * b,
a.m (), a.n ()));
}
return result;
}
galois
pow (const galois& a, double b)
{
int bi = (int)b;
if ((double)bi != b)
{
gripe_integer_power_galois ();
return galois ();
}
return pow (a, bi);
}
galois
pow (const galois& a, const galois& b)
{
int nr = b.rows ();
int nc = b.cols ();
if (a.have_field () && b.have_field ())
{
if ((a.m () != b.m ()) || (a.primpoly () != b.primpoly ()))
{
gripe_differ_galois ();
return galois ();
}
}
else
{
gripe_invalid_galois ();
return galois ();
}
if (nr != 1 || nc != 1)
{
gripe_square_galois ();
return galois ();
}
else
return pow (a, b(0, 0));
}
galois
pow (const galois& a, int b)
{
galois retval;
int nr = a.rows ();
int nc = a.cols ();
if (!a.have_field ())
{
gripe_invalid_galois ();
return retval;
}
if (nr == 0 || nc == 0 || nr != nc)
gripe_square_galois ();
else if (b == 0)
{
retval = galois (nr, nc, 0, a.m (), a.primpoly ());
for (int i = 0; i < nr; i++)
retval(i, i) = 1;
}
else
{
galois atmp;
if (b < 0 )
{
atmp = a.inverse ();
b = abs (b);
}
else
atmp = a;
retval = atmp;
b--;
while (b > 0)
{
if (b & 1)
retval = retval * atmp;
b >>= 1;
if (b > 0)
atmp = atmp * atmp;
}
}
return retval;
}
galois
operator * (const Matrix& a, const galois& b)
{
galois tmp (a, b.m (), b.primpoly ());
OCTAVE_QUIT;
return tmp * b;
}
galois
operator * (const galois& a, const Matrix& b)
{
galois tmp (b, a.m (), a.primpoly ());
OCTAVE_QUIT;
return a * tmp;
}
galois
operator * (const galois& a, const galois& b)
{
if (a.have_field () && b.have_field ())
{
if ((a.m () != b.m ()) || (a.primpoly () != b.primpoly ()))
{
gripe_differ_galois ();
return galois ();
}
}
else
{
gripe_invalid_galois ();
return galois ();
}
int a_nr = a.rows ();
int a_nc = a.cols ();
int b_nr = b.rows ();
int b_nc = b.cols ();
if ((a_nr == 1 && a_nc == 1) || (b_nr == 1 && b_nc == 1))
return product (a, b);
else if (a_nc != b_nr)
{
OCTAVE__ERR_NONCONFORMANT ("operator *", a_nr, a_nc, b_nr, b_nc);
return galois ();
}
else
{
galois retval (a_nr, b_nc, 0, a.m (), a.primpoly ());
if (a_nr != 0 && a_nc != 0 && b_nc != 0)
{
// This is not optimum for referencing b, but can use vector
// to represent index(a(k,j)). Seems to be the fastest.
galois c (a_nr, 1, 0, a.m (), a.primpoly ());
for (int j = 0; j < b_nr; j++)
{
for (int k = 0; k < a_nr; k++)
c(k, 0) = a.index_of (a(k, j));
for (int i = 0; i < b_nc; i++)
if (b(j, i) != 0)
{
int tmp = a.index_of (b(j, i));
for (int k = 0; k < a_nr; k++)
{
if (a(k, j) != 0)
retval(k, i) = retval(k, i)
^ a.alpha_to (modn (tmp + c(k, 0),
a.m (), a.n ()));
}
}
}
}
return retval;
}
}
// Other operators
boolMatrix
galois::all (int dim) const
{
return do_mx_red_op (*this, dim, mx_inline_all);
}
boolMatrix
galois::any (int dim) const
{
return do_mx_red_op (*this, dim, mx_inline_any);
}
galois
galois::prod (int dim) const
{
if (!have_field ())
{
gripe_invalid_galois ();
return galois ();
}
galois retval (0, 0, 0, m (), primpoly ());
#define ROW_EXPR \
if ((retval(i, 0) == 0) || (elem (i, j) == 0)) \
retval(i, 0) = 0; \
else \
retval(i, 0) = alpha_to (modn (index_of (retval(i, 0)) + \
index_of (elem (i, j)), m (), n ()));
#define COL_EXPR \
if ((retval(0, j) == 0) || (elem (i, j) == 0)) \
retval(0, j) = 0; \
else \
retval(0, j) = alpha_to (modn (index_of (retval(0, j)) + \
index_of (elem (i, j)), m (), n ()));
GALOIS_REDUCTION_OP (retval, ROW_EXPR, COL_EXPR, 1, 1);
return retval;
#undef ROW_EXPR
#undef COL_EXPR
}
galois
galois::sum (int dim) const
{
if (!have_field ())
{
gripe_invalid_galois ();
return galois ();
}
galois retval (0, 0, 0, m (), primpoly ());
#define ROW_EXPR \
retval(i, 0) ^= elem (i, j);
#define COL_EXPR \
retval(0, j) ^= elem (i, j);
GALOIS_REDUCTION_OP (retval, ROW_EXPR, COL_EXPR, 0, 0);
return retval;
#undef ROW_EXPR
#undef COL_EXPR
}
galois
galois::sumsq (int dim) const
{
if (!have_field ())
{
gripe_invalid_galois ();
return galois ();
}
galois retval (0, 0, 0, m (), primpoly ());
#define ROW_EXPR \
if (elem (i, j) != 0) \
retval(i, 0) ^= alpha_to (modn (2*index_of (elem (i, j)), m (), n ()));
#define COL_EXPR \
if (elem (i, j) != 0) \
retval(0, j) ^= alpha_to (modn (2*index_of (elem (i, j)), m (), n ()));
GALOIS_REDUCTION_OP (retval, ROW_EXPR, COL_EXPR, 0, 0);
return retval;
#undef ROW_EXPR
#undef COL_EXPR
}
galois
galois::sqrt (void) const
{
galois retval (*this);
int nr = rows ();
int nc = cols ();
for (int j = 0; j < nc; j++)
{
for (int i = 0; i < nr; i++)
if (retval.index_of (retval(i, j)) & 1)
retval(i, j) = retval.alpha_to ((retval.index_of (retval(i, j))
+ retval.n ()) / 2);
else
retval(i, j) = retval.alpha_to (retval.index_of (retval(i, j))
/ 2);
}
return retval;
}
galois
galois::log (void) const
{
bool warned = false;
if (!have_field ())
{
gripe_invalid_galois ();
return galois ();
}
galois retval (*this);
int nr = rows ();
int nc = cols ();
for (int j = 0; j < nc; j++)
for (int i = 0; i < nr; i++)
{
if (retval(i, j) == 0)
{
if (!warned)
{
warning ("log of zero undefined in Galois field");
warned = true;
}
// How do I flag a NaN without either
// 1) Having to check everytime that the data is valid
// 2) Causing overflow in alpha_to or index_of!!
retval(i, j) = retval.index_of (retval(i, j));
}
else
retval(i, j) = retval.index_of (retval(i, j));
}
return retval;
}
galois
galois::exp (void) const
{
bool warned = false;
if (!have_field ())
{
gripe_invalid_galois ();
return galois ();
}
galois retval (*this);
int nr = rows ();
int nc = cols ();
for (int j = 0; j < nc; j++)
for (int i = 0; i < nr; i++)
{
if (retval(i, j) == n ())
{
if (!warned)
{
warning ("warning: exp of 2^m-1 undefined in Galois field");
warned = true;
}
// How do I flag a NaN without either
// 1) Having to check everytime that the data is valid
// 2) Causing overflow in alpha_to or index_of!!
retval(i, j) = retval.alpha_to (retval(i, j));
}
else
retval(i, j) = retval.alpha_to (retval(i, j));
}
return retval;
}
template class base_lu ;
void
galoisLU::factor (const galois& a, const pivot_type& typ)
{
int a_nr = a.rows ();
int a_nc = a.cols ();
int mn = (a_nr > a_nc ? a_nc : a_nr);
ptype = typ;
info = 0;
ipvt.resize (dim_vector (mn, 1));
a_fact = a;
for (int j = 0; j < mn; j++)
{
int jp = j;
// Find the pivot and test for singularity
if (ptype == galoisLU::ROW)
{
for (int i = j+1; i < a_nr; i++)
if (a_fact(i, j) > a_fact(jp, j))
jp = i;
}
else
{
for (int i = j+1; i < a_nc; i++)
if (a_fact(j, i) > a_fact(j, jp))
jp = i;
}
ipvt(j) = jp;
if (a_fact(jp, j) != 0)
{
if (ptype == galoisLU::ROW)
{
// Apply the interchange to columns 1:NC.
if (jp != j)
for (int i = 0; i < a_nc; i++)
{
int tmp = a_fact(j, i);
a_fact(j, i) = a_fact(jp, i);
a_fact(jp, i) = tmp;
}
}
else
{
// Apply the interchange to rows 1:NR.
if (jp != j)
for (int i = 0; i < a_nr; i++)
{
int tmp = a_fact(i, j);
a_fact(i, j) = a_fact(i, jp);
a_fact(i, jp) = tmp;
}
}
// Compute elements J+1:M of J-th column.
if ( j < a_nr-1)
{
int idxj = a_fact.index_of (a_fact(j, j));
for (int i = j+1; i < a_nr; i++)
{
if (a_fact(i, j) == 0)
a_fact(i, j) = 0;
else
a_fact(i, j) = a_fact.alpha_to (modn (a_fact.index_of (a_fact(i, j))
- idxj + a_fact.n (), a_fact.m (),
a_fact.n ()));
}
}
}
else
{
info = 1;
}
if (j < mn-1)
{
// Update trailing submatrix.
for (int i = j+1; i < a_nr; i++)
{
if (a_fact(i, j) != 0)
{
int idxi = a_fact.index_of (a_fact(i, j));
for (int k = j+1; k < a_nc; k++)
{
if (a_fact(j, k) != 0)
a_fact(i, k) ^= a_fact.alpha_to (modn (a_fact.index_of (a_fact(j, k))
+ idxi, a_fact.m (),
a_fact.n ()));
}
}
}
}
}
}
galois
galoisLU::L (void) const
{
int a_nr = a_fact.rows ();
int a_nc = a_fact.cols ();
int mn = (a_nr < a_nc ? a_nr : a_nc);
galois l (a_nr, mn, 0, a_fact.m (), a_fact.primpoly ());
for (int i = 0; i < mn; i++)
l(i, i) = 1;
for (int j = 0; j < mn; j++)
for (int i = j+1; i < a_nr; i++)
l(i, j) = a_fact (i, j);
return l;
}
galois
galoisLU::U (void) const
{
int a_nr = a_fact.rows ();
int a_nc = a_fact.cols ();
int mn = (a_nr < a_nc ? a_nr : a_nc);
galois u (mn, a_nc, 0, a_fact.m (), a_fact.primpoly ());
for (int j = 0; j < a_nc; j++)
for (int i = 0; i < (j+1 > mn ? mn : j+1); i++)
u (i, j) = a_fact (i, j);
return u;
}
galois
galois::inverse (void) const
{
int info;
return inverse (info);
}
galois
galois::inverse (int& info, int force) const
{
int nr = rows ();
int nc = cols ();
info = 0;
if (nr != nc || nr == 0 || nc == 0)
{
(*current_liboctave_error_handler) ("inverse requires square matrix");
return galois ();
}
else
{
int info = 0;
// Solve with identity matrix to find the inverse.
galois btmp (nr, nr, 0, m (), primpoly ());
for (int i = 0; i < nr; i++)
btmp(i, i) = 1;
galois retval = solve (btmp, info, 0);
if (info == 0)
return retval;
else
return galois ();
}
}
galois
galois::determinant (void) const
{
int info;
return determinant (info);
}
galois
galois::determinant (int& info) const
{
galois retval (1, 1, 0, m (), primpoly ());
int nr = rows ();
int nc = cols ();
info = -1;
if (nr == 0 || nc == 0)
{
info = 0;
retval(0, 0) = 1;
}
else
{
galoisLU fact (*this);
if ( ! fact.singular ())
{
galois A (fact.a_fact);
info = 0;
retval(0, 0) = A(0, 0);
for (int i = 1; i < nr; i++)
{
if ((retval(0, 0) == 0) || (A(i, i) == 0))
{
retval(0, 0) = 0;
error ("What the hell are we doing here!!!");
}
else
retval(0, 0) = alpha_to (modn (index_of (retval(0, 0)) +
index_of (A(i, i)), m (), n ()));
}
}
}
return retval;
}
galois
galois::solve (const galois& b) const
{
int info;
return solve (b, info);
}
galois
galois::solve (const galois& b, int& info) const
{
return solve (b, info, 0);
}
galois
galois::solve (const galois& b, int& info,
solve_singularity_handler sing_handler) const
{
galois retval (b);
if (!have_field () || !b.have_field ())
{
gripe_invalid_galois ();
return galois ();
}
else if ((m () != b.m ()) || (primpoly () != b.primpoly ()))
{
gripe_differ_galois ();
return galois ();
}
int nr = rows ();
int nc = cols ();
int b_nr = b.rows ();
int b_nc = b.cols ();
galois c (nr, 1, 0, m (), primpoly ());
// if (nr == 0 || nc == 0 || nr != nc || nr != b_nr)
if (nr == 0 || nc == 0 || nr != b_nr)
{
(*current_liboctave_error_handler)
("matrix dimension mismatch solution of linear equations");
return galois ();
}
else if (nc > nr)
{
// Under-determined system, use column interchanges.
galoisLU fact ((*this), galoisLU::COL);
if (fact.singular ())
{
info = -1;
if (sing_handler)
sing_handler (0.0);
else
(*current_liboctave_error_handler)("galois matrix singular");
return galois ();
}
else
{
galois A (fact.a_fact);
Array IP (fact.ipvt);
// Resize the number of solution rows if needed
if (nc > nr)
retval.resize (dim_vector (b_nr+nc-nr, b_nc), 0);
//Solve L*X = B, overwriting B with X.
int mn = (nc < nr ? nc : nr);
for (int k = 0; k < mn; k++)
{
for (int i = k+1; i < nr; i++)
c(i, 0) = index_of (A(i, k));
for (int j = 0; j < b_nc; j++)
if (retval(k, j) != 0)
{
int idx = index_of (retval(k, j));
for (int i = k+1; i < nr; i++)
if (A(i, k) != 0)
retval(i, j) ^= alpha_to (modn (c(i, 0) + idx, m (), n ()));
}
}
// Solve U*X = B, overwriting B with X.
for (int k = (nc < nr ? nc-1 : nr-1); k >= 0; k--)
{
int mn = k+1 < nr ? k+1 : nr;
for (int i = 0; i < mn; i++)
c(i, 0) = index_of (A(i, k));
mn = k < nr ? k : nr;
for (int j = 0; j < b_nc; j++)
if (retval(k, j) != 0)
{
retval(k, j) = alpha_to (modn (index_of (retval(k, j)) -
c(k, 0) + n (), m (), n ()));
int idx = index_of (retval(k, j));
for (int i = 0; i < mn; i++)
if (A(i, k) != 0)
retval(i, j) ^= alpha_to (modn (c(i, 0) + idx, m (), n ()));
}
}
// Apply row interchanges to the right hand sides.
//for (int j = 0; j < IP.length (); j++)
for (int j = IP.numel ()-1; j >= 0; j--)
{
int piv = IP(j);
for (int i = 0; i < b_nc; i++)
{
int tmp = retval(j, i);
retval(j, i) = retval(piv, i);
retval(piv, i) = tmp;
}
}
}
}
else
{
galoisLU fact (*this);
if (fact.singular ())
{
info = -1;
if (sing_handler)
sing_handler (0.0);
else
(*current_liboctave_error_handler)("galois matrix singular");
return galois ();
}
else
{
galois A (fact.a_fact);
Array IP (fact.ipvt);
// Apply row interchanges to the right hand sides.
for (int j = 0; j < IP.numel (); j++)
{
int piv = IP(j);
for (int i = 0; i < b_nc; i++)
{
int tmp = retval(j, i);
retval(j, i) = retval(piv, i);
retval(piv, i) = tmp;
}
}
//Solve L*X = B, overwriting B with X.
int mn = (nc < nr ? nc : nr);
for (int k = 0; k < mn; k++)
{
for (int i = k+1; i < nr; i++)
c(i, 0) = index_of (A(i, k));
for (int j = 0; j < b_nc; j++)
if (retval(k, j) != 0)
{
int idx = index_of (retval(k, j));
for (int i = k+1; i < nr; i++)
if (A(i, k) != 0)
retval(i, j) ^= alpha_to (modn (c(i, 0) + idx, m (), n ()));
}
}
// Solve U*X = B, overwriting B with X.
for (int k = (nc < nr ? nc-1 : nr-1); k >= 0; k--)
{
int mn = k+1 < nr ? k+1 : nr;
for (int i = 0; i < mn; i++)
c(i, 0) = index_of (A(i, k));
mn = k < nr ? k : nr;
for (int j = 0; j < b_nc; j++)
if (retval(k, j) != 0)
{
retval(k, j) = alpha_to (modn (index_of (retval(k, j)) -
c(k, 0) + n (), m (), n ()));
int idx = index_of (retval(k, j));
for (int i = 0; i < mn; i++)
if (A(i, k) != 0)
retval(i, j) ^= alpha_to (modn (c(i, 0) + idx, m (), n ()));
}
}
// Resize the number of solution rows if needed
if (nc < nr)
retval.resize (dim_vector (b_nr+nc-nr, b_nc));
}
}
return retval;
}
galois
xdiv (const galois& a, const Matrix& b)
{
galois btmp (b, a.m (), a.primpoly ());
return xdiv (a, btmp);
}
galois
xdiv (const Matrix& a, const galois& b)
{
galois atmp (a, b.m (), b.primpoly ());
return xdiv (atmp, b);
}
galois
xdiv (const galois& a, const galois& b)
{
int info = 0;
int a_nc = a.cols ();
int b_nc = b.cols ();
// if ((a_nc != b_nc) || (b.rows () != b.cols ()))
if (a_nc != b_nc)
{
int a_nr = a.rows ();
int b_nr = b.rows ();
OCTAVE__ERR_NONCONFORMANT ("operator /", a_nr, a_nc, b_nr, b_nc);
return galois ();
}
galois atmp = a.transpose ();
galois btmp = b.transpose ();
galois result = btmp.solve (atmp, info, 0);
if (info == 0)
return galois (result.transpose ());
else
return galois ();
}
galois
xleftdiv (const galois& a, const Matrix& b)
{
galois btmp (b, a.m (), a.primpoly ());
return xleftdiv (a, btmp);
}
galois
xleftdiv (const Matrix& a, const galois& b)
{
galois atmp (a, b.m (), b.primpoly ());
return xleftdiv (atmp, b);
}
galois
xleftdiv (const galois& a, const galois& b)
{
int info = 0;
int a_nr = a.rows ();
int b_nr = b.rows ();
// if ((a_nr != b_nr) || (a.rows () != a.columns ()))
if (a_nr != b_nr)
{
int a_nc = a.cols ();
int b_nc = b.cols ();
OCTAVE__ERR_NONCONFORMANT ("operator \\", a_nr, a_nc, b_nr, b_nc);
return galois ();
}
galois result = a.solve (b, info, 0);
if (info == 0)
return result;
else
return galois ();
}
MM_BIN_OPS1 (galois, galois, galois, 1, 2, GALOIS)
MM_BIN_OPS1 (galois, galois, Matrix, 1, 2, MATRIX)
MM_BIN_OPS1 (galois, Matrix, galois, 2, 1, MATRIX)
MM_CMP_OPS1 (galois, , galois, , 1, 2, GALOIS)
MM_CMP_OPS1 (galois, , Matrix, , 1, 2, MATRIX)
MM_CMP_OPS1 (Matrix, , galois, , 2, 1, MATRIX)
MM_BOOL_OPS1 (galois, galois, 0.0, 1, 2, GALOIS)
MM_BOOL_OPS1 (galois, Matrix, 0.0, 1, 2, MATRIX)
MM_BOOL_OPS1 (Matrix, galois, 0.0, 2, 1, MATRIX)
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/op-gm-gm.cc 0000644 0000000 0000000 00000000074 13604150022 017016 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/op-gm-gm.cc 0000644 0001750 0001750 00000013651 13604150022 016723 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include
#ifdef HAVE_OCTAVE_OVL_H
#include
#elif HAVE_OCTAVE_OCT_OBJ_H
#include
#endif
#include
#include "galois.h"
#include "ov-galois.h"
#include "galois-ops.h"
// galois unary ops.
DEFUNOP_OP (not, galois, !)
DEFUNOP (uminus, galois)
{
CAST_UNOP_ARG (const octave_galois&);
// Unitary minus of Galois Field is itself!!
return new octave_galois (v.galois_value ());
}
DEFUNOP (uplus, galois)
{
CAST_UNOP_ARG (const octave_galois&);
return new octave_galois (v.galois_value ());
}
DEFUNOP (transpose, galois)
{
CAST_UNOP_ARG (const octave_galois&);
return new octave_galois (v.galois_value ().transpose ());
}
// galois by galois ops.
DEFBINOP_OP_G (add, galois, galois, +)
DEFBINOP_OP_G (sub, galois, galois, -)
DEFBINOP_OP_G (mul, galois, galois, *)
DEFBINOP_FN_G (div, galois, galois, xdiv)
DEFBINOP_FN_G (pow, galois, galois, pow)
DEFBINOP_FN_G (ldiv, galois, galois, xleftdiv)
DEFBINOP_FN (lt, galois, galois, mx_el_lt)
DEFBINOP_FN (le, galois, galois, mx_el_le)
DEFBINOP_FN (eq, galois, galois, mx_el_eq)
DEFBINOP_FN (ge, galois, galois, mx_el_ge)
DEFBINOP_FN (gt, galois, galois, mx_el_gt)
DEFBINOP_FN (ne, galois, galois, mx_el_ne)
DEFBINOP_FN_G (el_mul, galois, galois, product)
DEFBINOP_FN_G (el_div, galois, galois, quotient)
DEFBINOP_FN_G (el_pow, galois, galois, elem_pow)
DEFBINOP (el_ldiv, galois, galois)
{
CAST_BINOP_ARGS (const octave_galois&, const octave_galois&);
return new octave_galois (quotient (v2.galois_value (), v1.galois_value ()));
}
DEFBINOP_FN (el_and, galois, galois, mx_el_and)
DEFBINOP_FN (el_or, galois, galois, mx_el_or)
DEFCATOP_G_METHOD (gm_gm, galois, galois, concat)
DEFASSIGNOP_FN (assign, galois, galois, assign)
#ifndef DEFMETHOD_DLD
void
install_gm_gm_ops (void)
{
INSTALL_UNOP (op_not, octave_galois, not);
INSTALL_UNOP (op_uminus, octave_galois, uminus);
INSTALL_UNOP (op_uplus, octave_galois, uplus);
INSTALL_UNOP (op_transpose, octave_galois, transpose);
INSTALL_UNOP (op_hermitian, octave_galois, transpose);
INSTALL_BINOP (op_add, octave_galois, octave_galois, add);
INSTALL_BINOP (op_sub, octave_galois, octave_galois, sub);
INSTALL_BINOP (op_mul, octave_galois, octave_galois, mul);
INSTALL_BINOP (op_div, octave_galois, octave_galois, div);
INSTALL_BINOP (op_pow, octave_galois, octave_galois, pow);
INSTALL_BINOP (op_ldiv, octave_galois, octave_galois, ldiv);
INSTALL_BINOP (op_lt, octave_galois, octave_galois, lt);
INSTALL_BINOP (op_le, octave_galois, octave_galois, le);
INSTALL_BINOP (op_eq, octave_galois, octave_galois, eq);
INSTALL_BINOP (op_ge, octave_galois, octave_galois, ge);
INSTALL_BINOP (op_gt, octave_galois, octave_galois, gt);
INSTALL_BINOP (op_ne, octave_galois, octave_galois, ne);
INSTALL_BINOP (op_el_mul, octave_galois, octave_galois, el_mul);
INSTALL_BINOP (op_el_div, octave_galois, octave_galois, el_div);
INSTALL_BINOP (op_el_pow, octave_galois, octave_galois, el_pow);
INSTALL_BINOP (op_el_ldiv, octave_galois, octave_galois, el_ldiv);
INSTALL_BINOP (op_el_and, octave_galois, octave_galois, el_and);
INSTALL_BINOP (op_el_or, octave_galois, octave_galois, el_or);
INSTALL_G_CATOP (octave_galois, octave_galois, gm_gm);
INSTALL_ASSIGNOP (op_asn_eq, octave_galois, octave_galois, assign);
}
#else
void
install_gm_gm_ops (octave::type_info& ti)
{
INSTALL_UNOP_TI (ti, op_not, octave_galois, not);
INSTALL_UNOP_TI (ti, op_uminus, octave_galois, uminus);
INSTALL_UNOP_TI (ti, op_uplus, octave_galois, uplus);
INSTALL_UNOP_TI (ti, op_transpose, octave_galois, transpose);
INSTALL_UNOP_TI (ti, op_hermitian, octave_galois, transpose);
INSTALL_BINOP_TI (ti, op_add, octave_galois, octave_galois, add);
INSTALL_BINOP_TI (ti, op_sub, octave_galois, octave_galois, sub);
INSTALL_BINOP_TI (ti, op_mul, octave_galois, octave_galois, mul);
INSTALL_BINOP_TI (ti, op_div, octave_galois, octave_galois, div);
INSTALL_BINOP_TI (ti, op_pow, octave_galois, octave_galois, pow);
INSTALL_BINOP_TI (ti, op_ldiv, octave_galois, octave_galois, ldiv);
INSTALL_BINOP_TI (ti, op_lt, octave_galois, octave_galois, lt);
INSTALL_BINOP_TI (ti, op_le, octave_galois, octave_galois, le);
INSTALL_BINOP_TI (ti, op_eq, octave_galois, octave_galois, eq);
INSTALL_BINOP_TI (ti, op_ge, octave_galois, octave_galois, ge);
INSTALL_BINOP_TI (ti, op_gt, octave_galois, octave_galois, gt);
INSTALL_BINOP_TI (ti, op_ne, octave_galois, octave_galois, ne);
INSTALL_BINOP_TI (ti, op_el_mul, octave_galois, octave_galois, el_mul);
INSTALL_BINOP_TI (ti, op_el_div, octave_galois, octave_galois, el_div);
INSTALL_BINOP_TI (ti, op_el_pow, octave_galois, octave_galois, el_pow);
INSTALL_BINOP_TI (ti, op_el_ldiv, octave_galois, octave_galois, el_ldiv);
INSTALL_BINOP_TI (ti, op_el_and, octave_galois, octave_galois, el_and);
INSTALL_BINOP_TI (ti, op_el_or, octave_galois, octave_galois, el_or);
INSTALL_CATOP_TI (ti, octave_galois, octave_galois, gm_gm);
INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_galois, octave_galois, assign);
}
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/galois-def.cc 0000644 0000000 0000000 00000000074 13604150022 017410 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/galois-def.cc 0000644 0001750 0001750 00000006145 13604150022 017315 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#include "galois.h"
void
gripe_nonconformant_galois (const char *op, int op1_m, int op1_primpoly,
int op2_m, int op2_primpoly)
{
(*current_liboctave_error_handler)
("%s: nonconformant arguments. op1 is GF(2^%d) "
"(primitive polynomial %d), op2 is GF(2^%d) (primitive polynomial %d)",
op, op1_m, op1_primpoly, op2_m, op2_primpoly);
}
void
gripe_nonconformant_galois (const char *op, int m)
{
(*current_liboctave_error_handler)
("%s: element exceeds range of galois field GF(2^%d)", op, m);
}
void
gripe_divzero_galois (const char *op)
{
(*current_liboctave_error_handler)
("%s: division by zero in galois field", op);
}
void
gripe_invalid_galois (void)
{
(*current_liboctave_error_handler)
("invalid data in Galois Field");
}
void
gripe_range_galois (int m)
{
(*current_liboctave_error_handler)
("data outside range of Galois Field GF(2^%d)", m);
}
void
gripe_integer_galois (void)
{
(*current_liboctave_error_handler)
("data in Galois Field must be integer");
}
void
gripe_copy_invalid_galois (void)
{
(*current_liboctave_error_handler)
("trying to copy invalid Galois Field");
}
void
gripe_differ_galois (void)
{
(*current_liboctave_error_handler)
("can not assign data between two different Galois Fields");
}
void
gripe_invalid_table_galois (void)
{
(*current_liboctave_error_handler)
("invalid lookup table in Galois Field");
}
void
gripe_square_galois (void)
{
(*current_liboctave_error_handler)
("for A^x, A must be square and x scalar");
}
void
gripe_integer_power_galois (void)
{
(*current_liboctave_error_handler)
("exponent must be integer for binary operator '^' with galois field");
}
void
gripe_order_galois (int m)
{
(*current_liboctave_error_handler)
("invalid order %d for Galois Field", m);
}
void
gripe_degree_galois (int m)
{
(*current_liboctave_error_handler)
("invalid degree for primitive polynomial (%d) of Galois Field", m);
}
void
gripe_irred_galois (int m)
{
(*current_liboctave_error_handler)
("primitive polynomial (%d) of Galois Field must be irreducible", m);
}
void
gripe_init_galois (void)
{
(*current_liboctave_error_handler)
("unable to initialize Galois Field");
}
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/bootstrap 0000644 0000000 0000000 00000000074 13604150022 017027 x ustar 00 30 atime=1578160212.353201899
30 ctime=1578160213.541197341
communications-1.2.2/src/bootstrap 0000755 0001750 0001750 00000000337 13604150022 016734 0 ustar 00nir nir 0000000 0000000 #!/bin/bash
## Octave-Forge: package bootstrap script
## Run this to generate the configure script
set -e # halt if unhandled error
aclocal
autoconf # generate configure script
autoheader -f
rm -rf autom4te.cache
communications-1.2.2/src/PaxHeaders.12771/__gfweight__.cc 0000644 0000000 0000000 00000000074 13604150022 017776 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/__gfweight__.cc 0000644 0001750 0001750 00000004765 13604150022 017711 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
static int
get_weight (const Array& codeword, const Matrix& gen,
int weight, int depth, int start, int n, int k)
{
int retval = weight;
for (int i = start; i < k ; i++)
{
OCTAVE_QUIT;
Array new_codeword (codeword);
int tmp = 0;
for (int j = 0; j < n; j++)
if (new_codeword (j) ^= (char)gen(i,j))
tmp++;
if (tmp < retval)
retval = tmp;
if (depth < retval)
retval = get_weight (new_codeword, gen, retval, depth+1, i+1, n, k);
}
return retval;
}
DEFUN_DLD (__gfweight__, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{w} =} __gfweight__ (@var{gen})\n\
Returns the minimum distance @var{w} of the generator matrix @var{gen}.\n\
The codeword length is @var{k}.\n\
\n\
This is an internal function of @code{gfweight}. You should use\n\
@code{gfweight} rather than use this function directly.\n\
@seealso{gfweight}\n\
@end deftypefn")
{
if (args.length () != 1)
{
print_usage ();
return octave_value ();
}
Matrix gen = args(0).matrix_value ();
int k = gen.rows ();
int n = gen.columns ();
if (k > 128)
{
octave_stdout << "__gfweight__: this is likely to take a very long time!!\n";
OCTAVE__FLUSH_STDOUT ();
}
Array codeword (dim_vector (n, 1), 0);
return octave_value ((double)get_weight (codeword, gen, n - k + 1, 1,
0, n, k));
}
/*
%% Test input validation
%!error __gfweight__ ()
%!error __gfweight__ (1, 2)
*/
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/
communications-1.2.2/src/PaxHeaders.12771/cyclpoly.cc 0000644 0000000 0000000 00000000074 13604150022 017234 x ustar 00 30 atime=1578160160.425400902
30 ctime=1578160213.541197341
communications-1.2.2/src/cyclpoly.cc 0000644 0001750 0001750 00000017410 13604150022 017136 0 ustar 00nir nir 0000000 0000000 //Copyright (C) 2003 David Bateman
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 this program; if not, see
// .
//
// In addition to the terms of the GPL, you are permitted to link this
// program with any Open Source program, as defined by the Open Source
// Initiative (www.opensource.org)
#include
#include
#include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
enum cyclic_poly_type
{
CYCLIC_POLY_MIN=0,
CYCLIC_POLY_MAX,
CYCLIC_POLY_ALL,
CYCLIC_POLY_L
};
// A simplified version of the filter function for specific lengths of
// a and b in the Galois field GF(2)
Array
filter_gf2 (const Array& b, const Array& a,
const Array& x, const int& n)
{
int x_len = x.numel ();
Array si (dim_vector (n, 1), 0);
Array y (dim_vector (x_len, 1), 0);
for (int i = 0; i < x_len; i++)
{
y(i) = si(0);
if (b(0) && x(i))
y(i) ^= 1;
for (int j = 0; j < n - 1; j++)
{
si(j) = si(j+1);
if (a(j+1) && y(i))
si(j) ^= 1;
if (b(j+1) && x(i))
si(j) ^= 1;
}
si(n-1) = 0;
if (a(n) && y(i))
si(n-1) ^= 1;
if (b(n) && x(i))
si(n-1) ^= 1;
}
return y;
}
// Cyclic polynomial is irreducible. I.E. it divides into x^n-1
// without remainder There must surely be an easier way of doing this
// as the polynomials are over GF(2).
static bool
do_is_cyclic_polynomial (const unsigned long long& a1, const int& n,
const int& m)
{
Array a (dim_vector (n+1, 1), 0);
Array y (dim_vector (n+1, 1), 0);
Array x (dim_vector (n-m+2, 1), 0);
y(0) = 1;
y(n) = 1;
x(0) = 1;
for (int i=0; i < m+1; i++)
a(i) = (a1 & (1UL << i) ? 1 : 0);
Array b = filter_gf2 (y, a, x, n);
b.resize(dim_vector (n+1, 1), 0);
Array p (dim_vector (m+1, 1), 0);
p(0) = 1;
Array q = filter_gf2 (a, p, b, m);
for (int i=0; i < n+1; i++)
if (y(i) ^ q(i))
return false;
return true;
}
DEFUN_DLD (cyclpoly, args, nargout,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{y} =} cyclpoly (@var{n}, @var{k})\n\
@deftypefnx {Loadable Function} {@var{y} =} cyclpoly (@var{n}, @var{k}, @var{opt})\n\
@deftypefnx {Loadable Function} {@var{y} =} cyclpoly (@var{n}, @var{k}, @var{opt}, @var{rep})\n\
This function returns the cyclic generator polynomials of the code\n\
[@var{n},@var{k}]. By default the polynomial with the smallest weight\n\
is returned. However this behavior can be overridden with the @var{opt}\n\
flag. Valid values of @var{opt} are:\n\
\n\
@table @asis\n\
@item @code{\"all\"}\n\
Returns all of the polynomials of the code [@var{n},@var{k}]\n\
@item @code{\"min\"}\n\
Returns the polynomial of minimum weight of the code [@var{n},@var{k}]\n\
@item @code{\"max\"}\n\
Returns the polynomial of the maximum weight of the code [@var{n},@var{k}]\n\
@item @var{l}\n\
Returns the polynomials having exactly the weight @var{l}\n\
@end table\n\
\n\
The polynomials are returns as row-vectors in the variable @var{y}. Each\n\
row of @var{y} represents a polynomial with the least-significant term\n\
first. The polynomials can be returned with an integer representation\n\
if @var{rep} is @code{\"integer\"}. The default behavior is given if @var{rep}\n\
is @code{\"polynomial\"}.\n\
@seealso{gf, isprimitive}\n\
@end deftypefn")
{
octave_value retval;
int nargin = args.length ();
bool polyrep = true;
enum cyclic_poly_type type = CYCLIC_POLY_MIN;
RowVector cyclic_polys;
int l=0;
if (nargin < 2 || nargin > 4)
{
print_usage ();
return retval;
}
int n = args(0).int_value ();
int k = args(1).int_value ();;
if (n < 1)
{
error ("cyclpoly: n must be 1 or greater");
return retval;
}
if (n <= k)
{
error ("cyclpoly: k must be less than n");
return retval;
}
for (int i = 2; i < nargin; i++)
{
if (args(i).is_scalar_type ())
{
l = args(i).int_value ();
type = CYCLIC_POLY_L;
}
else if (args(i).is_string ())
{
std::string s_arg = args(i).string_value ();
if (s_arg == "integer")
polyrep = false;
else if (s_arg == "polynomial")
polyrep = true;
else if (s_arg == "min")
type = CYCLIC_POLY_MIN;
else if (s_arg == "max")
type = CYCLIC_POLY_MAX;
else if (s_arg == "all")
type = CYCLIC_POLY_ALL;
else
{
error ("cyclpoly: invalid argument");
return retval;
}
}
else
{
error ("cyclpoly: incorrect argument type");
return retval;
}
}
int m = n - k;
// Matlab code seems to think that 1+x+x^3 is of larger weight than
// 1+x^2+x^3. So for matlab compatiability the list of polynomials
// should be reversed by replacing "i+=2" with "i-=2" and visa-versa.
// Thats not going to happen!!!
switch (type)
{
case CYCLIC_POLY_MIN:
cyclic_polys.resize (1);
for (unsigned long long i = (1UL< (1UL<