Thread: [ojAlgo-user] question re: custom MatrixStore<>
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Jonathan S. <jo...@ma...> - 2018-01-05 20:07:40
|
I have created a custom matrix store, that in addition to managing access into the matrix as per the API supplies some additional functionality I need. My intention is to use it as a 1st class matrix class as a starting point in linear alg computations. However, I've noted that the MatrixStore<Double> interface implements only a subset of the operations that, say, PrimitiveMatrix exposes. For example I cannot directly call invert() on the matrix store, though I can multiply and call a number of other operations directly. If I want to extend the matrix class API, I thought creating a new MatrixStore would be the approach, but it seems that there is a more complex hierarchy of MatrixStore, PhysicalStore, AbstractMatrix, etc which I have not been able to figure out to integrate with. My Questions: 1. If I want to expose invert and other methods in my custom matrix, what is the best approach to doing so? 2. If MatrixStore is not the best way to create custom Matrices, what should the approach be. I recognize that MatrixStore most likely refers to the storage / access functionality rather than matrix ops. I would like to be able to bundle both Am stuck at this point. Any pointers greatly appreciated. --- Jonathan Shore |
From: Anders P. <an...@op...> - 2018-01-05 22:44:21
|
Not sure I understand what the problem is. Why can’t you just implement everything you want in that matrix class of yours? /Anders > On 5 Jan 2018, at 20:42, Jonathan Shore via ojAlgo-user <oja...@li...> wrote: > > I have created a custom matrix store, that in addition to managing access into the matrix as per the API supplies some additional functionality I need. My intention is to use it as a 1st class matrix class as a starting point in linear alg computations. > > However, I've noted that the MatrixStore<Double> interface implements only a subset of the operations that, say, PrimitiveMatrix exposes. For example I cannot directly call invert() on the matrix store, though I can multiply and call a number of other operations directly. > > If I want to extend the matrix class API, I thought creating a new MatrixStore would be the approach, but it seems that there is a more complex hierarchy of MatrixStore, PhysicalStore, AbstractMatrix, etc which I have not been able to figure out to integrate with. > > My Questions: > > • If I want to expose invert and other methods in my custom matrix, what is the best approach to doing so? > • If MatrixStore is not the best way to create custom Matrices, what should the approach be. I recognize that MatrixStore most likely refers to the storage / access functionality rather than matrix ops. I would like to be able to bundle both > Am stuck at this point. Any pointers greatly appreciated. > > --- > Jonathan Shore > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |
From: Jonathan S. <jo...@ma...> - 2018-01-05 23:47:07
|
Rather than provide all of the context, quite simply if I create a class that implements MatrixStore<Double> the newly created class does not have the same set of operations that the AbstractMatrix class provides (such as invert()). Is MatrixStore<> the correct way to create an extensible matrix class? Secondly, is there a way to get the missing operators on the class through inheritance or something like that? On Fri, Jan 5, 2018 at 5:44 PM, Anders Peterson <an...@op...> wrote: > Not sure I understand what the problem is. Why can’t you just implement > everything you want in that matrix class of yours? > > /Anders > > > > On 5 Jan 2018, at 20:42, Jonathan Shore via ojAlgo-user < > oja...@li...> wrote: > > > > I have created a custom matrix store, that in addition to managing > access into the matrix as per the API supplies some additional > functionality I need. My intention is to use it as a 1st class matrix > class as a starting point in linear alg computations. > > > > However, I've noted that the MatrixStore<Double> interface implements > only a subset of the operations that, say, PrimitiveMatrix exposes. For > example I cannot directly call invert() on the matrix store, though I can > multiply and call a number of other operations directly. > > > > If I want to extend the matrix class API, I thought creating a new > MatrixStore would be the approach, but it seems that there is a more > complex hierarchy of MatrixStore, PhysicalStore, AbstractMatrix, etc which > I have not been able to figure out to integrate with. > > > > My Questions: > > > > • If I want to expose invert and other methods in my custom > matrix, what is the best approach to doing so? > > • If MatrixStore is not the best way to create custom Matrices, > what should the approach be. I recognize that MatrixStore most likely > refers to the storage / access functionality rather than matrix ops. I > would like to be able to bundle both > > Am stuck at this point. Any pointers greatly appreciated. > > > > --- > > Jonathan Shore > > > > ------------------------------------------------------------ > ------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot______ > _________________________________________ > > ojAlgo-user mailing list > > ojA...@li... > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |
From: Anders P. <an...@op...> - 2018-01-06 00:12:44
|
There are no interfaces that define the parts of the BasicMatrix/AbstractMatrix feature set. A move towards such a design has been contemplated - just haven’t done anything about it yet. I’d say that implementing MatrixStore is the right way… and that doesn’t stop you from implementing other interfaces (perhaps something you create) or implementing methods not defined in any interface at all. All functionality of BasicMatrix/AbstractMatrix is implemented in terms of MatrixStore and the various matrix decompositions. A convenient way to access part of their functionally is through the matrix tasks in the org.ojalgo.matrix.task package. Look at how the stuff you want is implemented in AbstractMatrix, and mimic that in your own class. /Anders > On 6 Jan 2018, at 00:46, Jonathan Shore <jo...@ma...> wrote: > > Rather than provide all of the context, quite simply if I create a class that implements MatrixStore<Double> the newly created class does not have the same set of operations that the AbstractMatrix class provides (such as invert()). Is MatrixStore<> the correct way to create an extensible matrix class? Secondly, is there a way to get the missing operators on the class through inheritance or something like that? > > On Fri, Jan 5, 2018 at 5:44 PM, Anders Peterson <an...@op...> wrote: > Not sure I understand what the problem is. Why can’t you just implement everything you want in that matrix class of yours? > > /Anders > > > > On 5 Jan 2018, at 20:42, Jonathan Shore via ojAlgo-user <oja...@li...> wrote: > > > > I have created a custom matrix store, that in addition to managing access into the matrix as per the API supplies some additional functionality I need. My intention is to use it as a 1st class matrix class as a starting point in linear alg computations. > > > > However, I've noted that the MatrixStore<Double> interface implements only a subset of the operations that, say, PrimitiveMatrix exposes. For example I cannot directly call invert() on the matrix store, though I can multiply and call a number of other operations directly. > > > > If I want to extend the matrix class API, I thought creating a new MatrixStore would be the approach, but it seems that there is a more complex hierarchy of MatrixStore, PhysicalStore, AbstractMatrix, etc which I have not been able to figure out to integrate with. > > > > My Questions: > > > > • If I want to expose invert and other methods in my custom matrix, what is the best approach to doing so? > > • If MatrixStore is not the best way to create custom Matrices, what should the approach be. I recognize that MatrixStore most likely refers to the storage / access functionality rather than matrix ops. I would like to be able to bundle both > > Am stuck at this point. Any pointers greatly appreciated. > > > > --- > > Jonathan Shore > > > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________ > > ojAlgo-user mailing list > > ojAlgo-user@lists..sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/ojalgo-user > > |