use weights_.size() instead of passing in N

release/4.3a0
Varun Agrawal 2023-10-23 17:55:39 -04:00
parent 79272bf8a8
commit 3bff8ad317
1 changed files with 8 additions and 8 deletions

View File

@ -239,8 +239,8 @@ class Basis {
* i.e., one row of the Kronecker product of weights_ with the * i.e., one row of the Kronecker product of weights_ with the
* MxM identity matrix. See also VectorEvaluationFunctor. * MxM identity matrix. See also VectorEvaluationFunctor.
*/ */
void calculateJacobian(size_t N) { void calculateJacobian() {
H_.setZero(1, M_ * N); H_.setZero(1, M_ * EvaluationFunctor::weights_.size());
for (int j = 0; j < EvaluationFunctor::weights_.size(); j++) for (int j = 0; j < EvaluationFunctor::weights_.size(); j++)
H_(0, rowIndex_ + j * M_) = EvaluationFunctor::weights_(j); H_(0, rowIndex_ + j * M_) = EvaluationFunctor::weights_(j);
} }
@ -252,14 +252,14 @@ class Basis {
/// Construct with row index /// Construct with row index
VectorComponentFunctor(size_t M, size_t N, size_t i, double x) VectorComponentFunctor(size_t M, size_t N, size_t i, double x)
: EvaluationFunctor(N, x), M_(M), rowIndex_(i) { : EvaluationFunctor(N, x), M_(M), rowIndex_(i) {
calculateJacobian(N); calculateJacobian();
} }
/// Construct with row index and interval /// Construct with row index and interval
VectorComponentFunctor(size_t M, size_t N, size_t i, double x, double a, VectorComponentFunctor(size_t M, size_t N, size_t i, double x, double a,
double b) double b)
: EvaluationFunctor(N, x, a, b), M_(M), rowIndex_(i) { : EvaluationFunctor(N, x, a, b), M_(M), rowIndex_(i) {
calculateJacobian(N); calculateJacobian();
} }
/// Calculate component of component rowIndex_ of P /// Calculate component of component rowIndex_ of P
@ -460,8 +460,8 @@ class Basis {
* i.e., one row of the Kronecker product of weights_ with the * i.e., one row of the Kronecker product of weights_ with the
* MxM identity matrix. See also VectorDerivativeFunctor. * MxM identity matrix. See also VectorDerivativeFunctor.
*/ */
void calculateJacobian(size_t N) { void calculateJacobian() {
H_.setZero(1, M_ * N); H_.setZero(1, M_ * this->weights_.size());
for (int j = 0; j < this->weights_.size(); j++) for (int j = 0; j < this->weights_.size(); j++)
H_(0, rowIndex_ + j * M_) = this->weights_(j); H_(0, rowIndex_ + j * M_) = this->weights_(j);
} }
@ -473,14 +473,14 @@ class Basis {
/// Construct with row index /// Construct with row index
ComponentDerivativeFunctor(size_t M, size_t N, size_t i, double x) ComponentDerivativeFunctor(size_t M, size_t N, size_t i, double x)
: DerivativeFunctorBase(N, x), M_(M), rowIndex_(i) { : DerivativeFunctorBase(N, x), M_(M), rowIndex_(i) {
calculateJacobian(N); calculateJacobian();
} }
/// Construct with row index and interval /// Construct with row index and interval
ComponentDerivativeFunctor(size_t M, size_t N, size_t i, double x, double a, ComponentDerivativeFunctor(size_t M, size_t N, size_t i, double x, double a,
double b) double b)
: DerivativeFunctorBase(N, x, a, b), M_(M), rowIndex_(i) { : DerivativeFunctorBase(N, x, a, b), M_(M), rowIndex_(i) {
calculateJacobian(N); calculateJacobian();
} }
/// Calculate derivative of component rowIndex_ of F /// Calculate derivative of component rowIndex_ of F
double apply(const Matrix& P, double apply(const Matrix& P,