-
Notifications
You must be signed in to change notification settings - Fork 4
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
Design improve #37
Design improve #37
Changes from all commits
60665a0
de0592c
bb135ca
5165555
d8b46c5
2574511
d5b6b30
afea274
fad5234
c7c1949
d76d64f
f4ecb03
3582225
14c37b6
79e6050
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
get_5Dlist_elem <- function(x, alpha_u_i, lambda_u_i, alpha_v_i, lambda_v_i, rank_i = 1) { | ||
if (!inherits(x, "MoMA_5D_list")) { | ||
moma_error(sQuote("x"), " should be a ", sQuote("MoMA_5D_list"), " object.") | ||
} | ||
n_alpha_u <- dim(x)[1] | ||
n_lambda_u <- dim(x)[2] | ||
n_alpha_v <- dim(x)[3] | ||
n_lambda_v <- dim(x)[4] | ||
n_rank <- dim(x)[5] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alignment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't found how to set it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the README, it looks like setting Don't worry about it - we'll just commit to what styler uses. I was commenting out of habit. |
||
|
||
# NOTE: R index starts from 1 | ||
if ( | ||
alpha_u_i <= 0 || alpha_u_i > n_alpha_u || | ||
lambda_u_i <= 0 || lambda_u_i > n_lambda_u || | ||
alpha_v_i <= 0 || alpha_v_i > n_alpha_v || | ||
lambda_v_i <= 0 || lambda_v_i > n_lambda_v || | ||
rank_i <= 0 || rank_i > n_rank | ||
) { | ||
moma_error( | ||
"Invalid index (", alpha_u_i, ",", lambda_u_i, | ||
",", alpha_v_i, ",", lambda_v_i, ",", rank_i, "), dim = ", | ||
dim(x) | ||
) | ||
} | ||
|
||
return(x[ | ||
rank_i + n_rank * ( | ||
lambda_v_i - 1 + n_lambda_v * ( | ||
alpha_v_i - 1 + n_alpha_v * ( | ||
lambda_u_i - 1 + n_lambda_u * ( | ||
alpha_u_i - 1 | ||
) | ||
) | ||
) | ||
) | ||
]) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Longer term, we should think about making an accessor which takes alpha_u, lambda_u, etc (values not indices) and does the extraction. If we don't have exactly the right value in the saved list, we should (by default) interpolate with an option for an exact solve.
(I do something similar for the
coef
function in my ExclusiveLasso package.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue to track this.
#40 (comment)