Skip to content

Commit

Permalink
sum instead of diag to compute std in std_fdatagrid integrand
Browse files Browse the repository at this point in the history
  • Loading branch information
pcuestas committed Oct 12, 2023
1 parent 5509c00 commit 6b5e47d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion skfda/exploratory/stats/_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ def std_fdatabasis(X: FDataBasis, ddof: int = 1) -> FDataBasis:
def std_function(t_points: NDArrayFloat) -> NDArrayFloat: # noqa: WPS430
basis_evaluation = basis(t_points).reshape((basis.n_basis, -1))
std_values = np.sqrt(
np.diag(basis_evaluation.T @ coeff_cov_matrix @ basis_evaluation),
np.sum(
basis_evaluation * (coeff_cov_matrix @ basis_evaluation),
axis=0,
),
)
return np.reshape(std_values, (1, -1, X.dim_codomain))

Expand Down

0 comments on commit 6b5e47d

Please sign in to comment.