-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improve VectorSpace concept #323
Conversation
In particular, you may want to take a look at |
I like this idea very much! I thought at some point that it would make sense to have input, state, and output spaces, and having the BTW, this reminds me that input/output space reduction (i.e. reducing the number of inputs and/or outputs) is also something people do. |
Hi, I do like this change. A suggestion: |
(Python 2 does not delegate __ne__ to __eq__ by default.)
b93b935
to
9cd640a
Compare
…ctor MPIVector and related classes are not used anywhere in pyMOR nor in any known applications. It is probably always preferable to use MPIVectorArray.
Ok, so after some more polishing, this should now be ready to merge. Since this is a pretty deep change, we should still expect a few bug popping up .. @andreasbuhr, after discussion with @ftalbrecht, I decided to keep |
Hi @pmli, you may also want to take a look at the sys-mor-with-new-vectorspaces branch, where I have updated your code to work with the new VectorSpace concept (first commit). I have then replaced the different Not having different operators dicts then allowed me to use Note that I only have tested if the Please let me know if you like the changes overall or if you feel that the new |
Hi @sdrave. I like the changes you made. I don't see anything right now that should be changed further in Although, I must admit I'm not a big fan of using State to input (or output to input) operators could appear in closed loop systems, and there are MOR methods for them, but I haven't looked into them very much. Maybe we can postpone this for later, I think you can open a new PR for the sys-mor-with-new-vectorspaces branch. |
Ok, so To make my original intention clearer: for me, as a PDE guy, there is usually a big difference between state space (a discrete function space) and (possibly) multi-dimensional input/output spaces, which are typically something like R^n, where n is a relatively small number. The distinction whether the input space is one or three-dimensional usually is not as important as whether it is an Euclidean space or a function space. So I would have been fine with using Having considered this a bit more, I would say that this special id is maybe not as needed as I first thought. So, how about defaulting the Only one drawback, which was actually one of the motivations for introducing |
Ok, the good thing is that in systems and control theory there is also a distinction between state, input, and output. So, the I would definitely like to have a more general version of Maybe |
12c7c04
to
3cd3bf9
Compare
and properly implement 'as_vector'
3cd3bf9
to
1b53a70
Compare
and disallow functionals as vectors.
Conflicts: src/pymortests/vectorarray.py
As discussed, I have removed the special To check if a space is a one-dimensional I have implemented the To support, say, multi-input to state operators in Note that I am speaking of 'transposed' and not 'adjoint' operator: I currently have the impression that |
Thinking of the various corner cases I had to consider, I still feel that having something like Implementing something such special spaces later on should be very easy. So I would vote for merging the code in its current state. |
I have difficulty finding places where something like I'm also not sure what you mean by 'function space', 'low-dimensional function space', and 'low-dimensional Euclidean space'. Is the first something like L^2(spatial domain), the second some subspace of the first (e.g. a finite element discretization), and the third the equivalent R^n to the second? Do each of these spaces have a representation in pyMOR? |
Sorry for the delay! @pmli, I have thought some more about this and still have no clear concept of what a 'scalar' should be. There are two places where it would be nice to have something like that:
Overall, however, I am fine with the current situation, so from my POV this is ready to be merged. |
I also ok with merging. Maybe I'll understand things better after using it. |
This pull request contains two major changes to the
VectorSpace
concept:VectorSpaces
are now the factories for newVectorArrays
. Instead of instantiating the array directly, one now writesspace.make_array(obj_to_be_warpped_as_vector_array)
. In particular, to implement a newVectorArray
own now also subclassesVectorSpaceInterface
. This new approach has the following benefits:subtype
concept which was hard to understand by newcomers. In contrast, the idea of aVectorSpace
which can produce vectors contained in itself should be very natural.dim
) instead of a genericsubtype
attribute. Custom implementations of__repr__
are easily possible.VectorSpace
, one can easily add additional data that is relavant in a given mathematical situation (e.g. the subdomain number for localized model reduction), and this data is then also attached (via the space) to all arrays created from the space.Second, every
VectorSpace
has now a stringid
attribute that can be used to distinguish mathematically different vector spaces. The currently used defaultid
is'STATE'
for all function spaces and'SCALARS'
for elements of R^n. In particular, therange
of functionals and thesource
of vectors are tagged as'SCALARS'
. The same would apply to multidimensional input or output operators. This in particular allows to detect the 'kind' (#275, #310) of an Operator without any additional effort. As a consequence, the specialfunctionals
andvector_operators
dicts of theDiscretizations
can go away. The same applies to thess_operators
,is_operators
,so_operators
andio_operators
dicts in @pmli's code.This pull request is still work in progress. In particular, i haven't updated the documentation yet. Before I proceed with the polish, @andreasbuhr, @pmli, @ftalbrecht, please let me know what you think!