/usr/include/cppad/local/integer.hpp is in cppad 2016.00.00.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | // $Id: integer.hpp 3757 2015-11-30 12:03:07Z bradbell $
# ifndef CPPAD_INTEGER_HPP
# define CPPAD_INTEGER_HPP
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
CppAD is distributed under multiple licenses. This distribution is under
the terms of the
GNU General Public License Version 3.
A copy of this license is included in the COPYING file of this distribution.
Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
-------------------------------------------------------------------------- */
/*
------------------------------------------------------------------------------
$begin Integer$$
$spell
std
VecAD
CppAD
namespace
const
bool
$$
$section Convert From AD to Integer$$
$head Syntax$$
$icode%i% = Integer(%x%)%$$
$head Purpose$$
Converts from an AD type to the corresponding integer value.
$head i$$
The result $icode i$$ has prototype
$codei%
int %i%
%$$
$head x$$
$subhead Real Types$$
If the argument $icode x$$ has either of the following prototypes:
$codei%
const float %% &%x%
const double %% &%x%
%$$
the fractional part is dropped to form the integer value.
For example, if $icode x$$ is 1.5, $icode i$$ is 1.
In general, if $latex x \geq 0$$, $icode i$$ is the
greatest integer less than or equal $icode x$$.
If $latex x \leq 0$$, $icode i$$ is the
smallest integer greater than or equal $icode x$$.
$subhead Complex Types$$
If the argument $icode x$$ has either of the following prototypes:
$codei%
const std::complex<float> %% &%x%
const std::complex<double> %% &%x%
%$$
The result $icode i$$ is given by
$codei%
%i% = Integer(%x%.real())
%$$
$subhead AD Types$$
If the argument $icode x$$ has either of the following prototypes:
$codei%
const AD<%Base%> &%x%
const VecAD<%Base%>::reference &%x%
%$$
$icode Base$$ must support the $code Integer$$ function and
the conversion has the same meaning as for $icode Base$$.
$head Operation Sequence$$
The result of this operation is not an
$cref/AD of Base/glossary/AD of Base/$$ object.
Thus it will not be recorded as part of an
AD of $icode Base$$
$cref/operation sequence/glossary/Operation/Sequence/$$.
$head Example$$
$children%
example/integer.cpp
%$$
The file
$cref integer.cpp$$
contains an example and test of this operation.
$end
------------------------------------------------------------------------------
*/
namespace CppAD {
template <class Base>
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION
int Integer(const AD<Base> &x)
{ return Integer(x.value_); }
template <class Base>
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION
int Integer(const VecAD_reference<Base> &x)
{ return Integer( x.ADBase() ); }
}
# endif
|