source: trunk/ADOL-C/src/adouble_tl_hov.cpp @ 746

Last change on this file since 746 was 746, checked in by kulshres, 17 months ago

Merge of 'adtl-cleanup' branch from git and one memory fix

The following commits were merged:

commit c157696aa17f332488275bd423a9e45e847c4d5a
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Dec 5 15:28:33 2017 +0100

changing buffer-size when overwriting a tag might cause problems

so free the tape resources before start_trace, which will then reallocate

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

commit 8759e05af6cb1e64fd6a786ae02829f58d346173
Author: Benjamin Jurgelucks <bjurgel@…>
Date: Tue Apr 4 14:52:01 2017 +0200

Added prototyp for traceless higher order vector mode and a corresponding example.

commit e22feb7e2f68ee80f5444f1090be4b0d870d71d2
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Wed Mar 29 17:59:30 2017 +0200

Change macro VAL to PRIMAL_VALUE so it does not conflict with OpenCASCADE sources.

commit 9fd04c5f9fe1f96ddb94f4925ae11af77b6445a9
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Wed Mar 29 14:11:06 2017 +0200

Add traceless_vector_indo example.

commit 4770a666580cd1964a4261ac9d25795da9a082c0
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Fri Mar 24 17:27:39 2017 +0100

Make sparsedrivers.cpp compilable. Remove func_ad from adtl.h. Change func_ad in adtl_indo.h to be a templated class such that it can work with adoubles from adtl and adtl_indo namespace. Declare ADOLC_get_sparse_jacobian outside of any namespace.

commit 87542e4746eaea7d27ba834ff3efb73602465d5a
Author: Mladen Banovic <mladenbanovic2705@…>
Date: Thu Mar 23 15:13:43 2017 +0100

Lightweight traceless approach. Clean up current adtl namespace. Create adtl_indo namespace (files adtl_indo.h and adouble_tl_indo.cpp) that serves for sparsity patterns.

File size: 2.4 KB
Line 
1/*----------------------------------------------------------------------------
2 ADOL-C -- Automatic Differentiation by Overloading in C++
3 File:     adouble.cpp
4 Revision: $Id$
5 Contents: adouble_tl.cpp contains that definitions of procedures used to
6           define various tapeless adouble operations.
7           These operations actually have two purposes.
8           The first purpose is to actual compute the function, just as
9           the same code written for double precision (single precision -
10           complex - interval) arithmetic would.  The second purpose is
11           to compute directional derivatives in forward mode of
12           automatic differentiation.
13
14 Copyright (c) Andrea Walther, Andreas Griewank, Andreas Kowarz,
15               Hristo Mitev, Sebastian Schlenkrich, Jean Utke, Olaf Vogel,
16               Benjamin Letschert, Benjamin Jurgelucks
17
18 This file is part of ADOL-C. This software is provided as open source.
19 Any use, reproduction, or distribution of the software constitutes
20 recipient's acceptance of the terms of the accompanying license file.
21
22----------------------------------------------------------------------------*/
23
24#include <adolc/adtl_hov.h>
25#include <cmath>
26#include <iostream>
27#include <limits>
28#include "dvlparms.h"
29
30using std::cout;
31
32extern "C" void adolc_exit(int errorcode, const char *what, const char* function, const char *file, int line);
33
34namespace adtl_hov {
35
36
37size_t adouble::numDir = 1;
38size_t adouble::degree = 1;
39
40/*
41#if USE_BOOST_POOL
42boost::pool<boost::default_user_allocator_new_delete>* adouble::advalpool = new
43boost::pool<boost::default_user_allocator_new_delete>((adouble::numDir+1) * sizeof(double), 32, 10000);
44#endif
45*/
46/*******************  i/o operations  ***************************************/
47ostream& operator << ( ostream& out, const adouble& a) {
48        out << "Value: " << a.val;
49        out << " ADValues (" << adouble::numDir << "): ";
50        FOR_I_EQ_0_LT_NUMDIR
51            out << a.ADVAL_I << " ";
52        out << "(a)";
53    return out;
54}
55
56istream& operator >> ( istream& in, adouble& a) {
57        char c;
58        do in >> c;
59        while (c!=':' && !in.eof());
60        in >> a.val;
61        unsigned int num;
62        do in >> c;
63        while (c!='(' && !in.eof());
64        in >> num;
65        if (num>adouble::numDir)
66        {
67            cout << "ADOL-C error: to many directions in input\n";
68            adolc_exit(-1,"",__func__,__FILE__,__LINE__);
69        }
70        do in >> c;
71        while (c!=':' && !in.eof());
72        FOR_I_EQ_0_LT_NUMDIR
73            in >> a.ADVAL_I;
74        do in >> c;
75        while (c!=')' && !in.eof());
76        return in;
77}
78
79}
Note: See TracBrowser for help on using the repository browser.