Changeset 1533 for trunk/test_more


Ignore:
Timestamp:
Sep 28, 2009 11:26:52 AM (11 years ago)
Author:
bradbell
Message:

trunk: Convert reverse sparse Hessian to work with vector_set.

rev_sparse_hes.cpp: test vector_set calculation of Hessian sparsity.
whats_new_09.omh: user's view of the changes.
for_sparse_jac.hpp: move member variables to end of calling sequence.
rev_sparse_jac.hpp: move member variables to end of calling sequence.
rev_sparse_hes.hpp: convert to use vector_set when for sparse does.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test_more/rev_sparse_hes.cpp

    r1521 r1533  
    1616namespace { // Begin empty namespace
    1717
    18 bool case_one(void)
     18bool case_one(bool packed)
    1919{       bool ok = true;
    2020        using namespace CppAD;
     
    8080
    8181        // compute sparsity pattern for Jacobian of F(U(x))
    82         F.ForSparseJac(n, Px);
     82        F.ForSparseJac(n, Px, packed);
    8383
    8484        // compute sparsity pattern for Hessian of F_0 ( U(x) )
     
    103103}
    104104
    105 bool case_two(void)
     105bool case_two(bool packed)
    106106{       bool ok = true;
    107107        using namespace CppAD;
     
    152152
    153153        // compute sparsity pattern for Jacobian of F(U(x))
    154         F.ForSparseJac(n, Px);
     154        F.ForSparseJac(n, Px, packed);
    155155
    156156        // compute sparsity pattern for Hessian of F_0 ( U(x) )
     
    167167}
    168168
    169 bool case_three(void)
     169bool case_three(bool packed)
    170170{       bool ok = true;
    171171        using CppAD::AD;
     
    200200
    201201        // compute sparsity pattern for J(x) = F^{(1)} (x)
    202         f.ForSparseJac(n, r);
     202        f.ForSparseJac(n, r, packed);
    203203
    204204        // compute sparsity pattern for H(x) = F_0^{(2)} (x)
     
    216216}
    217217
    218 bool case_four(void)
     218bool case_four(bool packed)
    219219{       bool ok = true;
    220220        using namespace CppAD;
     
    276276                r[ i * n + i ] = true;
    277277        }
    278         F.ForSparseJac(n, r);
     278        F.ForSparseJac(n, r, packed);
    279279
    280280        // compute the reverse Hessian sparsity pattern for F
     
    296296bool rev_sparse_hes(void)
    297297{       bool ok = true;
    298         ok &= case_one();
    299         ok &= case_two();
    300         ok &= case_three();
    301         ok &= case_four();
    302 
    303         return ok;
    304 }
     298
     299        ok &= case_one(true);
     300        ok &= case_two(true);
     301        ok &= case_three(true);
     302        ok &= case_four(true);
     303
     304        ok &= case_one(false);
     305        ok &= case_two(false);
     306        ok &= case_three(false);
     307        ok &= case_four(false);
     308
     309        return ok;
     310}
Note: See TracChangeset for help on using the changeset viewer.