source: trunk/ADOL-C/include/adolc/internal/paramfunc.h @ 708

Last change on this file since 708 was 537, checked in by kulshres, 5 years ago

Merge changes from branch 'master' of 'gitclone' into 'svn'

The following changes have been merged:

commit 86c6feecd3bec771574ca75447082e7fdd57ec9e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 14:22:15 2014 +0200

add new file to windows build too

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

commit 5c30f52c15c12a98fcfb4fc1718d5be89d4e055e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 14:17:53 2014 +0200

Since we've broken tape format and ABI let's check properly

This tape is not consistent with those created by version 2.5.1
so check for 2.5.2 which may or may not be released. The next
version would most probably be 2.6.0

Also increment current version so check doesn't fail.

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

commit 766d7547631a296c87a35acb2e7bde09a987ee4f
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 14:02:28 2014 +0200

Add a simple example using parameters

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

commit 9a218ac29568a22e556dfaf64726402e800edb09
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 14:01:19 2014 +0200

forward and reverse implementation for new opcodes

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

commit 9797dda86306918dadea276599b8773d0016e731
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 14:00:53 2014 +0200

add implementations for new operators and functions

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

commit 6e8618758d0c6ee6386516d89f67de3f88bfe51b
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:59:53 2014 +0200

add new file to build

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

commit 0b67706cd4de32c30d14e67b9b59996ccb4a5fe6
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:59:37 2014 +0200

Discard parameters from value tape in reverse mode

Since parameters are read from value tape during
read_tape_stats already, we must simply discard them
when from the back of the value tape when opening it
for reverse mode.

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

commit 388f43fc0cb8732a2a8c717ed7fbc2b03af5695e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:52:17 2014 +0200

Store and retrieve parameters from disk tapes

At the end of tracing in stop_trace we can copy the
parameters from the tracing store in GlobalTapeVars?
to the store in PersistentTapeInfos?. This way, we can
trace a different function after this one, with a
different set of parameters.

Also store these parameters contiguously at the end of
the value tape for persistence. These should be read at
the same time as the stats are read from disk tapes
when opening them, so that we can call forward and
reverse directly without any changes.

One can call set_param_vec() on any tape, if one wishes
to replace the parameters with new ones, before calling
forward. Taylor stack is invalidated if one does this,
so forward must be called before reverse.

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

commit 4de6c1d76c380c99eea898df18d4bd166d9b07d7
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:51:17 2014 +0200

create space and methods for tracing the parameters

we can use a separate StoreManager? to manage the indices
of the parameters during tracing. Do this in GlobalTapeVars?
just like for the active store.

The difference is that parameters don't get overwritten so
the management is really much simpler. This indices will all
only be freed once taping is complete.

Also add constructors and methods to tag parameters in user
code in a new file.

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

commit 2fd6d8b09d804f30a2723360d5283c53bcb4ee35
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:09:32 2014 +0200

Do not use memcpy to copy tape structures

using memcpy for copying the tape structure is wrong
for the same reason that using memset to initialize them
is wrong. So create a member function to copy which
uses the addresses of the fields directly.

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

commit 4b9964a7821e4861f5fb4880c56e346abba4155d
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:05:00 2014 +0200

clean up the initialization of tape stuctures

Firstly we need space to store parameters in
PersistentTapeInfos? since the parameters must survive
tape reuse.

Since we can use constructors and destructors, use them
also setting the structure to zero using memset is not
good. It may clobber information from C++. Do the zero
setting using the address of the fields inside the
constructor.

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

commit 427b164acf4e0e9fed7f3dc018b866c79e8b93b1
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 12:52:13 2014 +0200

remove inlined functions from cpp file

also correct the header, since advector.h is now
automatically included from adouble.h

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

commit c83072a1117a8f8af3a662b840cf24c3f23bd471
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 12:50:17 2014 +0200

Add the interface for parameter dependent functions

This introduces a new class pdouble, which represent
parameters. These are supposed to work in such a way
that they are really constants, which can be changed
from one evaluation of the function to the next, but
we do not compute derivatives with respect to these
parameters. This will speed up forward mode significantly
as it will reduce the number of real independent variables.

We also move the declarations of overloaded functions
to a separate file because these friend declarations
were repeated between badouble and adub classes, and now
new such functions with pdouble parameters are added.
In order to keep the declarations in sync we include
the extra internal headers inside each class declaration.

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

commit 833e176ba3fd373e828223b94157b1dca34f4d40
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 12:37:49 2014 +0200

ignore correct generated file after move

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

commit ba0537f87ecb8634e43d918b8284997d5d5af07e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 13:45:55 2014 +0200

Move some internal header files to a subdirectory

these headers should never be included by a user
directly. They are always included from other
user interface headers. So we move them to
the 'internal' subdirectory to indicate this.

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

commit 688b6c45faa0b7890e8b1d9d709a82b98a47f94f
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Aug 15 12:25:20 2014 +0200

The ABI seems to have been broken, change library version

The old library libadolc.so.1.1.1 seems to have conflicts
with the new library version libadolc.so.1.2.0 So increase
the major version. After this the new library will be
libadolc.so.2.1.0

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

File size: 4.1 KB
Line 
1/*----------------------------------------------------------------------------
2 ADOL-C -- Automatic Differentiation by Overloading in C++
3 File:     paramfunc.h
4 Revision: $Id$
5 Contents: operators for parameter dependent functions
6 
7 Copyright (c) Kshitij Kulshreshtha
8
9 This file is part of ADOL-C. This software is provided as open source.
10 Any use, reproduction, or distribution of the software constitutes
11 recipient's acceptance of the terms of the accompanying license file.
12
13----------------------------------------------------------------------------*/
14
15#if defined(_IN_CLASS_) && _IN_CLASS_
16#if defined(_IN_BADOUBLE_) || defined(_IN_ADUB_) || defined(_IN_PDOUBLE_)
17
18#if defined(ADOLC_ADVANCED_BRANCHING)
19    inline friend adub operator != ( const pdouble&, const badouble&);
20    friend ADOLC_DLL_EXPORT adub operator != ( const badouble&, const pdouble&);
21    inline friend adub operator == ( const pdouble&, const badouble&);
22    friend ADOLC_DLL_EXPORT adub operator == ( const badouble&, const pdouble&);
23    inline friend adub operator <= ( const pdouble&, const badouble&);
24    friend ADOLC_DLL_EXPORT adub operator <= ( const badouble&, const pdouble&);
25    inline friend adub operator >= ( const pdouble&, const badouble&);
26    friend ADOLC_DLL_EXPORT adub operator >= ( const badouble&, const pdouble&);
27    inline friend adub operator >  ( const pdouble&, const badouble&);
28    friend ADOLC_DLL_EXPORT adub operator >  ( const badouble&, const pdouble&);
29    inline friend adub operator <  ( const pdouble&, const badouble&);
30    friend ADOLC_DLL_EXPORT adub operator <  ( const badouble&, const pdouble&);
31#else
32#if defined(_IN_BADOUBLE_) || defined(_IN_PDOUBLE_)
33    inline friend int operator != ( const pdouble&, const badouble&);
34    inline friend int operator != ( const badouble&, const pdouble&);
35    inline friend int operator == ( const pdouble&, const badouble&);
36    inline friend int operator == ( const badouble&, const pdouble&);
37    inline friend int operator <= ( const pdouble&, const badouble&);
38    inline friend int operator <= ( const badouble&, const pdouble&);
39    inline friend int operator >= ( const pdouble&, const badouble&);
40    inline friend int operator >= ( const badouble&, const pdouble&);
41    inline friend int operator >  ( const pdouble&, const badouble&);
42    inline friend int operator >  ( const badouble&, const pdouble&);
43    inline friend int operator <  ( const pdouble&, const badouble&);
44    inline friend int operator <  ( const badouble&, const pdouble&);
45#endif
46#endif
47    inline friend adub operator + ( const pdouble&, const badouble&);
48    inline friend adub operator + ( const pdouble&, double);
49    inline friend adub operator + ( double, const pdouble&);
50    friend ADOLC_DLL_EXPORT adub operator + ( const badouble&, const pdouble&);
51    friend ADOLC_DLL_EXPORT adub operator - ( const pdouble&);
52    friend ADOLC_DLL_EXPORT adub operator - ( const badouble&, const pdouble&);
53    inline friend adub operator - ( const pdouble&, double );
54    inline friend adub operator - ( double, const pdouble& );
55    inline friend adub operator - ( const pdouble&, const badouble& );
56    friend ADOLC_DLL_EXPORT adub operator * ( const badouble&, const pdouble&);
57    inline friend adub operator * ( const pdouble&, const badouble& );
58    inline friend adub operator * ( const pdouble&, double );
59    inline friend adub operator * ( double, const pdouble& );
60    friend ADOLC_DLL_EXPORT adub recipr( const pdouble& );
61    inline friend adub operator / ( const badouble&, const pdouble& );
62    inline friend adub operator / ( double, const pdouble& );
63    inline friend adub operator / ( const pdouble&, double );
64    friend ADOLC_DLL_EXPORT adub operator / ( const pdouble&, const badouble& );
65    friend ADOLC_DLL_EXPORT adub    pow   ( const badouble&, const pdouble& );
66    friend ADOLC_DLL_EXPORT adouble pow   ( const pdouble&, const badouble& );
67    inline friend adub fmax ( const pdouble&, const badouble& );
68    inline friend adub fmax ( const badouble&, const pdouble& );
69    inline friend adub fmin ( const pdouble&, const badouble& );
70    inline friend adub fmin ( const badouble&, const pdouble& );
71#endif
72#endif
Note: See TracBrowser for help on using the repository browser.