From ffb886088c1439aeff731c504a1c2746e717d772 Mon Sep 17 00:00:00 2001
From: Ian Bell <ian.bell@nist.gov>
Date: Thu, 16 Sep 2021 15:44:33 -0400
Subject: [PATCH] Gradient only needs first duals, not dual2nd

Big speedup for gradient calculations
---
 include/teqp/derivs.hpp | 4 ++--
 setup.py                | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/teqp/derivs.hpp b/include/teqp/derivs.hpp
index 1b03682..3895123 100644
--- a/include/teqp/derivs.hpp
+++ b/include/teqp/derivs.hpp
@@ -456,8 +456,8 @@ struct IsochoricDerivatives{
     * Uses autodiff to calculate derivatives
     */
     static auto build_Psir_gradient_autodiff(const Model& model, const Scalar& T, const VectorType& rho) {
-        ArrayXdual2nd rhovecc(rho.size()); for (auto i = 0; i < rho.size(); ++i) { rhovecc[i] = rho[i]; }
-        auto psirfunc = [&model, &T](const ArrayXdual2nd& rho_) {
+        ArrayXdual rhovecc(rho.size()); for (auto i = 0; i < rho.size(); ++i) { rhovecc[i] = rho[i]; }
+        auto psirfunc = [&model, &T](const ArrayXdual& rho_) {
             auto rhotot_ = rho_.sum();
             auto molefrac = (rho_ / rhotot_).eval();
             return eval(model.alphar(T, rhotot_, molefrac) * model.R(molefrac) * T * rhotot_);
diff --git a/setup.py b/setup.py
index b4c8ca2..4088bca 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ from setuptools import setup, Extension
 from setuptools.command.build_ext import build_ext
 from distutils.version import LooseVersion
 
-VERSION = '0.1.1'
+VERSION = '0.1.3'
 with open('interface/teqpversion.hpp','w') as fpver:
     fpver.write(f'#include <string>\nconst std::string TEQPVERSION = "{VERSION}";')
 
-- 
GitLab