source: trunk/test_more/base_alloc.cpp @ 3793

Last change on this file since 3793 was 3779, checked in by bradbell, 4 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: cf5ca238670f67655fbbf3e23727437f7ed7b182
end hash code: 5661e2a629cceb77e7b703225bc1f3f8cf422129

commit 5661e2a629cceb77e7b703225bc1f3f8cf422129
Author: Brad Bell <bradbell@…>
Date: Fri Jan 1 04:23:41 2016 -0700

push_git2svn.py: Include changes in copyright date when checking for difference.

commit f0e9d149dc00ccf410a268389e3dcfd95499b863
Author: Brad Bell <bradbell@…>
Date: Fri Jan 1 03:57:09 2016 -0700

Advance copyright year to 2016.

commit 01d25679b7baddca878129635b0758f4ebb263fb
Author: Brad Bell <bradbell@…>
Date: Fri Jan 1 03:54:41 2016 -0700

download.omh: improve the no documentation download instructions.

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1// $Id: base_alloc.cpp 3779 2016-01-01 11:26:11Z bradbell $
2/* --------------------------------------------------------------------------
3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
4
5CppAD is distributed under multiple licenses. This distribution is under
6the terms of the
7                    Eclipse Public License Version 1.0.
8
9A copy of this license is included in the COPYING file of this distribution.
10Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11-------------------------------------------------------------------------- */
12# include "../example/base_alloc.hpp"
13# include <cppad/cppad.hpp>
14
15bool base_alloc_test(void)
16{       bool ok = true;
17        using CppAD::thread_alloc;
18        typedef CppAD::AD<base_alloc> my_ad;
19
20        // y = x^2
21        CppAD::vector<my_ad>   a_x, a_y;
22        a_x.resize(1);
23        a_x[0] = my_ad(1.);
24        CppAD::Independent(a_x);
25        a_y.resize(1);
26        a_y[0] = a_x[0];
27
28        // create a new parameter for each iteration of this loop
29        size_t i, N = 50;
30        for(i = 0; i < N; i++)
31                a_y[0] += double(i);
32
33        CppAD::ADFun<base_alloc> f(a_x, a_y);
34
35        return ok;
36}
Note: See TracBrowser for help on using the repository browser.