source: trunk/test_more/base_alloc.cpp @ 2794

Last change on this file since 2794 was 2506, checked in by bradbell, 7 years ago

Change Licenses: CPL-1.0 -> EPL-1.0, GPL-2.0->GPL-3.0

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1/* $Id: base_alloc.cpp 2506 2012-10-24 19:36:49Z bradbell $ */
2/* --------------------------------------------------------------------------
3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 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.