-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
No method to construct factorization objects from pre-existing factors #1475
Comments
How about having a constructor along the lines of |
@ViralBShah I think that method will conflict with the current constructor where the @simonbyrne Calling Lapack code for the Cholesky decomposition of In writing things the way I did, I was trying to ensure that the eventual call to *potrs was controlled through a single function and all the other constructors went through it. I guess it is a matter of whether one considers a factorization object as being the factorization of a matrix of a certain type or just something that behaves like a factorization. If you are particularly interested in the Bartlett decomposition why not create a Bartlett decomposition type? Tearing apart the logic of the Cholesky decomposition types to accommodate this one case seems a bit drastic to me. |
I agree that it makes sense to keep the lapack call in one place, it is just that the constructor may not be the best place for it. It seems that there is still some debate about the distinction between constructors and I guess ultimately it comes down to whether one would ever want to construct a factorization (without creating a new type) by a method other than a call to the lapack functions, and this was one possible example. |
Perhaps one solution would be a separate constructor with syntax However, I'm not entirely convinced that this issue is a problem: if you have the separate factors, can't you just use them directly? Is there a circumstance where bundling them into a factorization object makes your life significantly easier? That said, I'm not opposed to having this, since I don't think this would break anything or prevent future extensions. |
Well the main use is that it would allow the use of the methods of the factorization, without having to reimplement them. For example, to get a sample from an inverse Wishart, you can just call Admittedly, this is not a huge problem (one of the fantastic things about julia is that calling |
I agree with Simon. If you bother to make the Cholesky factorization easy to use, you might as well make it easy to use in this case too. |
Resolved by f6bfc32 |
If I have an upper-triangular matrix
U
, there is no method by which I can wrap it in aCholeskyDense
type easily. An example use case is sampling from a Wishart distribution using the Bartlett decomposition.There was some discussion in #1374, where the best alternative was to construct the type with a 1 by 1 array, and then replace factor:
However this seems suboptimal, as it still requires calling the lapack code, the result of which is discarded.
One solution might be to remove the computation from the constructor, and move it to a
convert
call. This may be relevant to the discussion ofconvert
and the idiom of constructors in #1470.The text was updated successfully, but these errors were encountered: