dense AD: fix a few stupid bugs

e.g., looping over the wrong range or an infinite loop. also, the
dense-AD unit test is shortend to test one specialization and the
unspecialized class.
This commit is contained in:
Andreas Lauser
2017-03-17 20:38:41 +01:00
parent bf771b09b4
commit 2f44918a2b
15 changed files with 131 additions and 50 deletions

View File

@@ -161,8 +161,10 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
for (int i = dstart_; i < dend_; ++i)
data_[i] = other.data_[i];
}
@@ -219,7 +221,7 @@ public:
// derivatives
for (int i = 0; i < length_; ++i)
for (int i = dstart_; i < dend_; ++i)
this->data_[i] = this->data_[i]*v + other.data_[i] * u;
@@ -250,7 +252,7 @@ public:
// derivatives
for (int i = 0; i < length_; ++i)
for (int i = dstart_; i < dend_; ++i)
data_[i] = data_[i]*v_vv - other.data_[i]*u_vv;

View File

@@ -159,8 +159,10 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
}

View File

@@ -177,8 +177,19 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
data_[8] = other.data_[8];
data_[9] = other.data_[9];
data_[10] = other.data_[10];
}

View File

@@ -179,8 +179,20 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
data_[8] = other.data_[8];
data_[9] = other.data_[9];
data_[10] = other.data_[10];
data_[11] = other.data_[11];
}

View File

@@ -181,8 +181,21 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
data_[8] = other.data_[8];
data_[9] = other.data_[9];
data_[10] = other.data_[10];
data_[11] = other.data_[11];
data_[12] = other.data_[12];
}

View File

@@ -161,8 +161,11 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
}

View File

@@ -163,8 +163,12 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
}

View File

@@ -165,8 +165,13 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
}

View File

@@ -167,8 +167,14 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
}

View File

@@ -169,8 +169,15 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
}

View File

@@ -171,8 +171,16 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
}

View File

@@ -173,8 +173,17 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
data_[8] = other.data_[8];
}

View File

@@ -175,8 +175,18 @@ public:
// copy all derivatives from other
void copyDerivatives(const Evaluation& other)
{
for (int i = dstart_; 0 < dend_; ++i)
data_[i] = other.data_[i];
data_[1] = other.data_[1];
data_[2] = other.data_[2];
data_[3] = other.data_[3];
data_[4] = other.data_[4];
data_[5] = other.data_[5];
data_[6] = other.data_[6];
data_[7] = other.data_[7];
data_[8] = other.data_[8];
data_[9] = other.data_[9];
}