Closed abhinavmehndiratta closed 5 years ago
This was merged a bit prematurely, but maybe it was necessary so you could use these changes here to continue working? In any case, I think there are still some open thinks here.
This was merged a bit prematurely, but maybe it was necessary so you could use these changes here to continue working? In any case, I think there are still some open thinks here.
Hey, @simonschoelly I merged it because I needed to write some tests in order to proceed but if you have some ideas on improving the interface, I can open another PR or you can comment here itself.
I think it might actually be possible to merge an issue, without closing one, so maybe check if you can reopen this one. Otherwise I think I will still comment here.
So one think I noticed here, is that you are using the error
method. I think it would be better to throw a more specify error, either one that is already in Base
(maybe compare to what these methods throw for other matrices) or by creating your own Exception types.
You can read about that here: https://docs.julialang.org/en/v1/manual/control-flow/#Exception-Handling-1
So have we decided, that we automatically make these matrices/vectors here one-based? We should consider, that this might lead to some confusion when someone mixes the more abstract methods with the more concrete ones.
Not that I am completely opposed to that, but we could also consider the fact, that there are some methods for dealing with non-1 based matrices in Julia Base.
I see that GrB_Matrix
is not a subtype of AbstractMatrix
or AbstractSparseMatrix
. Would it be a good idea to make this so? Then we might gain a lot of functionality for free. We don't have multiple inheritance though, so that would maybe influence the type hierarchy that you already created. You could maybe then use traits for your own functions then.
Another option would be to create a wrapper type, for example (might differ a bit in practice)
struct AsJuliaMatrix{T} <: AbstractMatrix{T}
M::GrBMatrix
end
and then define all the Julia matrix functions on this instead.
@simonschoelly @jpfairbanks