Skip to content

Optimize performance and write performance tests for various FSDA toolbox functions#127

Merged
MarcoRianiUNIPR merged 1 commit into
UniprJRC:masterfrom
sindhujapr:function-optim
Jul 3, 2026
Merged

Optimize performance and write performance tests for various FSDA toolbox functions#127
MarcoRianiUNIPR merged 1 commit into
UniprJRC:masterfrom
sindhujapr:function-optim

Conversation

@sindhujapr

Copy link
Copy Markdown
Contributor

Proposed changes

The changes include suggested optimizations (using the matlab-optimize-performance skill) and performance tests (using the matlab-write-performance-tests skill) for various functions of the FSDA toolbox. These skills are available in the MATLAB Agentic Toolkit: https://github.com/matlab/matlab-agentic-toolkit.
Note: The matlab-optimize-performance skill tested for correctness of the functions it optimized as part of iterative optimization methodology.

Issue: #126

Types of changes

What types of changes does your code introduce to FSDA?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

performance tests using matlab-write-performance-tests skills from the
MATLAB Agentic Toolkit.
@matteozanettii

matteozanettii commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

fsda_test_errors.csv
Hi @sindhujapr,

Thank you for your work on this performance optimization and the new FSDAPerformanceSuite.

I have tested your changes using a local test script that covers all function alongside your new performance tests. The performance suite runs correctly, but I have a couple of points to address:

  1. Missing Documentation: I noticed that the header documentation (the "help" block) has been removed from several functions. In my first pull requests I made the same mistake, and it's common at first entry. Could you please restore the original documentation blocks?

  2. Logic Review: While the performance tests pass, I am currently reviewing the logic implementation in the new/modified functions (like MahalFS) I'd like to ensure the optimization does not alter the underlying statistical behavior compared to the original implementations. But for now, your work seems fine, thank you!

@@ -1,68 +1,23 @@
function d = mahalFS(Y,MU,SIGMA)
%mahalFS computes Mahalanobis distances (in squared units) for each row of matrix Y
%mahalFS computes Mahalanobis distances (in squared units) for each row of matrix Y

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cutout helper

end

%}
% Optimized: delegates to compiled MEX (9x faster) when available,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cutout helper

mdr = FSRmdr(y,X,out.bs,'init',init);
mdrStore(:,j)=mdr(:,2);
end
% MDRenv: forward envelopes of mdr. Matrix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cutout helper

%
% In the IRWLS procedure the value of loc and the value of the scale and
% of the shape matrix are updated in each step
%IRWLSmult Optimized IRWLS with inlined Tukey biweight and Cholesky mahalFS.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cutout helper

%
% init : Point where to start monitoring. Scalar.
% prob: quantiles for which envelopes have to be computed. Vector.
% scaled: If true, no consistency factor applied. Boolean.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cutout helper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindhujapr thanks again for your PR and thanks again to MathWorks for the help. Please, give us some time to review your code and for the moment please ignore all the other suggestions.

@MarcoRianiUNIPR

Copy link
Copy Markdown
Collaborator

@sindhujapr on behalf of all the FSDA group we wish to thank you very much. We have revised the modifications and and we are going to add additional comments inside the modified files so that the user can immediately see the modifications without the need of comparing the files to previous versions.

@MarcoRianiUNIPR MarcoRianiUNIPR merged commit 41d194e into UniprJRC:master Jul 3, 2026
11 of 15 checks passed
@sindhujapr

Copy link
Copy Markdown
Contributor Author

Thanks for incorporating these changes. Please let me know if any follow up is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants