Open translunar opened 8 years ago
Hi! I'd like to take a shot at this. I think I can have something to show within a week or two.
Wonderful! Thanks so much for getting involved. =D
@mohawkjohn Hey! I'm afraid I don't understand what the second parameter of NMatrix::rank is supposed to do, but if I can use that function to calculate the rank of the matrix then rank_deficient? would be really easy to implement.
#rank
basically allows you to iterate along either rows or columns or through the depth of the tensor if it's more than 2-dimensional. So the first argument is row, column, or depth; and the second argument is which one of those. If you do rank(0,1)
, it gives you row 1. If you do rank(1,5)
, it gives you column 5. If you do rank(2,1)
, you get layer 1. Make sense?
@mohawkjohn yep, perfect sense! I ended up using the gesvd to calculate rank. Since this needs the nmatrix/lapacke gem, I have a couple of questions - 1) Is that okay? Or did you want it to be implemented without the lapacke dependency? 2) How can I test the nmatrix functions that require lapacke? The tests that are already in place catch a NotImplementedException, even though I have the nmatrix-lapacke gem installed.
You can run the tests with rake spec nmatrix_plugins=lapacke
which will
require the nmatrix/lapacke gem
On Dec 7, 2015 4:16 PM, "John Marinelli" notifications@github.com wrote:
@mohawkjohn https://github.com/mohawkjohn yep, perfect sense! I ended up using the gesvd to calculate rank. Since this needs the nmatrix/lapacke gem, I have a couple of questions - 1) Is that okay? Or did you want it to be implemented without the lapacke dependency? 2) How can I test the nmatrix functions that require lapacke? The tests that are already in place give me a NotImplementedException, even though I have the nmatrix-lapacke gem installed.
— Reply to this email directly or view it on GitHub https://github.com/SciRuby/nmatrix/issues/411#issuecomment-162666139.
Is using gesvd the most economical way to calculate rank?
@mohawkjohn , well, I know there are a variety of ways to calculate whether or not a matrix is full rank or not; but I thought that SVD was the only way to calculate rank?
Yup, you're right. Had to check my reference. =) Yes, lapacke sounds good.
@mohawkjohn sounds good; i will continue to push on :) @wlevine thanks!
These methods, among others, would be useful for users wanting to check matrix properties.