-
Notifications
You must be signed in to change notification settings - Fork 2
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
Types and broadcast #15
Comments
I think I see where this is going. If you/we get this to work efficiently SvRx will seem like magic :) |
It is the inner loop brings that biggest benefits, numpy arrays as leaves in the data tree does that. |
Exceptions from data matching in Sverchok.
Both are quite usable exceptions, but are they worth being exceptions? I am not convinced either way. |
Matching as described above doesn't work everywhere, it ties together with the type system, [*] But for some reason it escaped me for a short while. |
not sure I understand why matching would need to happen between Verts and Edges. Maybe automatically cull those edge keys that refer to vertex indices that are higher than len(Verts)? Seems like a heavy op. Mostly I think we'll want to have checks in place to avoid creating out of bounds indices, difficult... it seems like whatever you do it will slow down things. At least for one execution.. |
Maybe the system can behave in a way like the Display list of openGL. first do a slow check, then save some information about the state.
meaning that if the check was run once, and subsequently executed ok, and the tree hasn't updated in some respects compared to the previous execution, then take the leap of faith . |
I dunno. maybe the find max value of nparrays is still faster than all the 'paranoid' checking code we could throw at it... |
i don't know if it's fast to do ' make a view of the current nparray that ommits all rows which contain values above x ` |
The type of check of course matters a lot. In creating a mesh some safety checks sooner or later will be needed of course, as late as possible, opengl viewer or mesh creation. I have some ideas about minimizing the tree rebuilding needed. Of course no automatic matching needs to happen between edges and vertices, in weak moment I didn't consider this and was surprised when things didn't work out... But it would be nice if the system could take care of matching as needed. Some info is needed for the nodes, a first sane step could be automatic matching between sockets of the same type. This should be possible to override in different ways. |
more types we have more i disoriented. Numpy with python and different python and munpy. and tree check in case of python data, but storing tree structure in case of numpy data... |
Yeah I also got a bit confused. |
I look forward to writing nodes again. :) |
hope you know what to do, @ly29 . I believe in you. |
Going with to motto don't be afraid to start over I will start with this following structure in mind, not all of implemented directly. I am sure there will be reason to amend and change things.
A tree manipulation node has to be aware of the data structure and the data type, but looking a some layouts most level finding seems to be to find the right leaves to work with. Of course some manipulations makes sense only in certain context. I have some additional ideas about whole thing but will let form a bit more. |
topology is it polygons with edges? than >n4 needed. |
@nortikin
I am not sure if I follow this. an object can either be decomposed and acted upon in its independent parts or composed and be a higher order, like a mesh. anyway, this is for the experiment. if it fails, we change it. |
@ly29 I SEE SKETCHUP EXAmple in front of me, they made splines, mesh and nurbs the same edit principle, so user can make his own, not looking to format. Is it correct way of doing? if we plug i.e. one bmesh and than operating inside node with decompose/compose, so every node can eat bmesh and output it. Objects operations it is other principle at all, Sketchup has not idea of pivot point (origin), wich makes it harder to model. Maybe we really should delegate conversion of formats to user... PS. |
I disagree, but I will experiment and we can look at it. there are many useful deviations from the three socket types, like text output etc which is wrapped in crazy way. How the object and mesh sockets issues where handled and the nodes dealing with them is less than optimal in many ways. |
ok, i see. it is stupid for some data indeed. |
Okay, so the obvious solution is having type aliases for numpy functions depending on which socket type it would generate. |
Introduced a simple system of type aliases, thereby breaking everything. Progress. Still have to do simple generics so everything will remain broken for a while. |
import numpy as np
from ..svtyping import Number
def add(x: Number = 0.0, y: Number = 1.0) -> [("res", Number)]:
return x + y
SvRxFunc = [add] |
With bootstrapping done and creating nodes being super easy, the biggest obstacle right now is types and broadcasting.
Types
While
np.ndarray
is the type of a numpy array it does not specify thedtype
of the array nor the dimensions.For our purposes some nodes simply need the arrays of have shape = N,3 or N,4. This should be possible to derive from the type info.
Certain nodes need to be able to work on a list of np.ndarray, or a complete leaf of the data tree.
Basically this is makes us need a more complete type system, supporting at least some limited form of generics to be viable as we introduce more data types...
Luckily such frameworks exist in python.
Broadcasting
Broadcasting as defined in numpy.
Broadcast
Furthermore non existent dimensions are implied.
A simple check would be some like this.
Failing this check the arrays would be expanded according to the list match rules defined in Sverchok but being aware of the numpy concept. With the default being
match_long_repeat
but with cycle and match shortest being available. Forcing a match type could be as simple as introducing a node on link with the node being interpreted as changing the match type on the relevant elements. (Of course complete data three matching should also be possible)Sockets
Of course the socket ties into this as well.
The text was updated successfully, but these errors were encountered: