Ignore:
Timestamp:
Aug 6, 2012 11:03:16 AM (8 years ago)
Author:
kulshres
Message:

Merge branch 'master' of 'gitclone' into svn

It may require some work for hessian patterns and advector to work
properly, since they were changed simultaneously by Andrea and I

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

The following commits were merged:

commit aeb288e939c7657aeaf75a8cbb833f9096ee2ce0
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Aug 6 16:46:20 2012 +0200

correct compilation error in message printing

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

commit 0d6e681b19d116bf0aca1d918fb567aed49e1766
Author: Benjamin Letschert <letschi@…>
Date: Tue May 29 15:53:45 2012 +0200

for floor_op and ceil_op in INDO+TIGHT mode ind_dom should be set zero

commit 35689c69c49e02fb1b211e4f873851ce734c839e
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri May 4 16:34:49 2012 +0200

add a comment for clarification

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

commit 710b93301d98610239f17dc40ba8cba6651f2ea5
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri May 4 14:21:49 2012 +0200

add copyright notices

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

commit 830f2cc75ba823c2343f4a524eb3e90ab02bc278
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu May 3 13:59:32 2012 +0200

Use the block allocation and don't write all locations to tape

Now that we ensure block structure while allocating an advector
we don't need to write all locations to tape in order to do
subscripting operations. We can use arithmetic.

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

commit 8599c889e5cd684a7066600835df5f0c033eb339
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu May 3 13:57:39 2012 +0200

Allocate advector ensuring contiguous locations

use a dummy blocker to call the function before calling the vector
constructor. Also use the fill constructor since the initialise
constructor is experimental (for some reason) and a fill constructor
is called internally by gcc anyway. This way we won't have to ensure a
n+1 block and get holes.

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

commit d62777e6070cf8b80b7b32616a874186e6463919
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu May 3 13:50:48 2012 +0200

Always put the last freed block to the front

This will make it efficienter if a block is deallocated right
one after the other. There will only be a search the first time
and all others will just work with the front of the list.

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

commit 33ae71a35fc04da062c4ba85659cbaf474caf1b8
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Apr 27 17:36:41 2012 +0200

changes in StoreManagemerLocintBlock? to make it work right

add StoreManagerLocintBlock? to be the default StoreManager? in
tape_handling.cpp

All existing ADOL-C programs need to be tested again.

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

commit af30b922ee0a267555fdcdfe66d0823aa98688be
Author: Benjamin Letschert <letschi@…>
Date: Fri Apr 27 13:09:56 2012 +0200

Adding new storem anagement StoreManagerLocintBlock? to storemanager.h
and to tape_handling.cpp

commit 7875317a03b08a2729879edfaec7ae5cd1363ef2
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Feb 29 08:49:25 2012 +0100

convert tape stats to size_t from uint

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

commit 11e535ae503f5961d0c62336d6942c96e4b7c3ba
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jan 12 13:22:27 2012 +0100

Revert "add missing arguments to ext_fct calls"

This reverts commit 00622f92b5444e81f0c3760eeee0e14d4e8e4787.

This was temporary and wasn't supposed to be uploaded, some parts will
go into trunk.

commit 37ca7b37f3538153054dee40d3a75d560b3aa81f
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Jan 12 13:21:13 2012 +0100

Revert "add safeguards and indo mode to ext_diff"

This reverts commit 507df83d988e3d64848eb0350369094b0b2ce742.

This was temporary for debugging and wasn't supposed to be uploaded

commit 507df83d988e3d64848eb0350369094b0b2ce742
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Sat Dec 31 23:46:23 2011 +0100

add safeguards and indo mode to ext_diff

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

commit 00622f92b5444e81f0c3760eeee0e14d4e8e4787
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Sat Dec 31 00:47:17 2011 +0100

add missing arguments to ext_fct calls

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

commit 1c1c7347867e583509716f7e2a8395875d0e3d53
Author: Benjamin Letschert <letschi@…>
Date: Fri Dec 16 14:18:24 2011 +0100

Bugfix in copy_index_domain

commit 69df20b8f0240e80515c7f0df456f124cef70cf8
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Dec 5 11:32:58 2011 +0100

shift around some code and add another constructor

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

commit b2c13089d4f5b45e7626e04c17b2f7bee08adc6a
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Nov 29 17:29:47 2011 +0100

const no more needed after last bugfix

add check for gradient w.r.t. rhs vector.

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

commit 78ea1e83eb17163fa0703e7b2b289659c4c6d42b
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Nov 28 17:13:23 2011 +0100

bugfix in reverse mode during ref_copyout

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

commit 3a7c70061118c89ad66afeec45d957dbdaf002b3
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Nov 28 17:12:39 2011 +0100

Add one more assignment operator

this one is used when an adubref is copied into another adubref
as in from one advector to another advector, as this needs taping
however we don't need to override copy-constructor, because
construction can only be done when returning adubref.

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

commit 9c150d9aa825cf1e5964cd15c7d38b9a34984fce
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Nov 25 12:49:14 2011 +0100

changed aTmp*TRES to (aTmp==0)?0:(aTmp*TRES) and similar occurences to avoid nans by 0*inf

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

commit 0efabbcb41d8b17f0fe55a35ca63ba93913bccbe
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Nov 25 12:32:36 2011 +0100

compile with -std=gnu99 to get both _GNU_SOURCE and _ISOC99_SOURCE

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

commit 45fa79bd4d8ae0f4ef1e39b32f96271134e886f5
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Fri Nov 25 12:20:02 2011 +0100

cast result of trunc to avoid warnings

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

commit b97ae47a80f7c0034b8f29d14656f75abcd51b4d
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Nov 24 17:53:11 2011 +0100

counting down with unsigned variables is dangerous

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

commit 5dd6a95ce0403f9ac4b262a9546f86e95a5489ac
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Nov 24 17:52:40 2011 +0100

reverse the order of indep vars and add reverse call

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

commit 2d794980215e1ae41af0e3cc6ed8a5e97507a2f7
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Nov 24 17:49:25 2011 +0100

Add functions to print L and R and compute scalar product

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

commit 889d35f671f2d2eea4dda182b0d903746994fbcd
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Thu Nov 24 17:47:31 2011 +0100

bugfixes in luexam

use less adoubles, loop variables for constant sized loops should
remain inactive size_t. counting down with size_t is bad.

const-ness of advectors matters during active subscripting,
espacially when the lhs is a subscripted advector too, unless
there is a expression involving badouble on the rhs.

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

commit 0dadd11bf743e7283a26613c1503778c6997654a
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Nov 23 17:18:05 2011 +0100

tweak the example a bit

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

commit 898afff0d43d86941125dd2e71857c619e3f28a4
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Nov 23 17:17:43 2011 +0100

If location buffer must contain n+2 free spaces

in case location buffer goes onto disk then check and write that
block before doing a subscript operation
if location buffer is smaller than n+2 then we cannot continue.

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

commit 1c2e4771972f0ce4db38bd959c23d18c061be568
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Nov 23 15:38:50 2011 +0100

one more cast

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

commit 71b506ae55f8d6754f5c2a1f800220cb5a5bb974
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Nov 23 15:27:53 2011 +0100

Compilation fixes for sparse configuration

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

commit 73334f20d51e707ee709a3602060aa3351dc6c29
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Nov 22 18:23:37 2011 +0100

add an example that uses advector with permutations

Lu factorization with pivoting is implemented here. The same traced
procedure can be used for different matrices that require different
pivots.

Zos_forward has been verified, WIP to verify derivatives.

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

commit c54da9e8cd03e99d9362cc1a7eb551101b5a4cb8
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Nov 22 18:20:35 2011 +0100

some more inline helpers for advector

the destructor need not contain anything.

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

commit d403b2d2b7e591db7c353c8c3ce551e7d6174df0
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Nov 22 18:19:58 2011 +0100

implement condassign for adubref

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

commit 696e18b5dcf9534f7609243f085a508fba178b6c
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Nov 22 18:19:09 2011 +0100

bugfix in -= operator for adubref

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

commit b7dd8285c6fe8262d07d0a5393c15bcca7eeae96
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Nov 21 13:47:48 2011 +0100

implement reference operations in forward and reverse mode

the referenced location is recorded in the taylor buffer of the
reference variable, and read from the taylor buffer before any
operation is performed. The operations are then performed directly
on the referenced location.

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

commit d546c517676a42065a98df782898f9e3472836b2
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Nov 21 13:45:49 2011 +0100

add new operations for the tape to work with references

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

commit 07508c193f53c6c5912485dcb517ca7c67b75234
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Mon Nov 21 13:45:17 2011 +0100

Add a class to work as a reference to adouble and adub

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

commit e60d733c951a8a1d621a1401744fa03db78e9b92
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Mar 2 15:32:28 2011 +0100

introduce active subscript operation in forward and reverse

subscript operation as previously defined on advector was not quite
correct in case of computed index that changed while being evaluated
from tape. In this case we need the tape to record the subscript
operation so that the correct taylor and adjoint values are propagated
even if the index changed. This is especially true for index computation
via the lookupindex() function, where the index depends on the arguments
x and y which may change their values.

This active subscript is a copy_value operation not a copy_ref one.
So the result should not be used as an lvalue for any further operation.
In case the result is used as an lvalue the original entry in the
vector will not be altered, only the copied out version will be altered.

Also the safe mode of integer propagation for sparsity pattern
computation is not supported, only the tight mode is supported.

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

commit 5764beb91000483e02d4c6b52e67d177fff04a42
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Mar 2 13:59:12 2011 +0100

zeroing out the store is not necessary at all

and saves us some time by reducing memory access.

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

commit 29d3460e0c7a6d2839a25d8896c37fff98ad6a3c
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Wed Mar 2 13:57:33 2011 +0100

oplate.h is not needed after installation

so don't install it, and don't make it public api. it is totally
internal to ADOL-C itself.

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

commit 0e3ac08ba9c6ac0aa7d3820def9e62e079a83e44
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Mar 1 16:00:17 2011 +0100

add missing include

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

commit b7364c7c2164981ce9e198b69f6aef8684388b43
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Mar 1 15:46:56 2011 +0100

Add new files to buildsystem.

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

commit aaefbdef3a6e00792ce0c57acff67e4f4ee3224b
Author: Kshitij Kulshreshtha <kshitij@…>
Date: Tue Mar 1 15:38:59 2011 +0100

New class advector for index lookup and subscripting

This is a container using std::vector<adouble>. The subscripting
operations return references to adoubles, nothing needs to be written
onto the tape for this since the following operation using the adouble
reference will do the right thing.
The index lookup operation uses a sequence of n condassign_s ops which
are taped, and returns the index which matches the requirement as another
adouble.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/src/uni5_for.c

    r336 r337  
    2121 Copyright (c) Andrea Walther, Andreas Griewank, Andreas Kowarz,
    2222               Hristo Mitev, Sebastian Schlenkrich, Jean Utke, Olaf Vogel,
    23                Benjamin Letschert
     23               Benjamin Letschert, Kshitij Kulshreshtha
     24               
    2425
    2526 This file is part of ADOL-C. This software is provided as open source.
     
    3334#include <adolc/taping.h>
    3435#include "taping_p.h"
    35 #include <adolc/oplate.h>
     36#include "oplate.h"
    3637#include <adolc/externfcts.h>
    3738#include "externfcts_p.h"
     
    36233624#if defined(_INDO_)
    36243625#if defined(_INDOPRO_)
     3626#ifdef _TIGHT_
     3627                ind_dom[res][0] = 0;
     3628#else
    36253629                copy_index_domain(res, arg, ind_dom);
     3630#endif /* _TIGHT_ */
    36263631#endif
    36273632#if defined(_NONLIND_)
     
    36553660#if defined(_INDO_)
    36563661#if defined(_INDOPRO_)
     3662#ifdef _TIGHT_
     3663                ind_dom[res][0] = 0;
     3664#else
    36573665                copy_index_domain(res, arg, ind_dom);
     3666#endif /* _TIGHT_ */
    36583667#endif
    36593668#if defined(_NONLIND_)
     
    38463855                break;
    38473856
     3857
     3858                /*--------------------------------------------------------------------------*/
     3859            case subscript:
     3860                coval = get_val_f();
     3861                arg = get_locint_f();
     3862                res = get_locint_f();
     3863                {
     3864                    size_t cnt, idx, numvar = (size_t)trunc(fabs(coval));
     3865                    locint vectorloc;
     3866                    vectorloc = get_locint_f();
     3867#if !defined(_NTIGHT_)
     3868                    idx = (size_t)trunc(fabs(dp_T0[arg]));
     3869                    if (idx >= numvar)
     3870                        fprintf(DIAG_OUT, "ADOL-C warning: index out of bounds while subscripting n=%z, idx=%z\n", numvar, idx);
     3871                    arg1 = vectorloc+idx;
     3872                    IF_KEEP_WRITE_TAYLOR(res,keep,k,p);
     3873                    dp_T0[res] = dp_T0[arg1];
     3874#if defined(_INDO_)
     3875                    copy_index_domain(res, arg1, ind_dom);
     3876#else
     3877#if !defined(_ZOS_) /* BREAK_ZOS */
     3878                    ASSIGN_T(Targ1,TAYLOR_BUFFER[arg1])
     3879                    ASSIGN_T(Tres,TAYLOR_BUFFER[res])
     3880
     3881                    FOR_0_LE_l_LT_pk
     3882                    TRES_INC = TARG1_INC;
     3883#endif
     3884#endif
     3885#else
     3886                    fprintf(DIAG_OUT, "ADOL-C error: active subscripting does not work in safe mode, please use tight mode\n");
     3887                    exit(-2);
     3888#endif /* ALL_TOGETHER_AGAIN */
     3889                }
     3890                break;
     3891
     3892            case subscript_ref:
     3893                coval = get_val_f();
     3894                arg = get_locint_f();
     3895                res = get_locint_f();
     3896                {
     3897                    size_t cnt, idx, numvar = (size_t)trunc(fabs(coval));
     3898                    locint vectorloc;
     3899                    vectorloc = get_locint_f();
     3900#if !defined(_NTIGHT_)
     3901                    idx = (size_t)trunc(fabs(dp_T0[arg]));
     3902                    if (idx >= numvar)
     3903                        fprintf(DIAG_OUT, "ADOL-C warning: index out of bounds while subscripting (ref) n=%z, idx=%z\n", numvar, idx);
     3904                    arg1 = vectorloc+idx;
     3905                    IF_KEEP_WRITE_TAYLOR(res,keep,k,p);
     3906                    dp_T0[res] = arg1;
     3907#else
     3908                    fprintf(DIAG_OUT, "ADOL-C error: active subscripting does not work in safe mode, please use tight mode\n");
     3909                    exit(-2);
     3910#endif
     3911                }
     3912                break;
     3913
     3914            case ref_copyout:
     3915                arg = get_locint_f();
     3916                res = get_locint_f();
     3917#if !defined(_NTIGHT_)
     3918                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     3919                IF_KEEP_WRITE_TAYLOR(res,keep,k,p);
     3920                dp_T0[res] = dp_T0[arg1];
     3921#if defined(_INDO_)
     3922                copy_index_domain(res, arg1, ind_dom);
     3923#else
     3924#if !defined(_ZOS_) /* BREAK_ZOS */
     3925                ASSIGN_T(Targ1,TAYLOR_BUFFER[arg1])
     3926                ASSIGN_T(Tres,TAYLOR_BUFFER[res])
     3927
     3928                FOR_0_LE_l_LT_pk
     3929                TRES_INC = TARG1_INC;
     3930#endif
     3931#endif
     3932#else
     3933                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     3934                exit(-2);
     3935#endif /* ALL_TOGETHER_AGAIN */
     3936                break;
     3937
     3938            case ref_incr_a:
     3939                arg = get_locint_f();
     3940#if !defined(_NTIGHT_)
     3941                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     3942                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p);
     3943                dp_T0[arg1]++;
     3944#else
     3945                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     3946                exit(-2);
     3947#endif
     3948                break;
     3949
     3950            case ref_decr_a:
     3951                arg = get_locint_f();
     3952#if !defined(_NTIGHT_)
     3953                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     3954                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p);
     3955                dp_T0[arg1]--;
     3956#else
     3957                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     3958                exit(-2);
     3959#endif
     3960                break;
     3961
     3962            case ref_assign_d:
     3963                arg = get_locint_f();
     3964                coval = get_val_f();
     3965               
     3966#if !defined(_NTIGHT_)
     3967                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     3968                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p)
     3969                dp_T0[arg1] = coval;
     3970#if defined(_INDO_)
     3971                ind_dom[arg1][0] = 0;
     3972#else
     3973#if !defined(_ZOS_)
     3974                ASSIGN_T(Targ1, TAYLOR_BUFFER[arg1])
     3975
     3976                FOR_0_LE_l_LT_pk
     3977                TARG1_INC = 0;
     3978#endif
     3979#endif
     3980#else
     3981                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     3982                exit(-2);
     3983#endif
     3984                break;
     3985
     3986            case ref_assign_d_zero:
     3987                arg = get_locint_f();
     3988
     3989#if !defined(_NTIGHT_)
     3990                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     3991                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p)
     3992                dp_T0[arg1] = 0.0;
     3993#if defined(_INDO_)
     3994                ind_dom[arg1][0] = 0;
     3995#else
     3996#if !defined(_ZOS_)
     3997                ASSIGN_T(Targ1, TAYLOR_BUFFER[arg1])
     3998
     3999                FOR_0_LE_l_LT_pk
     4000                TARG1_INC = 0;
     4001#endif
     4002#endif
     4003#else
     4004                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4005                exit(-2);
     4006#endif
     4007                break;
     4008
     4009            case ref_assign_d_one:
     4010                arg = get_locint_f();
     4011
     4012#if !defined(_NTIGHT_)
     4013                arg1 = (size_t)trunc(fabs(dp_T0[arg]));
     4014                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p)
     4015                dp_T0[arg1] = 1.0;
     4016#if defined(_INDO_)
     4017                ind_dom[arg1][0] = 0;
     4018#else
     4019#if !defined(_ZOS_)
     4020                ASSIGN_T(Targ1, TAYLOR_BUFFER[arg1])
     4021
     4022                FOR_0_LE_l_LT_pk
     4023                TARG1_INC = 0;
     4024#endif
     4025#endif
     4026#else
     4027                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4028                exit(-2);
     4029#endif
     4030                break;
     4031
     4032            case ref_assign_a:           /* assign an adouble variable an    assign_a */
     4033                /* adouble value. (=) */
     4034                arg = get_locint_f();
     4035                res = get_locint_f();
     4036
     4037#if !defined(_NTIGHT_)
     4038                arg1 = (size_t)trunc(fabs(dp_T0[res]));
     4039                IF_KEEP_WRITE_TAYLOR(arg1,keep,k,p)
     4040                dp_T0[arg1] = dp_T0[arg];
     4041#if defined(_INDO_)
     4042                copy_index_domain(arg1, arg, ind_dom);
     4043#else
     4044#if !defined(_ZOS_) /* BREAK_ZOS */
     4045                ASSIGN_T(Targ,TAYLOR_BUFFER[arg])
     4046                ASSIGN_T(Targ1,TAYLOR_BUFFER[arg1])
     4047
     4048                FOR_0_LE_l_LT_pk
     4049                TARG1_INC = TARG_INC;
     4050#endif
     4051#endif
     4052#else
     4053                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4054                exit(-2);
     4055#endif /* ALL_TOGETHER_AGAIN */
     4056                break;
     4057
     4058            case ref_assign_ind:       /* assign an adouble variable an    assign_ind */
     4059                /* independent double value (<<=) */
     4060                arg = get_locint_f();
     4061
     4062
     4063#if !defined(_NTIGHT_)
     4064                res = (size_t)trunc(fabs(dp_T0[arg]));
     4065                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4066                dp_T0[res] = basepoint[indexi];
     4067#if defined(_INDO_)
     4068                ind_dom[res][0] = 1;
     4069                ind_dom[res][2] = indexi;
     4070#else
     4071#if !defined(_ZOS_) /* BREAK_ZOS */
     4072                ASSIGN_T(Tres, TAYLOR_BUFFER[res])
     4073
     4074#ifdef _INT_FOR_
     4075                FOR_0_LE_l_LT_p
     4076                TRES_INC = ARGUMENT(indexi,l,i);
     4077#else
     4078                FOR_0_LE_l_LT_p
     4079                FOR_0_LE_i_LT_k
     4080                TRES_INC = ARGUMENT(indexi,l,i);
     4081#endif
     4082#endif
     4083#endif
     4084#else
     4085                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4086                exit(-2);
     4087#endif /* ALL_TOGETHER_AGAIN */
     4088                ++indexi;
     4089                break;
     4090
     4091            case ref_eq_plus_d:            /* Add a floating point to an    eq_plus_d */
     4092                /* adouble. (+=) */
     4093                arg  = get_locint_f();
     4094                coval = get_val_f();
     4095
     4096
     4097#if !defined(_NTIGHT_)
     4098                res = (size_t)trunc(fabs(dp_T0[arg]));
     4099                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4100                dp_T0[res] += coval;
     4101#else
     4102                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4103                exit(-2);
     4104#endif /* !_NTIGHT_ */
     4105                break;
     4106
     4107                /*--------------------------------------------------------------------------*/
     4108            case ref_eq_plus_a:             /* Add an adouble to another    eq_plus_a */
     4109                /* adouble. (+=) */
     4110                arg = get_locint_f();
     4111                arg1 = get_locint_f();
     4112
     4113#if !defined(_NTIGHT_)
     4114                res = (size_t)trunc(fabs(dp_T0[arg1]));
     4115                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4116                dp_T0[res] += dp_T0[arg];
     4117#if defined(_INDO_)
     4118                merge_2_index_domains(res, arg, ind_dom);
     4119#else
     4120#if !defined(_ZOS_) /* BREAK_ZOS */
     4121                ASSIGN_T(Tres, TAYLOR_BUFFER[res])
     4122                ASSIGN_T(Targ, TAYLOR_BUFFER[arg])
     4123
     4124#ifdef _INT_FOR_
     4125                FOR_0_LE_l_LT_pk
     4126                TRES_INC |= TARG_INC;
     4127#else
     4128                FOR_0_LE_l_LT_pk
     4129                TRES_INC += TARG_INC;
     4130#endif
     4131#endif
     4132#endif
     4133#else
     4134                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4135                exit(-2);
     4136#endif /* ALL_TOGETHER_AGAIN */
     4137                break;
     4138
     4139            case ref_eq_min_d:       /* Subtract a floating point from an    eq_min_d */
     4140                /* adouble. (-=) */
     4141                arg = get_locint_f();
     4142                coval = get_val_f();
     4143
     4144#if !defined(_NTIGHT_)
     4145                res = (size_t)trunc(fabs(dp_T0[arg]));
     4146                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4147                dp_T0[res] -= coval;
     4148#else
     4149                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4150                exit(-2);
     4151#endif /* !_NTIGHT_ */
     4152                break;
     4153
     4154                /*--------------------------------------------------------------------------*/
     4155            case ref_eq_min_a:        /* Subtract an adouble from another    eq_min_a */
     4156                /* adouble. (-=) */
     4157                arg = get_locint_f();
     4158                arg1 = get_locint_f();
     4159
     4160#if !defined(_NTIGHT_)
     4161                res = (size_t)trunc(fabs(dp_T0[arg1]));
     4162                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4163                dp_T0[res] -= dp_T0[arg];
     4164#if defined(_INDO_)
     4165                merge_2_index_domains(res, arg, ind_dom);
     4166#else
     4167#if !defined(_ZOS_) /* BREAK_ZOS */
     4168                ASSIGN_T(Tres, TAYLOR_BUFFER[res])
     4169                ASSIGN_T(Targ, TAYLOR_BUFFER[arg])
     4170
     4171#ifdef _INT_FOR_
     4172                FOR_0_LE_l_LT_pk
     4173                TRES_INC |= TARG_INC;
     4174#else
     4175                FOR_0_LE_l_LT_pk
     4176                TRES_INC -= TARG_INC;
     4177#endif
     4178#endif
     4179#endif
     4180#else
     4181                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4182                exit(-2);
     4183#endif /* ALL_TOGETHER_AGAIN */
     4184                break;
     4185
     4186            case ref_eq_mult_d:              /* Multiply an adouble by a    eq_mult_d */
     4187                /* flaoting point. (*=) */
     4188                arg = get_locint_f();
     4189                coval = get_val_f();
     4190
     4191#if !defined(_NTIGHT_)
     4192                res = (size_t)trunc(fabs(dp_T0[arg]));
     4193                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4194                dp_T0[res] *= coval;
     4195#if !defined(_INDO_)
     4196#if !defined(_ZOS_) /* BREAK_ZOS */
     4197#if !defined( _INT_FOR_)
     4198
     4199                FOR_0_LE_l_LT_pk
     4200                ASSIGN_T(Tres, TAYLOR_BUFFER[res])
     4201
     4202                FOR_0_LE_l_LT_pk
     4203                TRES_INC *= coval;
     4204#endif
     4205#endif
     4206#endif
     4207#else
     4208                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4209                exit(-2);
     4210#endif /* ALL_TOGETHER_AGAIN */
     4211                break;
     4212
     4213            case ref_eq_mult_a:       /* Multiply one adouble by another    eq_mult_a */
     4214                /* (*=) */
     4215                arg = get_locint_f();
     4216                arg1 = get_locint_f();
     4217
     4218#if !defined(_NTIGHT_)
     4219                res = (size_t)trunc(fabs(dp_T0[arg1]));
     4220                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4221#if defined(_INDO_)
     4222                merge_2_index_domains(res, arg, ind_dom);
     4223#if defined(_NONLIND_)
     4224                extend_nonlinearity_domain_binary(res, arg, ind_dom, nonl_dom);
     4225#endif
     4226#else
     4227#if !defined(_ZOS_) /* BREAK_ZOS */
     4228                ASSIGN_T(Tres, TAYLOR_BUFFER[res])
     4229                ASSIGN_T(Targ, TAYLOR_BUFFER[arg])
     4230
     4231                INC_pk_1(Tres)
     4232                INC_pk_1(Targ)
     4233
     4234#ifdef _INT_FOR_
     4235                FOR_p_GT_l_GE_0
     4236                TRES_FODEC |= TARG_DEC;
     4237#else
     4238                FOR_p_GT_l_GE_0
     4239                FOR_k_GT_i_GE_0
     4240                { TRES_FODEC = dp_T0[res]*TARG_DEC +
     4241                               TRES*dp_T0[arg];
     4242                  DEC_TRES_FO
     4243#ifdef _HIGHER_ORDER_
     4244                  TresOP = Tres-i;
     4245                  TargOP = Targ;
     4246
     4247                  for (j=0;j<i;j++)
     4248                  *Tres += (*TresOP++) * (*TargOP--);
     4249                  Tres--;
     4250#endif /* _HIGHER_ORDER_ */
     4251                }
     4252#endif
     4253#endif
     4254#endif
     4255                dp_T0[res] *= dp_T0[arg];
     4256#else
     4257                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4258                exit(-2);
     4259#endif /* !_NTIGHT_ */
     4260                break;
     4261
     4262            case ref_cond_assign:                                      /* cond_assign */
     4263                arg   = get_locint_f();
     4264                arg1  = get_locint_f();
     4265                arg2  = get_locint_f();
     4266                {
     4267                    locint ref = get_locint_f();
     4268                    coval = get_val_f();
     4269#if !defined(_NTIGHT_)
     4270                    res   = (size_t)trunc(fabs(dp_T0[ref]));
     4271
     4272                    IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4273
     4274                /* olvo 980924 changed order to allow reflexive ops */
     4275#if defined(_INDO_)
     4276                if (dp_T0[arg] > 0) {
     4277                    if (coval <= 0.0)
     4278                        MINDEC(ret_c,2);
     4279                    dp_T0[res] = dp_T0[arg1];
     4280
     4281                    combine_2_index_domains(res, arg1, arg2, ind_dom);
     4282                } else {
     4283                    if (coval > 0.0)
     4284                        MINDEC(ret_c,2);
     4285                    if (dp_T0[arg] == 0)
     4286                        MINDEC(ret_c,0);
     4287                    dp_T0[res] = dp_T0[arg2];
     4288
     4289                    combine_2_index_domains(res, arg1, arg2, ind_dom);
     4290                }
     4291#else
     4292#if !defined(_ZOS_) /* BREAK_ZOS */
     4293                ASSIGN_T(Tres,  TAYLOR_BUFFER[res])
     4294                ASSIGN_T(Targ1, TAYLOR_BUFFER[arg1])
     4295                ASSIGN_T(Targ2, TAYLOR_BUFFER[arg2])
     4296#endif /* ALL_TOGETHER_AGAIN */
     4297
     4298#ifdef _INT_FOR_
     4299                coval = get_val_f();
     4300
     4301                if (dp_T0[arg] > 0)
     4302                    FOR_0_LE_l_LT_pk
     4303                    TRES_INC = TARG1_INC;
     4304                else
     4305                    FOR_0_LE_l_LT_pk
     4306                    TRES_INC = TARG2_INC;
     4307
     4308                if (dp_T0[arg] > 0) {
     4309                    if (coval <= 0.0)
     4310                        MINDEC(ret_c,2);
     4311                    dp_T0[res] = dp_T0[arg1];
     4312                } else {
     4313                    if (coval > 0.0)
     4314                        MINDEC(ret_c,2);
     4315                    if (dp_T0[arg] == 0)
     4316                        MINDEC(ret_c,0);
     4317                    dp_T0[res] = dp_T0[arg2];
     4318                }
     4319                FOR_0_LE_l_LT_pk
     4320                TRES_INC = TARG1_INC | TARG2_INC;
     4321#else
     4322#if !defined(_ZOS_) /* BREAK_ZOS */
     4323                if (dp_T0[arg] > 0)
     4324                    FOR_0_LE_l_LT_pk
     4325                    TRES_INC = TARG1_INC;
     4326                else
     4327                    FOR_0_LE_l_LT_pk
     4328                    TRES_INC = TARG2_INC;
     4329#endif
     4330
     4331                if (dp_T0[arg] > 0) {
     4332                    if (coval <= 0.0)
     4333                        MINDEC(ret_c,2);
     4334                    dp_T0[res] = dp_T0[arg1];
     4335                } else {
     4336                    if (coval > 0.0)
     4337                        MINDEC(ret_c,2);
     4338                    if (dp_T0[arg] == 0)
     4339                        MINDEC(ret_c,0);
     4340                    dp_T0[res] = dp_T0[arg2];
     4341                }
     4342#endif
     4343#endif
     4344#else
     4345                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4346                exit(-2);
     4347#endif /* ALL_TOGETHER_AGAIN */
     4348                }
     4349                break;
     4350
     4351            case ref_cond_assign_s:                                  /* cond_assign_s */
     4352                arg   = get_locint_f();
     4353                arg1  = get_locint_f();
     4354                arg2   = get_locint_f();
     4355                coval = get_val_f();
     4356
     4357#if !defined(_NTIGHT_)
     4358                res = (size_t)trunc(fabs(dp_T0[arg2]));
     4359                IF_KEEP_WRITE_TAYLOR(res,keep,k,p)
     4360
     4361                /* olvo 980924 changed order to allow reflexive ops */
     4362#if defined(_INDO_)
     4363                    copy_index_domain(res, arg1, ind_dom);
     4364#else
     4365#if !defined(_ZOS_) /* BREAK_ZOS */
     4366                ASSIGN_T(Tres,  TAYLOR_BUFFER[res])
     4367                ASSIGN_T(Targ1, TAYLOR_BUFFER[arg1])
     4368#endif /* ALL_TOGETHER_AGAIN */
     4369
     4370#ifdef _INT_FOR_
     4371                coval = get_val_f();
     4372
     4373                if (dp_T0[arg] > 0)
     4374                    FOR_0_LE_l_LT_pk
     4375                    TRES_INC = TARG1_INC;
     4376
     4377                if (dp_T0[arg] > 0) {
     4378                    if (coval <= 0.0)
     4379                        MINDEC(ret_c,2);
     4380                    dp_T0[res] = dp_T0[arg1];
     4381                } else
     4382                    if (dp_T0[arg] == 0)
     4383                        MINDEC(ret_c,0);
     4384#else
     4385#if !defined(_ZOS_) /* BREAK_ZOS */
     4386                if (dp_T0[arg] > 0)
     4387                    FOR_0_LE_l_LT_pk
     4388                    TRES_INC = TARG1_INC;
     4389#endif
     4390                if (dp_T0[arg] > 0) {
     4391                    if (coval <= 0.0)
     4392                        MINDEC(ret_c,2);
     4393                    dp_T0[res] = dp_T0[arg1];
     4394                } else
     4395                    if (dp_T0[arg] == 0)
     4396                        MINDEC(ret_c,0);
     4397#endif
     4398#endif
     4399#else
     4400                fprintf(DIAG_OUT, "ADOL-C error: active vector element referencing does not work in safe mode, please use tight mode\n");
     4401                exit(-2);
     4402#endif /* ALL_TOGETHER_AGAIN */
     4403                break;
    38484404
    38494405                /****************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.