Since your results are dependent on neighbouring values you would need to loop over elements to do this.
If performance is a issue then your best bet would be a custom C++ node.
--
Brent
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Dan Yargici
Sent: 03 January 2012 10:37
To: soft...@listproc.autodesk.com
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
OK, yes, sorry, it seems my first example contained an alternative pattern!
I was beginning to think as much regarding the repeat node... oh well, I guess I'll just have to suck it up... :/
Thanks for all your time Jens.
DAN
On Tue, Jan 3, 2012 at 12:29 PM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>> wrote:
Ok then it's more tricky :)
I'm afraid I don't have the time to help you right now but you probably need a repeat node...
/Jens
On Tue, Jan 3, 2012 at 11:01 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com>> wrote:
In that example I want a result like this:
0,0,3,3,3,7,7,12,12,90
into
0,0,1,1,1,2,2,3,3,4
On Tue, Jan 3, 2012 at 11:54 AM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>> wrote:
Yes that looks correct. Or isn't it the result that you were after?
/Jens
On Tue, Jan 3, 2012 at 10:42 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com>> wrote:
At the risk of embarrassing myself even further......
On Tue, Jan 3, 2012 at 11:28 AM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>> wrote:
Hehe divide by 2 :)
/Jens
--
Jens Lindgren
--------------------------
Lead Technical Director
Magoo 3D Studios<http://www.magoo3dstudios.com/>
--
Jens Lindgren
--------------------------
Lead Technical Director
Magoo 3D Studios<http://www.magoo3dstudios.com/>
That is a pretty neat solution Martin. The ICE tree is constructing some big intermediate arrays and probably doesn't scale well for multiple-threads. Therefore I would still wager that a single-threaded custom node would be the fastest solution. Or maybe I have just opened myself up to be proven wrong again... ;-)
--
Brent
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin Chatterjee
Sent: 03 January 2012 13:33
To: soft...@listproc.autodesk.com
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
Dan,
long time no see - hope you're well!
I just played around with this a bit and came up with this: (screenshot and compound is attached)
This is what you're after, right? It doesn't use any loops - however I did not test performance on huge data sets. Hope this helps - and if you find the time please let me know how well of bad it performs in comparison to your looped solution.
Cheers, Martin
--
Martin Chatterjee
[ Freelance Technical Director ]
[ http://www.chatterjee.de ]
On Tue, Jan 3, 2012 at 11:40 AM, Brent McPherson <Brent.M...@autodesk.com<mailto:Brent.M...@autodesk.com>> wrote:
Dan,
Since your results are dependent on neighbouring values you would need to loop over elements to do this.
If performance is a issue then your best bet would be a custom C++ node.
--
Brent
From: softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com> [mailto:softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com>] On Behalf Of Dan Yargici
Sent: 03 January 2012 10:37
To: soft...@listproc.autodesk.com<mailto:soft...@listproc.autodesk.com>
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
OK, yes, sorry, it seems my first example contained an alternative pattern!
I was beginning to think as much regarding the repeat node... oh well, I guess I'll just have to suck it up... :/
Thanks for all your time Jens.
DAN
On Tue, Jan 3, 2012 at 12:29 PM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>>> wrote:
Ok then it's more tricky :)
I'm afraid I don't have the time to help you right now but you probably need a repeat node...
/Jens
On Tue, Jan 3, 2012 at 11:01 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>>> wrote:
In that example I want a result like this:
0,0,3,3,3,7,7,12,12,90
into
0,0,1,1,1,2,2,3,3,4
On Tue, Jan 3, 2012 at 11:54 AM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>>> wrote:
Yes that looks correct. Or isn't it the result that you were after?
/Jens
On Tue, Jan 3, 2012 at 10:42 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>>> wrote:
At the risk of embarrassing myself even further......
I knew as soon as I posted that someone would prove me wrong. ;-)
That is a pretty neat solution Martin. The ICE tree is constructing some big intermediate arrays and probably doesn't scale well for multiple-threads.
Therefore I would still wager that a single-threaded custom node would be the fastest solution. Or maybe I have just opened myself up to be proven wrong again... ;-)
Martin solution is very good as it doesn't need any custom nodes :). It is always nice as the compound will always work on the farm or on any Softimage version for example.
But...
... as Brent said it would be (MUCH) faster and memory efficient to use a single custom ICE node, as you will be able to use just one very simple loop (and also it will dramatically reduce the number of function calls).
It all depends on your needs. If you are going to do this array operation on millions of particles for each frames, the compound is not really a good option.
A custom node would just loop through the array and increment a variable if array[i] != array[i-1]. So it would be extremely fast.
For the multithreading question, Martin compound is already multithreaded by ICE as array nodes can be used per components. That means that several threads will be used if the context is not singleton ;).
But as the custom node would also be multithreaded by default, it would still be a big winner.
Cheers,
Guillaume Laforge
From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin Chatterjee
Sent: Tuesday, January 03, 2012 10:11 AM
To: soft...@listproc.autodesk.com
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
Hi Brent,
I knew as soon as I posted that someone would prove me wrong. ;-)
That is a pretty neat solution Martin. The ICE tree is constructing some big intermediate arrays and probably doesn't scale well for multiple-threads.
Yeah, that's why I'm not too sure if this scales/multi-threads well. I don't have the time to test this - but hopefully Dan can comment on this some time.
Therefore I would still wager that a single-threaded custom node would be the fastest solution. Or maybe I have just opened myself up to be proven wrong again... ;-)
I think most probably you're absolutely right with this assumption. However I've seen ICE to multi-thread so freakingly well in some scenarios where I'd have sworn beforehand that compiled C++ would definitely win...
Cheers, Martin
--
Martin Chatterjee
[ Freelance Technical Director ]
[ http://www.chatterjee.de ]
From: softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com> [mailto:softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com>] On Behalf Of Martin Chatterjee
Sent: 03 January 2012 13:33
To: soft...@listproc.autodesk.com<mailto:soft...@listproc.autodesk.com>
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
Dan,
long time no see - hope you're well!
I just played around with this a bit and came up with this: (screenshot and compound is attached)
This is what you're after, right? It doesn't use any loops - however I did not test performance on huge data sets. Hope this helps - and if you find the time please let me know how well of bad it performs in comparison to your looped solution.
Cheers, Martin
--
Martin Chatterjee
[ Freelance Technical Director ]
[ http://www.chatterjee.de ]
On Tue, Jan 3, 2012 at 11:40 AM, Brent McPherson <Brent.M...@autodesk.com<mailto:Brent.M...@autodesk.com><mailto:Brent.M...@autodesk.com<mailto:Brent.M...@autodesk.com>>> wrote:
Dan,
Since your results are dependent on neighbouring values you would need to loop over elements to do this.
If performance is a issue then your best bet would be a custom C++ node.
--
Brent
From: softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com><mailto:softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com>> [mailto:softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com><mailto:softimag...@listproc.autodesk.com<mailto:softimag...@listproc.autodesk.com>>] On Behalf Of Dan Yargici
Sent: 03 January 2012 10:37
To: soft...@listproc.autodesk.com<mailto:soft...@listproc.autodesk.com><mailto:soft...@listproc.autodesk.com<mailto:soft...@listproc.autodesk.com>>
Subject: Re: Tuesday morning ICE brain-fart/brain-teaser...
OK, yes, sorry, it seems my first example contained an alternative pattern!
I was beginning to think as much regarding the repeat node... oh well, I guess I'll just have to suck it up... :/
Thanks for all your time Jens.
DAN
On Tue, Jan 3, 2012 at 12:29 PM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>>>> wrote:
Ok then it's more tricky :)
I'm afraid I don't have the time to help you right now but you probably need a repeat node...
/Jens
On Tue, Jan 3, 2012 at 11:01 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>><mailto:danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>>>> wrote:
In that example I want a result like this:
0,0,3,3,3,7,7,12,12,90
into
0,0,1,1,1,2,2,3,3,4
On Tue, Jan 3, 2012 at 11:54 AM, Jens Lindgren <jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com><mailto:jens.lin...@gmail.com<mailto:jens.lin...@gmail.com>>>> wrote:
Yes that looks correct. Or isn't it the result that you were after?
/Jens
On Tue, Jan 3, 2012 at 10:42 AM, Dan Yargici <danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>><mailto:danya...@gmail.com<mailto:danya...@gmail.com><mailto:danya...@gmail.com<mailto:danya...@gmail.com>>>> wrote:
At the risk of embarrassing myself even further......