det seems to return determinant and not log-determinant
Closed this issue · 10 comments
When I define
A=Rmumps$new(as(diag(3),"dgTMatrix"))
and run
A$det()
I get 1, which means the function returns the determinant and not the log-determinant.
Can this be fixed or are the alternative functions?
Best
Fredrik
Also, how do I use the A$set_mat_data function?
When I define A=Rmumps$new(as(diag(3),"dgTMatrix")) and run A$det()
I get 1, which means the function returns the determinant and not the log-determinant.
Can this be fixed or are the alternative functions?
This has not to be fixed. As the doc help(rmumps::Rmump) says:
‘det()’: Return determinant of the matrix
If you need log-det, take the log of the result.
Also, how do I use the A$set_mat_data function?
If you create a Rmumps matrix from say dgCmatrix as
asparse= as(diag(3),"dgCMatrix")
A=Rmumps$new(asparse)
it has a slot x
containing the data:
> asparse@x
[1] 1 1 1
You can submit just this new vector and preserve the structure of the A:
> A$set_mat_data(1:3)
> A$det()
[1] 6
thanks for your help. Yes, this is much more like a request than a "problem"/"issue". Sorry for that.
Would it be much work for you to make the log-determinant be returned by a function? In my problem the determinant is Inf (overflow).
Would it be much work for you to make the log-determinant be returned by a function? In my problem the determinant is Inf (overflow).
I see. I added log2det() in v5.2.1-29 which returns log2(determinant) (log2 means log base 2). You can try it with
devtools::install_github("sgsokol/rmumps")
If everything is OK, I'll submit it to CRAN.
The problem seems to come from your tar program which fails on untaring process. May be "disk full" problem? Anyhow, the problem is on your side. You can try to clone the rep and install it from the local directory.
Thanks for your suggestion. I cloned the repo, as suggested. Then I did the following steps:
(0) Locate the package root.
(1) Relocate/Move the contents of Makevars.seq to the "ordinary" Makevars-file. Save the file.
(2) devtools::build()
(3) devtools::install()
It now installs successfully :)
Will let you know how the log-det-function works.
I tested the function on a "smaller" problem. Your function and lu, followed by a call of determinant in R on the lu object, returns very similar results. The function therefore seems fine. rmumps is much faster btw. Thanks. Will let you know if any issues arises.
Thanks. On CRAN now.