Changeset 676 for trunk/ADOL-C/include


Ignore:
Timestamp:
Mar 17, 2016 10:29:13 AM (4 years ago)
Author:
kulshres
Message:

add a condeqassign to test for a >= 0

since condassign only tests for a > 0, there was no equality test

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

Location:
trunk/ADOL-C/include/adolc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/include/adolc/adouble.h

    r658 r676  
    6363                                  const double &arg );
    6464
     65void ADOLC_DLL_EXPORT condeqassign( double &res, const double &cond,
     66                                    const double &arg1, const double &arg2 );
     67void ADOLC_DLL_EXPORT condeqassign( double &res, const double &cond,
     68                                    const double &arg );
    6569
    6670/****************************************************************************/
     
    185189            const badouble &arg1, const badouble &arg2 );
    186190    friend ADOLC_DLL_EXPORT void condassign( adouble &res, const badouble &cond,
     191            const badouble &arg );
     192    friend ADOLC_DLL_EXPORT void condeqassign( adouble &res, const badouble &cond,
     193            const badouble &arg1, const badouble &arg2 );
     194    friend ADOLC_DLL_EXPORT void condeqassign( adouble &res, const badouble &cond,
    187195            const badouble &arg );
    188196
  • trunk/ADOL-C/include/adolc/adtl.h

    r631 r676  
    151151            const adouble &arg1, const adouble &arg2 );
    152152    inline friend void condassign( adouble &res, const adouble &cond,
     153            const adouble &arg );
     154    inline friend void condeqassign( adouble &res, const adouble &cond,
     155            const adouble &arg1, const adouble &arg2 );
     156    inline friend void condeqassign( adouble &res, const adouble &cond,
    153157            const adouble &arg );
    154158
     
    13231327}
    13241328
     1329inline void condeqassign( adouble &res, const adouble &cond,
     1330                          const adouble &arg1, const adouble &arg2 ) {
     1331    if (no_do_val()) {
     1332        fprintf(DIAG_OUT, "ADOL-C error: Tapeless: Incorrect mode, call setMode(enum Mode mode)\n");
     1333        throw logic_error("incorrect function call, errorcode=1");
     1334    }
     1335    if (do_val()) {
     1336        if (cond.getValue() >= 0)
     1337            res = arg1;
     1338        else
     1339            res = arg2;
     1340    }
     1341}
     1342
     1343inline void condeqassign( adouble &res, const adouble &cond,
     1344                          const adouble &arg ) {
     1345    if (no_do_val()) {
     1346        fprintf(DIAG_OUT, "ADOL-C error: Tapeless: Incorrect mode, call setMode(enum Mode mode)\n");
     1347        throw logic_error("incorrect function call, errorcode=1");
     1348    }
     1349    if (do_val()) {
     1350        if (cond.getValue() >= 0)
     1351            res = arg;
     1352    }
     1353}
     1354
    13251355
    13261356
  • trunk/ADOL-C/include/adolc/advector.h

    r658 r676  
    107107    friend ADOLC_DLL_EXPORT void condassign(adubref&, const badouble&, const badouble&, const badouble&);
    108108    friend ADOLC_DLL_EXPORT void condassign(adubref&, const badouble&, const badouble&);
     109    friend ADOLC_DLL_EXPORT void condeqassign(adubref&, const badouble&, const badouble&, const badouble&);
     110    friend ADOLC_DLL_EXPORT void condeqassign(adubref&, const badouble&, const badouble&);
    109111    ~adubref();
    110112};
Note: See TracChangeset for help on using the changeset viewer.