-
Notifications
You must be signed in to change notification settings - Fork 3
Temporary example for testing optim replacement (KMbranch) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Xaleed
wants to merge
15
commits into
main
Choose a base branch
from
KMbranch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s not fully match the one described in the paper: Spline-based Nonlinear Biplots; the code includes a penalty term (consistent with the FORTRAN implementation), which is not in the paper.
…before merging. The folder is added to .Rbuildignore so it does not affect the package.
…its alignment with the Fortran implementation.
…rithm implemented in Rcpp
//Optimize alfunc by computing Z directly from BVEC and combining loops //- Eliminated intermediate B matrix creation by computing Z = M %*% B directly from BVEC vector //- Combined three separate loops (exind, prediction, loss calculation) into single pass //- Removed fortran-unused utility functions matm() and exind() //- Reduces memory allocations and improves cache locality //- Maintains identical mathematical behavior with better performance
…e a similar result for Rcpp and Fortran.
…ee a similar result for Rcpp and Fortran.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Fortran code is directly translated to Rcpp. To install, follow these steps:
Remove the existing package first
remove.packages("biplotEZ")
Install from the KMbranch branch
devtools::install_github("MuViSU/biplotEZ", ref = "KMbranch")
Load and test
library(biplotEZ)
You may notice that this Rcpp-based implementation is not as fast as the original Fortran version. This is primarily due to the line-by-line translation from Fortran, which does not fully exploit Rcpp’s strengths and therefore results in non-optimal performance. Addressing this issue would require certain modifications to the algorithm, for which I would need your permission. I would be happy to discuss the possible approaches in a meeting at your convenience.
There is an additional folder (\texttt{temp}), which is described below. The files in this directory are not cleaned:
I also add a temporary folder (examples/temp/) and example to test the replacement of the FORTRAN implementation with R’s function and a .Rcpp file.
The examples in examples/temp/ contains R code following the library’s main function logic (Fortran and Rcpp). Please run them on your system for any suggestions.
A new file in src/ (.Rcpp) has been added, which is called from the example.
The example is purely for testing purposes and does not affect the library, as examples/temp/ is included in .Rbuildignore.
Note: This is not intended for merging yet; the example can be removed when the branch is eventually merged.