Changeset 608


Ignore:
Timestamp:
Aug 10, 2015 4:06:55 PM (4 years ago)
Author:
kulshres
Message:

merge branch 'master' of 'gitclone' into 'svn'

The following commits have been merged:

commit 48aee4916d2ed907b772dbd1c1d6ce46cb273651
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Aug 10 21:28:49 2015 +0200

modernise configure.ac

disable static library building. this causes more
problems than it solves.

commit 47332811a4c5c27cb884f75792c910c813378ef4
Merge: 0ee77fd 0d4eeec
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Aug 6 22:33:46 2015 +0200

Merge branch 'edf-memory'

This is to reduce memory allocation and copying in ext_diff_fct

commit 0ee77fd33a1d6d55fcc67ad419937b2cb777ed4e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Aug 5 15:49:33 2015 +0200

Remove empty file from dist

this can be created during compilation

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 51505c34571aa61b4b21ebce6cdf1728ff56ddaa
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Aug 4 17:36:26 2015 +0200

adouble(const adub&) should match operator=(const adub&)

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 03e49097aa0455337647d280cda530064987e6b9
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Jul 3 11:17:53 2015 +0200

make a define for default contiguous locations

this is not needed during compilation of the library
only during compilation of user-code, if the user
wants to have all adouble* allocations to have
contiguous locations.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit f00cfb5d0dc8a8993581fd8c08dd8c6c5cd23248
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Jul 1 11:56:39 2015 +0200

rename adolc_lie.h to drivers.h

the old name led to an include <adolc/lie/adolc_lie.h>
which looks highly redundant.
new name makes for include <adolc/lie/drivers.h>

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit fcf78bf8426a227750a0bcaa32ff65e57ef329b8
Author: franke <mirko.franke@…>
Date: Wed May 20 16:39:16 2015 +0200

added Lie drivers

commit 0d4eeec7b6212aa64c8997db8a511f81b604b3e1
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Jun 26 14:19:41 2015 +0200

minimise extra memory requirement and copies in ext_diff

This should in theory reduce the amount of memory required
to run an external function with the old interface. It also
reduced some copying operations.

Fingers crossed that we've not broken checkpointing and/or
fixpoint iterations.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

commit 8811f02a4d4a15946a18f7513ab17dada66509c3
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri May 22 12:41:45 2015 +0200

try to streamline data copies in ext_diff_v2

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

Location:
trunk
Files:
1 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/Makefile.am

    r537 r608  
    4444endif
    4545
    46 lib@adolclib@_la_LIBADD  += src/drivers/libdrivers.la src/tapedoc/libtapedoc.la
     46lib@adolclib@_la_LIBADD  += src/drivers/libdrivers.la src/tapedoc/libtapedoc.la src/lie/liblie.la
    4747
    4848if SPARSE
    4949lib@adolclib@_la_LIBADD   += src/sparse/libsparse.la
    5050endif
     51
     52BUILD_SOURCES = dummy.cpp
     53
     54dummy.cpp:
     55        touch $@
    5156
    5257CC = $(saveCC)
  • trunk/ADOL-C/doc/adolc-manual.tex

    r594 r608  
    20242024\verb=trigger.cpp=  in the directory \verb=examples/additional_examples/taylor=
    20252025show the application of the procedures described here.
     2026%
     2027%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     2028\subsection{Drivers of the Toolbox for Lie Derivatives}
     2029Nonlinear controller and observer design often require certain types of Lie derivatives. These derivatives also arise in other areas such as classical mechanics and relativity.
     2030Lie derivatives are total derivatives of tensor fields along a vector field.
     2031The drivers for calculating Lie derivatives in ADOL-C presented in this section
     2032were developed by Klaus R{\"o}benack~\cite{Roeb05} and his co-workers Jan Winkler, Siqian Wang and Mirko Franke~\cite{Roeb11}.
     2033They are prototyped as C functions in the header file {\verb=<adolc_lie.h>=} and
     2034allow the calculation of Lie derivatives of scalar, vector and covector fields. In addition, the calculation of gradients of Lie derivatives of scalar fields is supported.
     2035
     2036We consider computational problems occurring in controller and observer design for
     2037nonlinear control systems
     2038\begin{equation*}
     2039\dot{\mathbf x}=\mathbf f(\mathbf x)+\mathbf g(\mathbf x)u,
     2040\quad \mathbf y=\mathbf h(\mathbf x),\quad \mathbf x(0)=\mathbf x_0 \in \Omega\\
     2041\end{equation*}
     2042with the scalar input u, the state $\mathbf x$, and the output $\mathbf y$, where the vector
     2043fields $\mathbf f : \Omega \to \R^n$, $\mathbf g: \Omega \to \R^n$
     2044and the map $\mathbf h: \Omega\to \R^m$ (for $m=1$ this map is the scalar field $h$)
     2045are defined on an open subset $\Omega\subseteq\R^n$.
     2046
     2047\sloppy
     2048\subsubsection*{Lie Derivatives of Scalar Fields}
     2049Consider the initial value problem
     2050\[
     2051 \dot{\mathbf x}={\mathbf f}(\mathbf x),\quad y=h(\mathbf x),\quad \mathbf{x}(0)=\mathbf{x}_0\in\Omega
     2052\]
     2053with the vector field $\mathbf f : \Omega \to \R^n$. The Lie derivative of the scalar field $h:\Omega\to\R$ along the vector field~$\mathbf{f}$ are time derivatives of the curve~$y$, i.e.,
     2054\[
     2055 \dot{y}(0)=L_\mathbf{f}h(\mathbf{x}_0),\;
     2056 \ddot{y}(0)=L_\mathbf{f}^2h(\mathbf{x}_0),\;  \ldots,\;
     2057 y^{(d)}(0)=L_\mathbf{f}^dh(\mathbf{x}_0).
     2058\]
     2059Formally, the Lie derivative of the scalar field~$h$ along the vector field~$\mathbf{f}$ is defined by
     2060\[
     2061 L_{\mathbf f} h(\mathbf x)=\frac{\partial h(\mathbf x)}{\partial \mathbf x}\,\mathbf f(\mathbf x).
     2062\]
     2063Higher order Lie derivatives are given by the recursion
     2064\[
     2065 L_{\mathbf f}^{k+1} h(\mathbf x)= \frac{\partial L_{\mathbf f}^k h(\mathbf x)}{\partial \mathbf x}\,\mathbf f(\mathbf x)\quad\text{with}\quad L_{\mathbf f}^0 h(\mathbf x)= h(\mathbf x).
     2066\]
     2067To compute Lie derivatives
     2068\[
     2069(L_\mathbf f^0h(\mathbf x_0),\ldots,L_\mathbf f^dh(\mathbf x_0))
     2070\]
     2071we need the trace numbers of the active sections of the vector field~$\mathbf f$ and the scalar field~$h$,
     2072the number of independent variables $n$, the initial value $\mathbf x_0\in\Omega$
     2073and the highest derivative degree $d$. The values of the Lie derivatives are
     2074then stored in the one dimensional array {\verb=result=} of length $d+1$:
     2075
     2076\begin{tabbing}
     2077\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2078\>{\sf int lie\_scalarc(Tape\_F, Tape\_H, n, x0, d, result)}\\
     2079\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2080\>{\sf short Tape\_H;}         \> // trace identification of scalar field $h$\\
     2081\>{\sf short n;}               \> // number of independent variables $n$ and $m = 1$\\
     2082\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2083\>{\sf short d; }              \> // highest derivative degree $d$\\
     2084\>{\sf double result[d+1];}    \> // resulting Lie derivatives of a scalar field\\
     2085\end{tabbing}   
     2086
     2087
     2088For a smooth vector-valued map $\mathbf h: \Omega\rightarrow \R^m$ with
     2089$\mathbf h(\mathbf x)=(h_1(\mathbf x),\ldots,h_m(\mathbf x))^T$
     2090we define the Lie derivative
     2091\begin{equation}\label{eq:lie_vectorial}
     2092L_\mathbf f^k\mathbf h(\mathbf x_0)=
     2093(L_\mathbf f^kh_1(\mathbf x_0),\ldots,L_\mathbf f^kh_m(\mathbf x_0))^T\in\R^m
     2094 \quad \text{for}\quad k = 0, \cdots, d,
     2095\end{equation}
     2096component-wise by the Lie derivatives $L_\mathbf f^k h_1(\mathbf x_0),\ldots,L_\mathbf f^k h_m(\mathbf x_0)$ of the $m$ scalar fields $h_1, \ldots, h_m:\Omega\to\R$. Note that~\eqref{eq:lie_vectorial} should not be confused with the Lie derivative of a vector field. To compute Lie derivatives~\eqref{eq:lie_vectorial} of the vector-valued map $\mathbf h$
     2097we additionally need the number of dependent variables $m$:
     2098
     2099\begin{tabbing}
     2100\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2101\>{\sf int lie\_scalarcv(Tape\_F, Tape\_H, n, m, x0, d, result)}\\
     2102\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2103\>{\sf short Tape\_H;}         \> // trace identification of vector-valued map $\mathbf h$\\
     2104\>{\sf short n;}               \> // number of independent variables $n$\\
     2105\>{\sf short m;}               \> // number of dependent variables $m$\\
     2106\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2107\>{\sf short d; }              \> // highest derivative degree $d$\\
     2108\>{\sf double result[m][d+1];} \> // resulting Lie derivatives of vectorial scalar fields\\
     2109\end{tabbing} 
     2110
     2111\subsubsection*{Gradients of Lie Derivatives of Scalar Fields}
     2112To compute the gradients
     2113\[
     2114(\mathrm{d}L_\mathbf f^0h(\mathbf x_0),\ldots, \mathrm{d}L_\mathbf f^dh(\mathbf x_0))
     2115\]
     2116of the Lie derivatives $L_\mathbf f^0h(\mathbf x_0),\ldots, L_\mathbf f^dh(\mathbf x_0)$ of the scalar field $h:\Omega\to\R$ along the vector field $\mathbf f:\Omega\to\R^n$,
     2117the following C function can be used:
     2118
     2119\begin{tabbing}
     2120\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2121\>{\sf int lie\_gradientc(Tape\_F, Tape\_H, n, x0, d, result)}\\
     2122\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2123\>{\sf short Tape\_H;}         \> // trace identification of scalar field $h$\\
     2124\>{\sf short n;}               \> // number of independent variables $n$ and $m=1$\\
     2125\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2126\>{\sf short d;}               \> // highest derivative degree $d$\\
     2127\>{\sf double result[n][d+1];} \> // resulting gradients of Lie derivatives\\
     2128\>{\sf} \> // of a scalar field\\
     2129\end{tabbing} 
     2130
     2131For calculating the jacobians $\mathrm{d}L_\mathbf f^k\mathbf h(\mathbf x_0)\in\R^{m\times n}$
     2132of Lie derivatives~\eqref{eq:lie_vectorial} of the vector-valued map $\mathbf h: \Omega\rightarrow \R^m$ for $k=0,\ldots,d$ one can use the following function, where the $d+1$ matrices are stored in the three dimensional array {\verb=result=}:
     2133
     2134\begin{tabbing}
     2135\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2136\>{\sf int lie\_gradientcv(Tape\_F, Tape\_H, n, m, x0, d, result)}\\
     2137\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2138\>{\sf short Tape\_H;}         \> // trace identification of vector-valued map $\mathbf h$\\
     2139\>{\sf short n;}               \> // number of independent variables $n$\\
     2140\>{\sf short m;}               \> // number of dependent variables $m$\\
     2141\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2142\>{\sf short d;}               \> // highest derivative degree $d$\\
     2143\>{\sf double result[m][n][d+1];} \> // resulting jacobians of Lie derivatives\\
     2144\>{\sf} \> // of vectorial scalar fields\\
     2145\end{tabbing}
     2146
     2147\subsubsection*{Lie Derivatives of Covector Fields}
     2148
     2149If we consider the elements of the real vector space $\R^n$ as column vectors, the elements of the associated dual space $(\R^n)^*$ can be represented by row vectors. These row vectors are called adjoint vectors in ADOL-C and covectors in differential geometry.
     2150In a program the user does not have to distinguish between a vector field
     2151$\mathbf f: \Omega \rightarrow \R^n$ and a covector field
     2152$\boldsymbol{\omega}: \Omega \rightarrow (\R^n)^*$, since for both fields the dependent variables are stored in one dimensional arrays.
     2153The Lie derivative of a covector field~$\boldsymbol{\omega}$ is defined by
     2154\[
     2155 L_{\mathbf f}\boldsymbol{\omega}(\mathbf x)=\boldsymbol{\omega}(\mathbf x)\,{\mathbf f}^\prime(\mathbf x)
     2156 + {\mathbf f}^T(\mathbf x) \left(\frac{\partial \boldsymbol{\omega}^T (\mathbf x)}{\partial \mathbf x}\right)^T.
     2157\]
     2158The $d+1$ Lie derivatives $L_{\mathbf f}^0\boldsymbol{\omega}(\mathbf x),\ldots,L_{\mathbf f}^d\boldsymbol{\omega}(\mathbf x)$ of the covector field $\boldsymbol{\omega}$ along the vector field~$\mathbf{f}$
     2159can be computed by
     2160
     2161\begin{tabbing}
     2162\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2163\>{\sf int lie\_covector(Tape\_F, Tape\_W, n, x0, d, result)}\\
     2164\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2165\>{\sf short Tape\_W;}         \> // trace identification of covector field $\boldsymbol{\omega}$\\
     2166\>{\sf short n;}               \> // number of independent variables $n$\\
     2167\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2168\>{\sf short d;}               \> // highest derivative degree $d$\\
     2169\>{\sf double result[n][d+1];} \> // resulting Lie derivatives of a covector field\\
     2170\end{tabbing}
     2171
     2172\subsubsection*{Lie Derivatives of a Vector Field (Lie Brackets)}
     2173
     2174Lie derivatives (Lie brackets) of a vector field $\mathbf g: \Omega \rightarrow \R^n$ along a vector field $\mathbf f: \Omega \rightarrow \R^n$ are defined by
     2175\[
     2176 \mathrm{ad}_\mathbf{f}\mathbf{g}(\mathbf{x})=[\mathbf{f},\mathbf{g}](\mathbf{x})
     2177 =\mathbf{g}^{\prime}(\mathbf{x})\mathbf{f}(\mathbf{x})-\mathbf{f}^{\prime}(\mathbf{x})\mathbf{g}(\mathbf{x}).
     2178\]
     2179We can calculate iterated Lie brackets $\mathrm{ad}_\mathbf{f}^0\mathbf{g}(\mathbf{x}),\ldots,\mathrm{ad}_\mathbf{f}^{d}\mathbf{g}(\mathbf{x})$ at the point $\mathbf{x}_0\in\Omega$
     2180using the C function listed below:
     2181
     2182\begin{tabbing}
     2183\hspace{0.5in}\={\sf short int tag;} \hspace{1.1in}\= \kill    % define tab position
     2184\>{\sf int lie\_bracket(Tape\_F, Tape\_G, n, x0, d, result)}\\
     2185\>{\sf short Tape\_F;}         \> // trace identification of vector field $\mathbf f$ \\
     2186\>{\sf short Tape\_G;}         \> // trace identification of vector field $\mathbf g$\\
     2187\>{\sf short n;}               \> // number of independent variables $n$\\
     2188\>{\sf double x0[n];}          \> // values of independent variables $\mathbf{x}_0$\\
     2189\>{\sf short d;}               \> // highest derivative degree $d$\\
     2190\>{\sf double result[n][d+1];} \> // resulting Lie derivatives of a vector field\\
     2191\end{tabbing}
     2192
     2193\subsubsection*{Additional C++ Drivers for Lie Derivatives}
     2194
     2195For Lie derivatives of scalar fields, the C interface offers two different drivers, namely {\verb=lie_scalarc=} for $m=1$ scalar field $h:\Omega\to\R$ and {\verb=lie_scalarcv=} for $m\geq1$ scalar fields $h_1,\ldots,h_m:\Omega\to\R$, which are combined in a vector-valued map $\mathbf{h}:\Omega\to\R^m$. Using the polymorphism in C++, both C drivers are unified by the C++ driver {\verb=lie_scalar=} for the computation of Lie derivatives of scalar fields:
     2196
     2197\begin{tabbing}
     2198\hspace{0.5in}\={\sf int lie\_scalar(Tape\_F, Tape\_H, n, x0, d, result)} \hspace{0.45in}\= // case $m=1$\\
     2199\>{\sf int lie\_scalar(Tape\_F, Tape\_H, n, m, x0, d, result)} \> // case $m\geq1$
     2200\end{tabbing}
     2201
     2202The same situation occurs with the gradients or jacobians of Lie derivatives of scalar fields. Here, the C drivers {\verb=lie_gradientc=} and {\verb=lie_gradientcv=} are unified by the C++ driver {\verb=lie_gradient=}:
     2203
     2204\begin{tabbing}
     2205\hspace{0.5in}\={\sf int lie\_gradient(Tape\_F, Tape\_H, n, x0, d, result)} \hspace{0.35in}\= // case $m=1$\\
     2206\>{\sf int lie\_gradient(Tape\_F, Tape\_H, n, m, x0, d, result)} \> // case $m\geq1$
     2207\end{tabbing}
     2208
     2209The C++ drivers are also prototyped in the header file {\sf $<$adolc\_lie.h$>$}. An example how to use these drivers for the calculation of Lie derivatives can be found in the file {\sf GantryCrane.cpp} in the directory {\verb=additional_examples/lie=}.
     2210
    20262211%
    20272212%
     
    46284813\newblock Addison-Wesley, Reading, 1973.
    46294814
     4815\bibitem{Roeb05}
     4816Klaus R\"{o}benack.
     4817\newblock{\em Computation of Lie Derivatives of Tensor Fields Required for
     4818         Nonlinear Controller and Observer Design Employing Automatic Differentiation. }
     4819\newblock PAMM, 5(1): 181-184, 2005.
     4820
     4821\bibitem{Roeb11}
     4822Klaus R\"{o}benack, Jan Winkler and Siqian Wang.
     4823\newblock {\em LIEDRIVERS - A Toolbox for the Efficient Computation of Lie
     4824          Derivatives Based on the Object-Oriented Algorithmic Differentiation
     4825          Package ADOL-C. }
     4826\newblock Proc. of the 4th International Workshop on Equation-Based Object-Oriented
     4827          Modeling Languages and Tools, F. E. Cellier and D. Broman and P. Fritzson
     4828          and E. A. Lee, editors, volume 56 of Link\"oping Electronic Conference Proceedings,
     4829          pages 57-66, Zurich 2011.
    46304830\bibitem{Wa05a}
    46314831Andrea Walther.
  • trunk/ADOL-C/examples/additional_examples/Makefile.am

    r537 r608  
    1717                       detexam helm lighthouse scal speelpenning taylor pow \
    1818                       checkpointing ext_diff_func fixpoint_exam openmp_exam \
    19                        cuda param
     19                       cuda param lie
    2020endif
    2121
     
    2424                       detexam helm lighthouse scal speelpenning taylor pow \
    2525                       checkpointing ext_diff_func fixpoint_exam openmp_exam \
    26                        cuda param
     26                       cuda param lie
    2727endif
  • trunk/ADOL-C/examples/additional_examples/ext_diff_func/ext_diff_func.cpp

    r605 r608  
    168168  int rc;
    169169
     170  set_nested_ctx(tag_ext_fct,true);
    170171  rc = zos_forward(tag_ext_fct, 2, 2, 0, yin, yout);
     172  set_nested_ctx(tag_ext_fct,false);
    171173
    172174  return rc;
     
    177179  int rc;
    178180
     181  set_nested_ctx(tag_ext_fct,true);
    179182  zos_forward(tag_ext_fct, 2, 2, 1, edf->dp_x, edf->dp_y);
    180183  rc = fos_reverse(tag_ext_fct, 2, 2, u, z);
     184  set_nested_ctx(tag_ext_fct,false);
    181185
    182186  return rc;
  • trunk/ADOL-C/include/adolc/Makefile.am

    r600 r608  
    1919                       adtl.h adoublecuda.h param.h externfcts2.h
    2020
    21 SUBDIRS = internal drivers tapedoc
     21SUBDIRS = internal drivers tapedoc lie
    2222
    2323if SPARSE
  • trunk/ADOL-C/include/adolc/adalloc.h

    r537 r608  
    2424/*--------------------------------------------------------------------------*/
    2525/*                                              MEMORY MANAGEMENT UTILITIES */
     26ADOLC_DLL_EXPORT char* populate_dpp(double ***const pointer, char *const memory,
     27                                    int n, int m);
     28ADOLC_DLL_EXPORT char* populate_dppp(double ****const pointer, char *const memory,
     29                                     int n, int m, int p);
     30ADOLC_DLL_EXPORT char* populate_dppp_nodata(double ****const pointer, char *const memory,
     31                                            int n, int m);
    2632ADOLC_DLL_EXPORT double    *myalloc1(size_t);
    2733ADOLC_DLL_EXPORT double   **myalloc2(size_t, size_t);
  • trunk/ADOL-C/include/adolc/adouble.h

    r605 r608  
    301301    inline locint loc(void) const;
    302302
    303 #if defined(ADIC_ADOLC_TYPE)
     303#if defined(ADOLC_DEFAULT_CONTIG_LOC)
    304304    void *operator new[](size_t sz) {
    305305        void *p = ::new char[sz];
  • trunk/ADOL-C/include/adolc/taping.h

    r603 r608  
    107107ADOLC_DLL_EXPORT void skip_tracefile_cleanup(short tnum);
    108108
     109ADOLC_DLL_EXPORT void set_nested_ctx(short tag, char nested);
     110
    109111#include <vector>
    110112ADOLC_DLL_EXPORT void cachedTraceTags(std::vector<short>& result);
  • trunk/ADOL-C/src/Makefile.am

    r600 r608  
    1717
    1818if SPARSE
    19 SUBDIRS              = drivers sparse tapedoc
     19SUBDIRS              = drivers sparse tapedoc lie
    2020else
    21 SUBDIRS              = drivers tapedoc
     21SUBDIRS              = drivers tapedoc lie
    2222endif
    2323
  • trunk/ADOL-C/src/adalloc.c

    r566 r608  
    4242/****************************************************************************/
    4343/*                                              MEMORY MANAGEMENT UTILITIES */
    44 
     44/*--------------------------------------------------------------------------*/
     45char* populate_dpp(double ***const pointer, char *const memory,
     46                   int n, int m) {
     47    char* tmp;
     48    double **tmp1; double *tmp2;
     49    int i,j;
     50    tmp = (char*) memory;
     51    tmp1 = (double**)memory;
     52    *pointer = tmp1;
     53    tmp = (char*)(tmp1+n);
     54    tmp2 = (double*)tmp;
     55    for (i=0;i<n;i++) {
     56        (*pointer)[i] = tmp2;
     57        tmp2 += m;
     58    }
     59    tmp = (char*)tmp2;
     60    return tmp;
     61}
     62/*--------------------------------------------------------------------------*/
     63char* populate_dppp(double ****const pointer, char *const memory,
     64                           int n, int m, int p) {
     65    char* tmp;
     66    double ***tmp1; double **tmp2; double *tmp3;
     67    int i,j;
     68    tmp = (char*) memory;
     69    tmp1 = (double***) memory;
     70    *pointer = tmp1;
     71    tmp = (char*)(tmp1+n);
     72    tmp2 = (double**)tmp;
     73    for(i=0; i<n; i++) {
     74        (*pointer)[i] = tmp2;
     75        tmp2 += m;
     76    }
     77    tmp = (char*)tmp2;
     78    tmp3 = (double*)tmp;
     79    for(i=0;i<n;i++)
     80        for(j=0;j<m;j++) {
     81            (*pointer)[i][j] = tmp3;
     82            tmp3 += p;
     83        }
     84    tmp = (char*)tmp3;
     85    return tmp;
     86}
     87/*--------------------------------------------------------------------------*/
     88char* populate_dppp_nodata(double ****const pointer, char *const memory,
     89                           int n, int m) {
     90
     91    char* tmp;
     92    double ***tmp1; double **tmp2;
     93    int i,j;
     94    tmp = (char*) memory;
     95    tmp1 = (double***) memory;
     96    *pointer = tmp1;
     97    tmp = (char*)(tmp1+n);
     98    tmp2 = (double**)tmp;
     99    for(i=0; i<n; i++) {
     100        (*pointer)[i] = tmp2;
     101        tmp2 += m;
     102    }
     103    tmp = (char*)tmp2;
     104    return tmp;
     105}
    45106/*--------------------------------------------------------------------------*/
    46107double* myalloc1(size_t m) {
     
    62123    if (m>0 && n>0)  {
    63124      int i;
    64       double *Adum = (double*)ADOLC_MALLOC(m*n,sizeof(double));
    65       A = (double**)malloc(m*sizeof(double*));
     125      char *Adum = (char*)ADOLC_MALLOC(m*n*sizeof(double)+m*sizeof(double*),1);
    66126      if (Adum == NULL) {
    67127        fprintf(DIAG_OUT,"ADOL-C error: myalloc2 cannot allocate %zd bytes\n",
    68                 (size_t)(m*n*sizeof(double)));
     128                (size_t)(m*n*sizeof(double)+m*sizeof(double*)));
    69129        adolc_exit(-1,"",__func__,__FILE__,__LINE__);
    70130      }
    71       if (A == NULL) {
    72         fprintf(DIAG_OUT,"ADOL-C error: myalloc2 cannot allocate %zd bytes\n",
    73                 (size_t)(m*sizeof(double*)));
    74         adolc_exit(-1,"",__func__,__FILE__,__LINE__);
    75       }
    76       for (i=0; i<m; i++) {
    77         A[i] = Adum;
    78         Adum += n;
    79       }
     131      populate_dpp(&A,Adum,m,n);
    80132    }
    81133    return A;
     
    87139    if (m>0 && n>0 && p > 0)  {
    88140      int i,j;
    89       double *Adum = (double*) ADOLC_MALLOC(m*n*p,sizeof(double));
    90       double **Apt = (double**)malloc(m*n*sizeof(double*));
    91       A = (double***)malloc(m*sizeof(double**));
     141      char *Adum = (char*) ADOLC_MALLOC(m*n*p*sizeof(double)+m*n*sizeof(double*)+m*sizeof(double**),1);
    92142      if (Adum == NULL) {
    93143        fprintf(DIAG_OUT,"ADOL-C error: myalloc3 cannot allocate %zd bytes\n",
    94                 (size_t)(m*n*p*sizeof(double)));
     144                (size_t)(m*n*p*sizeof(double)+m*n*sizeof(double*)+m*sizeof(double**)));
    95145        adolc_exit(-1,"",__func__,__FILE__,__LINE__);
    96146      }
    97       if (Apt == NULL) {
    98         fprintf(DIAG_OUT,"ADOL-C error: myalloc3 cannot allocate %zd bytes\n",
    99                 (size_t)(m*n*sizeof(double*)));
    100         adolc_exit(-1,"",__func__,__FILE__,__LINE__);
    101       }
    102       if (A == NULL) {
    103         fprintf(DIAG_OUT,"ADOL-C error: myalloc3 cannot allocate %zd bytes\n",
    104                 (size_t)(m*sizeof(double**)));
    105         adolc_exit(-1,"",__func__,__FILE__,__LINE__);
    106       }
    107       for (i=0; i<m; i++) {
    108         A[i] = Apt;
    109         for (j=0; j<n; j++) {
    110           *Apt++ =  Adum;
    111           Adum += p;
    112         }
    113       }
     147      populate_dppp(&A,Adum,m,n,p);
    114148    }
    115149    return A;
     
    123157/*--------------------------------------------------------------------------*/
    124158void myfree2(double  **A) {
    125     if (A && *A) free((char*)*A);
    126159    if (A) free((char*) A);
    127160}
     
    129162/*--------------------------------------------------------------------------*/
    130163void myfree3(double ***A) {
    131     if (A && *A && **A) free((char*)**A);
    132     if (A && *A) free((char*)*A);
    133164    if (A) free((char*) A);
    134165}
  • trunk/ADOL-C/src/adouble.cpp

    r605 r608  
    153153    location = next_loc();
    154154    isInit = true;
    155     ADOLC_OPENMP_THREAD_NUMBER;
    156     ADOLC_OPENMP_GET_THREAD_NUMBER;
    157 
    158     if (ADOLC_CURRENT_TAPE_INFOS.traceFlag) {
    159         put_op(assign_a);
    160         ADOLC_PUT_LOCINT(a.loc());  // = arg
    161         ADOLC_PUT_LOCINT(location); // = res
    162 
    163         ++ADOLC_CURRENT_TAPE_INFOS.numTays_Tape;
    164         if (ADOLC_CURRENT_TAPE_INFOS.keepTaylors)
    165             ADOLC_WRITE_SCAYLOR(ADOLC_GLOBAL_TAPE_VARS.store[location]);
    166     }
    167 
    168     ADOLC_GLOBAL_TAPE_VARS.store[location] = ADOLC_GLOBAL_TAPE_VARS.store[a.loc()];
     155    locint a_loc = a.loc();
     156    ADOLC_OPENMP_THREAD_NUMBER;
     157    ADOLC_OPENMP_GET_THREAD_NUMBER;
     158    int upd = 0;
     159    /* 981020 olvo  skip upd_resloc(..) if no tracing performed */
     160    if (ADOLC_CURRENT_TAPE_INFOS.traceFlag)
     161        upd = upd_resloc(a_loc,loc());
     162    if (upd) { /* olvo 980708 new n2l & 980921 changed interface */
     163        revreal tempVal = ADOLC_GLOBAL_TAPE_VARS.store[a_loc];
     164        if (ADOLC_CURRENT_TAPE_INFOS.keepTaylors)
     165            ADOLC_OVERWRITE_SCAYLOR(ADOLC_GLOBAL_TAPE_VARS.store[loc()],&ADOLC_GLOBAL_TAPE_VARS.store[a_loc]);
     166        ADOLC_GLOBAL_TAPE_VARS.store[loc()] = tempVal;
     167    } else {
     168        if (ADOLC_CURRENT_TAPE_INFOS.traceFlag) { // old: write_assign_a(loc(),a_loc);
     169            put_op(assign_a);
     170            ADOLC_PUT_LOCINT(a_loc);    // = arg
     171            ADOLC_PUT_LOCINT(loc()); // = res
     172
     173            ++ADOLC_CURRENT_TAPE_INFOS.numTays_Tape;
     174            if (ADOLC_CURRENT_TAPE_INFOS.keepTaylors)
     175                ADOLC_WRITE_SCAYLOR(ADOLC_GLOBAL_TAPE_VARS.store[loc()]);
     176        }
     177        ADOLC_GLOBAL_TAPE_VARS.store[loc()] = ADOLC_GLOBAL_TAPE_VARS.store[a_loc];
     178    }
    169179}
    170180
  • trunk/ADOL-C/src/externfcts.cpp

    r605 r608  
    1717#include "externfcts_p.h"
    1818#include <adolc/adouble.h>
     19#include <adolc/adalloc.h>
    1920#include "oplate.h"
    2021#include "buffer_temp.h"
     
    9798}
    9899
    99 char* populate_dpp(double ***const pointer, char *const memory,
    100                    int n, int m) {
    101     char* tmp;
    102     double **tmp1; double *tmp2;
    103     int i,j;
    104     tmp = (char*) memory;
    105     tmp1 = (double**)memory;
    106     *pointer = tmp1;
    107     tmp = (char*)(tmp1+n);
    108     tmp2 = (double*)tmp;
    109     for (i=0;i<n;i++) {
    110         (*pointer)[i] = tmp2;
    111         tmp2 += m;
    112     }
    113     tmp = (char*)tmp2;
    114     return tmp;
    115 }
    116100/*
    117101 * The externfcts.h had a comment previously that said the following:
     
    135119       * so leave it out.
    136120       */
    137       size_t totalmem = (3*n + 3*m + n*n + 2*n*m + m*m)*sizeof(double)
     121      size_t totalmem = (3*n + 3*m /*+ n*n + 2*n*m + m*m*/)*sizeof(double)
    138122                         + (3*m+n)*sizeof(double*);
    139123      char *tmp;
     
    148132      edfct->dp_Z = edfct->dp_U+m;
    149133      tmp = (char*)(edfct->dp_Z+n);
     134      edfct->dpp_X = (double**)tmp;
     135      edfct->dpp_Y = edfct->dpp_X + n;
     136      edfct->dpp_U = edfct->dpp_Y + m;
     137      edfct->dpp_Z = edfct->dpp_U + m;
     138      /*
    150139      tmp = populate_dpp(&edfct->dpp_X, tmp, n,n);
    151140      tmp = populate_dpp(&edfct->dpp_Y, tmp, m,n);
    152141      tmp = populate_dpp(&edfct->dpp_U, tmp, m,m);
    153142      tmp = populate_dpp(&edfct->dpp_Z, tmp, m,n);
     143      */
    154144  }
    155145
  • trunk/ADOL-C/src/externfcts2.cpp

    r605 r608  
    1717#include "externfcts_p.h"
    1818#include <adolc/adouble.h>
     19#include <adolc/adalloc.h>
    1920#include "oplate.h"
    2021#include "buffer_temp.h"
     
    2728#define ADOLC_BUFFER_TYPE \
    2829   Buffer< ext_diff_fct_v2, EDFCTS_BLOCK_SIZE >
     30
    2931static ADOLC_BUFFER_TYPE buffer(edf_zero);
    3032
     
    6668}
    6769
    68 static char* populate_dppp(double ****const pointer, char *const memory,
    69                            int n, int m, int p) {
    70     char* tmp;
    71     double ***tmp1; double **tmp2; double *tmp3;
    72     int i,j;
    73     tmp = (char*) memory;
    74     tmp1 = (double***) memory;
    75     *pointer = tmp1;
    76     tmp = (char*)(tmp1+n);
    77     tmp2 = (double**)tmp;
    78     for(i=0; i<n; i++) {
    79         (*pointer)[i] = tmp2;
    80         tmp2 += m;
    81     }
    82     tmp = (char*)tmp2;
    83     tmp3 = (double*)tmp;
    84     for(i=0;i<n;i++)
    85         for(j=0;j<m;j++) {
    86             (*pointer)[i][j] = tmp3;
    87             tmp3 += p;
    88         }
    89     tmp = (char*)tmp3;
    90     return tmp;
    91 }
    92 
    9370static void update_ext_fct_memory(ext_diff_fct_v2 *edfct, int nin, int nout, int *insz, int *outsz) {
    9471    int m_isz=0, m_osz=0;
     
    10380        size_t totalmem =
    10481            (3*nin*m_isz + 3*nout*m_osz
    105              + nin*m_isz*p + nout*m_osz*p
    106              + q*nout*m_osz + q*nin*m_isz)*sizeof(double)
     82             // + nin*m_isz*p + nout*m_osz*p
     83             // + q*nout*m_osz + q*nin*m_isz
     84            )*sizeof(double)
    10785            + (3*nin + 3*nout + nin*m_isz + nout*m_osz
    10886               + q*nout + q*nin)*sizeof(double*)
     
    11896        tmp = populate_dpp(&edfct->up,tmp,nout,m_osz);
    11997        tmp = populate_dpp(&edfct->zp,tmp,nin,m_isz);
    120         tmp = populate_dppp(&edfct->Xp,tmp,nin,m_isz,p);
    121         tmp = populate_dppp(&edfct->Yp,tmp,nout,m_osz,p);
    122         tmp = populate_dppp(&edfct->Up,tmp,q,nout,m_osz);
    123         tmp = populate_dppp(&edfct->Zp,tmp,q,nin,m_isz);
     98        tmp = populate_dppp_nodata(&edfct->Xp,tmp,nin,m_isz);
     99        tmp = populate_dppp_nodata(&edfct->Yp,tmp,nout,m_osz);
     100        tmp = populate_dppp_nodata(&edfct->Up,tmp,nout,m_osz);
     101        tmp = populate_dppp_nodata(&edfct->Zp,tmp,nin,m_isz);
    124102    }
    125103    edfct->max_nin=(edfct->max_nin<nin)?nin:edfct->max_nin;
  • trunk/ADOL-C/src/externfcts_p.h

    r600 r608  
    2929ext_diff_fct *get_ext_diff_fct(int index);
    3030ext_diff_fct_v2 *get_ext_diff_fct_v2(int index);
    31 char* populate_dpp(double ***const pointer, char *const memory,
    32                    int n, int m);
    33 
    3431
    3532END_C_DECLS
  • trunk/ADOL-C/src/fixpoint.cpp

    r605 r608  
    205205    ext_diff_fct *edf_iteration = reg_ext_fct(&iteration);
    206206    data->edf_index = edf_iteration->index;
    207     edf_iteration->dp_x     = new double[dim_x+dim_u];
    208     edf_iteration->dp_y     = new double[dim_x];
    209     edf_iteration->dp_X     = new double[dim_x+dim_u];
    210     edf_iteration->dp_Y     = new double[dim_x];
    211     edf_iteration->dp_U     = new double[dim_x];
    212     edf_iteration->dp_Z     = new double[dim_x+dim_u];
    213207    edf_iteration->zos_forward = &fp_zos_forward;
    214208    edf_iteration->fos_forward = &fp_fos_forward;
  • trunk/ADOL-C/src/fo_rev.c

    r605 r608  
    7272#define RESULTS(l,indexi)  results[indexi]
    7373#define LAGRANGE(l,indexd) lagrange[indexd]
     74#define RESULTSTRANS(l,indexi)  results[indexi]
     75#define LAGRANGETRANS(l,indexd) lagrange[indexd]
    7476
    7577/*--------------------------------------------------------------------------*/
     
    7981#define _ADOLC_VECTOR_
    8082
     83#define RESULTS(l,indexi) results[l][indexd]
     84#define LAGRANGE(l,indexd) lagrange[l][indexd]
     85#define RESULTSTRANS(l,indexi) results[indexd][l]
     86#define LAGRANGETRANS(l,indexd) lagrange[indexd][l]
     87
     88#else
     89#if defined(_INT_REV_)
     90#if defined(_TIGHT_)
     91#define GENERATED_FILENAME "int_reverse_t"
     92#endif
     93#if defined(_NTIGHT_)
     94#define GENERATED_FILENAME "int_reverse_s"
     95#endif
    8196#define RESULTS(l,indexi)  results[l][indexi]
    8297#define LAGRANGE(l,indexd) lagrange[l][indexd]
    83 
    84 #else
    85 #if defined(_INT_REV_)
    86 #if defined(_TIGHT_)
    87 #define GENERATED_FILENAME "int_reverse_t"
    88 #endif
    89 #if defined(_NTIGHT_)
    90 #define GENERATED_FILENAME "int_reverse_s"
    91 #endif
    92 #define RESULTS(l,indexi)  results[l][indexi]
    93 #define LAGRANGE(l,indexd) lagrange[l][indexd]
     98#define RESULTSTRANS(l,indexi) results[indexd][l]
     99#define LAGRANGETRANS(l,indexd) lagrange[indexd][l]
    94100#else
    95101#error Error ! Define [_FOS_ | _FOV_ | _INT_REV_SAFE_ | _INT_REV_TIGHT_ ]
     
    469475# define ADJOINT_BUFFER_ARG_L rp_A[arg]
    470476# define ADJOINT_BUFFER_RES_L rp_A[res]
     477# define ADJOINT_BUFFER_ARG rp_A[arg]
     478# define ADJOINT_BUFFER_RES rp_A[res]
    471479# define ADOLC_EXT_FCT_U_L_LOOP edfct->dp_U[loop]
    472480# define ADOLC_EXT_FCT_Z_L_LOOP edfct->dp_Z[loop]
    473 # define ADOLC_EXT_FCT_V2_U_L_LOOP edfct2->up[oloop][loop]
    474 # define ADOLC_EXT_FCT_V2_Z_L_LOOP edfct2->zp[oloop][loop]
     481# define ADOLC_EXT_FCT_V2_U_LOOP edfct2->up[oloop][loop]
     482# define ADOLC_EXT_FCT_V2_Z_LOOP edfct2->zp[oloop][loop]
     483# define ADOLC_EXT_FCT_COPY_ADJOINTS(dest,src) dest=src
     484# define ADOLC_EXT_FCT_COPY_ADJOINTS_BACK(dest,src) src=dest
    475485
    476486    /*--------------------------------------------------------------------------*/
     
    501511# define ADJOINT_BUFFER_ARG_L rpp_A[arg][l]
    502512# define ADJOINT_BUFFER_RES_L rpp_A[res][l]
     513# define ADJOINT_BUFFER_ARG rpp_A[arg]
     514# define ADJOINT_BUFFER_RES rpp_A[res]
    503515# define ADOLC_EXT_FCT_U_L_LOOP edfct->dpp_U[l][loop]
    504516# define ADOLC_EXT_FCT_Z_L_LOOP edfct->dpp_Z[l][loop]
    505 # define ADOLC_EXT_FCT_V2_U_L_LOOP edfct2->Up[l][oloop][loop]
    506 # define ADOLC_EXT_FCT_V2_Z_L_LOOP edfct2->Zp[l][oloop][loop]
     517# define ADOLC_EXT_FCT_V2_U_LOOP edfct2->Up[oloop][loop]
     518# define ADOLC_EXT_FCT_V2_Z_LOOP edfct2->Zp[oloop][loop]
     519# define ADOLC_EXT_FCT_COPY_ADJOINTS(dest,src) dest=src
     520# define ADOLC_EXT_FCT_COPY_ADJOINTS_BACK(dest,src)
    507521#else
    508522#if defined _INT_REV_
     
    709723                ASSIGN_A( Ares, ADJOINT_BUFFER[res])
    710724
     725                if (ADOLC_CURRENT_TAPE_INFOS.in_nested_ctx) {
     726                FOR_0_LE_l_LT_p
     727                    RESULTSTRANS(l,indexi) = ARES_INC;
     728                } else {
    711729                FOR_0_LE_l_LT_p
    712730                    RESULTS(l,indexi) = ARES_INC;
    713 
     731                }
    714732#if !defined(_NTIGHT_)
    715733                ADOLC_GET_TAYLOR(res);
     
    731749                    ARES = 0.0;
    732750#else
    733                 FOR_0_LE_l_LT_p
    734                 ARES_INC = LAGRANGE(l,indexd);
     751                if (ADOLC_CURRENT_TAPE_INFOS.in_nested_ctx) {
     752                FOR_0_LE_l_LT_p
     753                    ARES_INC = LAGRANGETRANS(l,indexd);
     754                } else {
     755                FOR_0_LE_l_LT_p
     756                    ARES_INC = LAGRANGE(l,indexd);
     757                }
    735758#endif
    736759                indexd--;
     
    26662689                arg = ADOLC_CURRENT_TAPE_INFOS.lowestYLoc_rev;
    26672690                for (loop = 0; loop < m; ++loop) {
    2668                     FOR_0_LE_l_LT_p {
    2669                         ADOLC_EXT_FCT_U_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2670                     }
     2691                    ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_U[loop],ADJOINT_BUFFER_ARG);
    26712692                    ++arg;
    26722693                }
     
    26742695                arg = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_rev;
    26752696                for (loop = 0; loop < n; ++loop) {
    2676                     FOR_0_LE_l_LT_p {
    2677                         ADOLC_EXT_FCT_Z_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2678                     }
     2697                    ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_Z[loop],ADJOINT_BUFFER_ARG);
    26792698                    ++arg;
    26802699                }
     
    26992718                res = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_rev;
    27002719                for (loop = 0; loop < n; ++loop) {
    2701                     FOR_0_LE_l_LT_p {
    2702                         ADJOINT_BUFFER_RES_L = ADOLC_EXT_FCT_Z_L_LOOP;
    2703                     }
     2720                    ADOLC_EXT_FCT_COPY_ADJOINTS_BACK(ADOLC_EXT_FCT_Z[loop],ADJOINT_BUFFER_RES);
    27042721                    ++res;
    27052722                }
     
    27482765                arg = ADOLC_CURRENT_TAPE_INFOS.lowestYLoc_rev;
    27492766                for (loop = 0; loop < m; ++loop) {
    2750                     FOR_0_LE_l_LT_p {
    2751                         ADOLC_EXT_FCT_U_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2752                     }
     2767                    ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_U[loop],ADJOINT_BUFFER_ARG);
    27532768                    ++arg;
    27542769                }
     
    27562771                arg = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_rev;
    27572772                for (loop = 0; loop < n; ++loop) {
    2758                     FOR_0_LE_l_LT_p {
    2759                         ADOLC_EXT_FCT_Z_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2760                     }
     2773                    ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_Z[loop],ADJOINT_BUFFER_ARG);
    27612774                    ++arg;
    27622775                }
     
    27812794                res = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_rev;
    27822795                for (loop = 0; loop < n; ++loop) {
    2783                     FOR_0_LE_l_LT_p {
    2784                         ADJOINT_BUFFER_RES_L = ADOLC_EXT_FCT_Z_L_LOOP;
    2785                     }
     2796                    ADOLC_EXT_FCT_COPY_ADJOINTS_BACK(ADOLC_EXT_FCT_Z[loop],ADJOINT_BUFFER_RES);
    27862797                    ++res;
    27872798                }
     
    28412852                    arg = ADOLC_CURRENT_TAPE_INFOS.lowestYLoc_ext_v2[oloop];
    28422853                    for (loop = 0; loop < outsz[oloop]; ++loop) {
    2843                         FOR_0_LE_l_LT_p {
    2844                             ADOLC_EXT_FCT_V2_U_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2845                         }
     2854                        ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_V2_U_LOOP,ADJOINT_BUFFER_ARG);
    28462855                        edfct2->y[oloop][loop]=TARG;
    28472856                        ++arg;
     
    28512860                    arg = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_ext_v2[oloop];
    28522861                    for (loop =0; loop < insz[oloop]; ++loop) {
    2853                         FOR_0_LE_l_LT_p {
    2854                             ADOLC_EXT_FCT_V2_Z_L_LOOP = ADJOINT_BUFFER_ARG_L;
    2855                         }
     2862                        ADOLC_EXT_FCT_COPY_ADJOINTS(ADOLC_EXT_FCT_V2_Z_LOOP, ADJOINT_BUFFER_ARG);
    28562863                        edfct2->x[oloop][loop]=TARG;
    28572864                        ++arg;
     
    28722879                    res = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_ext_v2[oloop];
    28732880                    for(loop = 0; loop<insz[oloop]; ++loop) {
    2874                         FOR_0_LE_l_LT_p {
    2875                             ADJOINT_BUFFER_RES_L = ADOLC_EXT_FCT_V2_Z_L_LOOP;
    2876                         }
     2881                        ADOLC_EXT_FCT_COPY_ADJOINTS_BACK(ADOLC_EXT_FCT_V2_Z_LOOP,ADJOINT_BUFFER_RES);
    28772882                        ++res;
    28782883                    }
  • trunk/ADOL-C/src/tape_handling.cpp

    r603 r608  
    568568}
    569569
     570void set_nested_ctx(short tag, char nested) {
     571    TapeInfos* tiInfos = getTapeInfos(tag);
     572    tiInfos->in_nested_ctx = nested;
     573}
     574
    570575void cachedTraceTags(std::vector<short>& result) {
    571576    vector<TapeInfos *>::const_iterator tiIter;
  • trunk/ADOL-C/src/taping_p.h

    r605 r608  
    294294    /* extern diff. fcts */
    295295    locint ext_diff_fct_index;    /* set by forward and reverse (from tape) */
     296    char in_nested_ctx;
    296297
    297298    size_t numSwitches;
  • trunk/ADOL-C/src/uni5_for.c

    r605 r608  
    4040
    4141#include <math.h>
     42#include <string.h>
    4243
    4344#if defined(ADOLC_DEBUG) || defined(_ZOS_)
     
    10311032#   define ADOLC_EXT_LOOP
    10321033#   define ADOLC_EXT_SUBSCRIPT
     1034#   define ADOLC_EXT_SUBSCRIPT_START
     1035#   define ADOLC_EXT_COPY_TAYLORS(dest,src)
    10331036#endif
    10341037    /* FOS_FORWARD */
     
    10491052#   define ADOLC_EXT_LOOP
    10501053#   define ADOLC_EXT_SUBSCRIPT
     1054#   define ADOLC_EXT_COPY_TAYLORS(dest,src) dest=src
     1055#   define ADOLC_EXT_COPY_TAYLORS_BACK(dest,src) src=dest
    10511056#endif
    10521057    /* FOV_FORWARD */
     
    10671072#   define ADOLC_EXT_LOOP for (loop2 = 0; loop2 < p; ++loop2)
    10681073#   define ADOLC_EXT_SUBSCRIPT [loop2]
     1074#   define ADOLC_EXT_COPY_TAYLORS(dest,src) dest=src
     1075#   define ADOLC_EXT_COPY_TAYLORS_BACK(dest,src)
    10691076#endif
    10701077
     
    58475854                    edfct->dp_x[loop]=dp_T0[arg];
    58485855#if !defined(_ZOS_)
    5849                     ADOLC_EXT_LOOP
    5850                         ADOLC_EXT_POINTER_X[loop]ADOLC_EXT_SUBSCRIPT =
    5851                         TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
     5856                    ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_POINTER_X[loop],TAYLOR_BUFFER[arg]);
    58525857#endif
    58535858                    ++arg;
     
    58605865                    edfct->dp_y[loop]=dp_T0[arg];
    58615866#if !defined(_ZOS_)
    5862                     ADOLC_EXT_LOOP
    5863                         ADOLC_EXT_POINTER_Y[loop]ADOLC_EXT_SUBSCRIPT =
    5864                         TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
     5867                    ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_POINTER_Y[loop],TAYLOR_BUFFER[arg]);
    58655868#endif
    58665869                    ++arg;
     
    58745877                    dp_T0[res]=edfct->dp_x[loop];
    58755878#if !defined(_ZOS_)
    5876                     ADOLC_EXT_LOOP
    5877                         TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    5878                         ADOLC_EXT_POINTER_X[loop]ADOLC_EXT_SUBSCRIPT;
     5879                    ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_POINTER_X[loop],TAYLOR_BUFFER[res]);
    58795880#endif
    58805881                    ++res;
     
    58845885                    dp_T0[res]=edfct->dp_y[loop];
    58855886#if !defined(_ZOS_)
    5886                     ADOLC_EXT_LOOP
    5887                         TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    5888                         ADOLC_EXT_POINTER_Y[loop]ADOLC_EXT_SUBSCRIPT;
     5887                    ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_POINTER_Y[loop],TAYLOR_BUFFER[res]);
    58895888#endif
    58905889                    ++res;
     
    59285927                    edfct->dp_x[loop]=dp_T0[arg];
    59295928#if !defined(_ZOS_)
    5930                     ADOLC_EXT_LOOP
    5931                         ADOLC_EXT_POINTER_X[loop]ADOLC_EXT_SUBSCRIPT =
    5932                         TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
     5929                    ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_POINTER_X[loop],TAYLOR_BUFFER[arg]);
    59335930#endif
    59345931                    ++arg;
     
    59415938                    edfct->dp_y[loop]=dp_T0[arg];
    59425939#if !defined(_ZOS_)
    5943                     ADOLC_EXT_LOOP
    5944                         ADOLC_EXT_POINTER_Y[loop]ADOLC_EXT_SUBSCRIPT =
    5945                         TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
     5940                    ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_POINTER_Y[loop],TAYLOR_BUFFER[arg]);
    59465941#endif
    59475942                    ++arg;
     
    59555950                    dp_T0[res]=edfct->dp_x[loop];
    59565951#if !defined(_ZOS_)
    5957                     ADOLC_EXT_LOOP
    5958                         TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    5959                         ADOLC_EXT_POINTER_X[loop]ADOLC_EXT_SUBSCRIPT;
     5952                    ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_POINTER_X[loop],TAYLOR_BUFFER[res]);
    59605953#endif
    59615954                    ++res;
     
    59655958                    dp_T0[res]=edfct->dp_y[loop];
    59665959#if !defined(_ZOS_)
    5967                     ADOLC_EXT_LOOP
    5968                         TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    5969                         ADOLC_EXT_POINTER_Y[loop]ADOLC_EXT_SUBSCRIPT;
     5960                    ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_POINTER_Y[loop],TAYLOR_BUFFER[res]);
    59705961#endif
    59715962                    ++res;
     
    60136004                for(oloop=0;oloop<nin;++oloop) {
    60146005                    arg = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_ext_v2[oloop];
     6006                    memcpy(&edfct2->x[oloop][0],&dp_T0[arg],insz[oloop]*sizeof(double));
    60156007                    for(loop=0;loop<insz[oloop];++loop) {
    60166008                        if(edfct2->dp_x_changes) {
    60176009                            IF_KEEP_WRITE_TAYLOR(arg,keep,k,p);
    60186010                        }
    6019                         edfct2->x[oloop][loop] = dp_T0[arg];
    60206011#if !defined(_ZOS_)
    6021                         ADOLC_EXT_LOOP
    6022                             ADOLC_EXT_V2_POINTER_X[oloop][loop]ADOLC_EXT_SUBSCRIPT =
    6023                             TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
     6012                        ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_V2_POINTER_X[oloop][loop],TAYLOR_BUFFER[arg]);
    60246013#endif
    60256014                        ++arg;
     
    60286017                for(oloop=0;oloop<nout;++oloop) {
    60296018                    arg=ADOLC_CURRENT_TAPE_INFOS.lowestYLoc_ext_v2[oloop];
     6019                    memcpy(&edfct2->y[oloop][0],&dp_T0[arg],outsz[oloop]*sizeof(double));
    60306020                    for(loop=0;loop<outsz[oloop];++loop) {
    60316021                        if (edfct2->dp_y_priorRequired) {
    60326022                            IF_KEEP_WRITE_TAYLOR(arg,keep,k,p);
    60336023                        }
    6034                             edfct2->y[oloop][loop] = dp_T0[arg];
    60356024#if !defined(_ZOS_)
    6036                             ADOLC_EXT_LOOP
    6037                                 ADOLC_EXT_V2_POINTER_Y[oloop][loop]ADOLC_EXT_SUBSCRIPT =
    6038                                 TAYLOR_BUFFER[arg]ADOLC_EXT_SUBSCRIPT;
    6039 #endif
    6040                             ++arg;
     6025                       ADOLC_EXT_COPY_TAYLORS(ADOLC_EXT_V2_POINTER_Y[oloop][loop],TAYLOR_BUFFER[arg]);
     6026#endif
     6027
     6028                        ++arg;
    60416029                    }
    60426030                }
     
    60466034                for(oloop=0;oloop<nin;++oloop) {
    60476035                    res = ADOLC_CURRENT_TAPE_INFOS.lowestXLoc_ext_v2[oloop];
     6036                    memcpy(&dp_T0[res],&edfct2->x[oloop][0],insz[oloop]*sizeof(double));
     6037#if !defined(_ZOS_)
    60486038                    for(loop=0;loop<insz[oloop];++loop) {
    6049                         dp_T0[res] = edfct2->x[oloop][loop];
    6050 #if !defined(_ZOS_)
    6051                         ADOLC_EXT_LOOP
    6052                             TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    6053                             ADOLC_EXT_V2_POINTER_X[oloop][loop]ADOLC_EXT_SUBSCRIPT;
    6054 #endif
     6039                        ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_V2_POINTER_X[oloop][loop],TAYLOR_BUFFER[res]);
    60556040                        ++res;
    60566041                    }
     6042#endif
    60576043                }
    60586044
    60596045                for(oloop=0;oloop<nout;++oloop) {
    60606046                    res = ADOLC_CURRENT_TAPE_INFOS.lowestYLoc_ext_v2[oloop];
     6047                    memcpy(&dp_T0[res],&edfct2->y[oloop][0],outsz[oloop]*sizeof(double));
     6048#if !defined(_ZOS_)
    60616049                    for(loop=0;loop<outsz[oloop];++loop) {
    6062                         dp_T0[res] = edfct2->y[oloop][loop];
    6063 #if !defined(_ZOS_)
    6064                         ADOLC_EXT_LOOP
    6065                             TAYLOR_BUFFER[res]ADOLC_EXT_SUBSCRIPT =
    6066                             ADOLC_EXT_V2_POINTER_Y[oloop][loop]ADOLC_EXT_SUBSCRIPT;
    6067 #endif
     6050                        ADOLC_EXT_COPY_TAYLORS_BACK(ADOLC_EXT_V2_POINTER_Y[oloop][loop],TAYLOR_BUFFER[res]);
    60686051                        ++res;
    60696052                    }
     6053#endif
    60706054                }
    60716055
  • trunk/README

    r127 r608  
    99  - adapted differentiation of fixed point iterations
    1010  - parallel differentiation of OpenMP-parallel loops
     11  - Lie derivatives of scalar, vector and covector fields
    1112   
    1213and many bug fixes.
  • trunk/configure.ac

    r605 r608  
    2323AC_CONFIG_HEADERS([ADOL-C/src/config.h])
    2424AC_PREFIX_DEFAULT(${HOME}/adolc_base)
    25 AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign])
     25AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign subdir-objects])
    2626AM_MAINTAINER_MODE([disable])
    2727AM_SILENT_RULES([yes])
     
    6262fi
    6363
     64LT_PREREQ([2.2.6])
    6465# checks for programs
    6566AC_PROG_CXX
    6667AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
    6768AC_PROG_CC
     69AC_PROG_CC_C_O
    6870AC_PROG_CC_C99
    6971AC_PROG_CPP
     
    7173AC_PROG_LN_S
    7274AC_PROG_MAKE_SET
    73 AC_LIBTOOL_WIN32_DLL
    74 AC_PROG_LIBTOOL
     75LT_INIT([disable-static win32-dll dlopen])
    7576
    7677MPI_CONF_PRE
     
    503504                ADOL-C/include/adolc/drivers/Makefile
    504505                ADOL-C/include/adolc/internal/Makefile
     506                ADOL-C/include/adolc/lie/Makefile
    505507                ADOL-C/include/adolc/sparse/Makefile
    506508                ADOL-C/include/adolc/tapedoc/Makefile
    507509                ADOL-C/src/Makefile
    508510                ADOL-C/src/drivers/Makefile
     511                ADOL-C/src/lie/Makefile
    509512                ADOL-C/src/sparse/Makefile
    510513                ADOL-C/src/tapedoc/Makefile
     
    518521                ADOL-C/examples/additional_examples/fixpoint_exam/Makefile
    519522                ADOL-C/examples/additional_examples/hessmat/Makefile
     523                ADOL-C/examples/additional_examples/lie/Makefile
    520524                ADOL-C/examples/additional_examples/lufact/Makefile
    521525                ADOL-C/examples/additional_examples/openmp_exam/Makefile
Note: See TracChangeset for help on using the changeset viewer.