Skip to content

TST: Add tests for autodifferentiation of derivative operator. #150

@steppi

Description

@steppi

The SciPy issue scipy/scipy#21665 asked for tests of the derivative operator for dual numbers:

xsf/include/xsf/dual.h

Lines 121 to 139 in d4217e1

dual &operator/=(const dual &other) {
for (size_t i = 0; i <= Order; ++i) {
for (size_t j = 1; j <= i; ++j) {
data[i] -= detail::fast_binom<T>(i - 1, j) * other.data[j] * data[i - j];
}
data[i] /= other.data[0];
}
return *this;
}
dual &operator/=(const value_type &other) {
for (size_t i = 0; i <= Order; ++i) {
data[i] /= other;
}
return *this;
}

At the time, there some doubts about the correctness of the implementation, which turned out to be unfounded. It was simply the case that the implementation is equivalent but not identical to the implementation from the reference paper Irwin had posted in ways that weren't immediately obvious to me, but perhaps should have been. It still seems like a good idea to add tests, but it will be more natural to add them to the C++ tests here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MaintenanceItems related to regular maintenance tasks

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions