1:36 AM

2:00 AM
@Rojo What is facebook? I'm chinese, I don't do any facebook! XD

@Rojo Wow great art! (Though I will be heartbroken if it were my book :)

@Silvia :). They just posted your nice snowflake post of the Community

@Rojo Thanks for letting me know :) I have shared it :) (But officially I remain unaware of facebook!)

@Silvia I see your unoficial like

2:09 AM
@Rojo ;)

2:21 AM
My mom just saw my snowflakes, and she thinks it would be nice to turn them into fabrics or lace :)

@Silvia With the fractal sewing machine?

@halirutan Then I will sell the machine instead hehe
@halirutan But I think it's possible to code a program to automatically design the sewing, even to control a machine to realize it.

3:10 AM
@Silvia Yes, I believe this already exists.

3:34 AM
@halirutan And the fractal version, too?

@Silvia Ahh, you were speaking about the fractal version. Nope, I think even the good old German engineers will run into problems with that :-)

2 hours later…
5:12 AM
@Mr.Wizard Any chance you are around?
@MichaelE2 Hi.

5:34 AM
@halirutan I am now; are you?

@Mr.Wizard Hi. Fine. Hope you are well too :-)
@Mr.Wizard Are you aware of a post here which investigates in the details of vector setting an array? Like the following:
```a = {1, 2, 3, 4};
a[[{3, 4, 2}]] = {0, 0, 0};
a```

@halirutan To be clear, what output do you want from that?
Sorry, I guess what I really mean is I don't understand what you're asking. :^)

@Mr.Wizard I want to set the positions {3,4,2} in a set to zero

Right... so what's the question?
Ah, "investigates the details" -- is there some aspect of this that is troubling you?

@Mr.Wizard It seems that in compiled functions, this idiom like `result[[pos]] = newValues;` where `pos` is a list, is significantly slower than a stupid `Do` loop setting the values manually.
@Mr.Wizard Although, the vector set compiles down to only one call:

5:39 AM
I don't dabble much in compiling so you're asking the wrong guy. However, if I think of or find such a discussion I'll try to let you know.

@Mr.Wizard Yep, that's all I asked. You have a far better overview. Thanks!

OK. At the top level that operation is very fast I believe. Would it be practical for you to make an external call for that part of your code?
(I cannot recall how much copying overhead that would imply.)
@halirutan Does your application call for a list of new values or a single new value? If the latter have you tried e.g. `ReplacePart[{1, 2, 3, 4}, 0, {{3}, {4}, {2}}]`?
@m_goldberg are you available?

6:00 AM
@Mr.Wizard The use-case here is to fill an empty array at specific places: {0,0,0,0,0}, {11, 12}, {2,5} -> {0,11, 0, 0, 12}.
```Compile[{{in, _Integer, 1}, {pos, _Integer, 1}},
Module[{result = Table[0, {Length[in]}]},
result[[pos]] = in;
result]]```
The above is a minimal example showing that this is slower than
```Compile[{{in, _Integer, 1}, {pos, _Integer, 1}},
Module[{c = 1, result = Table[0, {Length[in]}]},
Do[result[[p]] = in[[c++]], {p, pos}];
result
]]```
Here is a small working example showing that the smart method with vector set is slower than the stupid method using a Do-loop.
I get the timings 2.28 s compared to 1.81 s here. The Do-loop copy runs with 79.5% of the vector set.
(me, away for some minutes. Breakfast)

6:19 AM
@halirutan In version 7 your first (smart) function is three times faster than your second one. Of course in v7 there is no compile-to-C so I am using the versions you posted here in Chat.
For reference, with the first function as `cf1` and the second as `cf2`:
```a = Range[1*^7];
b = RandomSample[a];
cf1[a, b] // AbsoluteTiming // First
cf2[a, b] // AbsoluteTiming // First```
> 0.2870164

> 0.7220413
(Okay, 2.5X faster.)

6:32 AM
@Mr.Wizard Yes, same here when I only run it using the MVM and not C-code.

6:44 AM
Could someone explain why my comment [here] is valid? :P tags: DynamicModule, Scoping
Hello @halirutan :)

@Kuba Hi.

@halirutan maybe you can explain that? :)

7:13 AM
@halirutan I think you'd need to see the definition for int (*MTensor_setPart)(MTensor *, MTensor, mint, int *, void **); in WolframCompileLibrary.h

@MichaelHale Yes, but sometimes people here already did a lot of digging and often they find things even without the actual code.

I just know CompilePrint and CCodeStringGenerate.
In MVM it is left as Part[ T(I1)3, T(I1)1] = T(I1)0
In C it is just funStructCompile->MTensor_setPart(T0_ 0, *T0_ 3, 1, S0, S1);
I wouldn't know how to dig deeper.

7:42 AM

@halirutan hmm, yes

@Kuba Without putting `show` in the scope.

@halirutan I see, but SetDelayed instead of Dynamic

One of the issues was that `show[1]=...` was evaluated before the local t ever got a value.
@Kuba Yes, and there was a double Dynamic.

@halirutan I've noticed that but I didn't know why.

7:45 AM
@Kuba One smaller example is
```DynamicModule[{value},
f[0] = Plot[x, {x, -2, value}];
f[1] = Plot[Sin[x], {x, -2, value}];
Column[{
Framed@Toggler[Dynamic[value], {0, 1}],
Dynamic[value],
Dynamic[f[value]]
}]
]```

@halirutan It's not the case, OP's example got a value in declaration of variables for `DM`

@Kuba If you now put `f` in the local scope, then the dependency of `value` there is tracked and updated correctly.

@halirutan and if you put here `value=1` it will work.

@Kuba But he has t=0.001 which is not larger then the minimum plot limit in the call.

@halirutan yes, but that's only the reason of errors, and it is not related with no updating, is it?

7:50 AM
@Kuba Yes. To me, it is not obvious why initialization of value makes a difference.

@halirutan I'm so sad :( I know how to make a proper `DM` but when people ask why their approaches fail, very often I have no idea :P

@Kuba Additionally, I (personally) hate to fiddle around with those details. To me, all the dynamic stuff is completely different than the core language. Where the core is really intuitive, even more complicated paradigms, the dynamic stuff often leaves one without a clue.

@halirutan There are multiple of exceptions which make Dynamic programming horrible in terms of logical approach :/ But I can agree that those exceptions are a must, the problem is, those are silent, sometimes found in tutorials, sometimes not but mentioned in possible issues etc.
I think there is a lack of good tutorial about creating `DM` in context of dynamic gui. And I don't mean "this is how you should do this" but rather "this is the way and take a look at deviations you can make and at thos you can't and why"

8:48 AM
Putting value=1 doesn't make it work. Then both plots go to 1 instead of one plot going to 0 and the other going to 1. f is owned by the kernel so it can't get the new value for value when it changes. When you put f in the DynamicModule then it can switch the plot range.

@MichaelHale are you talking about halirutan's example?

Yes

why do you think one plot should go to 0 and the other go to 1
oh
ok
:p

Well, I guess it depends on what you want for what works, but putting {value=1} and {value,f} behave differently.

@MichaelHale Indeed, I'm scoping everything

8:53 AM
Because in the first f is owned by the kernel so it can't get updates from values local to the DM.

@MichaelHale it is generally not good idea to make functions that depends on variables that are not defined, better to make `f[a_, b_]`

@MichaelHale There are several other alternatives:
```DynamicModule[{value},
Dynamic[
f[0] = Plot[x, {x, -2, value}];
f[1] = Plot[Sin[x], {x, -2, value}];
Column[{Framed@Toggler[Dynamic[value], {0, 1}], Dynamic[value],
Dynamic[f[value]]}]]]```
Or
```DynamicModule[{value},
Column[{Framed@Toggler[Dynamic[value], {0, 1}], Dynamic[value],
Dynamic[f[value]]}],
Initialization :> (f[0] = Plot[x, {x, -2, value}];
f[1] = Plot[Sin[x], {x, -2, value}])]```

Those mean different things and behave differently.

@MichaelHale Yes, the first one is basically what `Manipulate` does and the last one is how the documentation suggests it.
Although the Docs seem to always localize the symbols in `Initialization`.

The documentation suggests it for which situations? It depends on what you want. In the first f is updated each time the toggler is clicked, and in the second f is only updated once.

9:07 AM
@MichaelHale Ah OK, this example wasn't for such deep considerations.

9:37 AM
I don't get folks that are posting questions and go offline immediately.

10:28 AM
@JacobAkkerboom Hi!

@Kuba hello :)
How are you?
I reached 5k! There will be wonderful tag wiki's everywhere :P

@JacobAkkerboom Great, do something about that!
@JacobAkkerboom so so :P my master thesis is... well isn't :P and I should finish it till July :p

@Kuba ahh yes, thesis troubles. Tell you what I am also having thesis trouble

so it's a common thing. they should ban this!

Hehe, yeah maybe they should :)
@Kuba I wish I didn't have to write a thesis, then I would have an unbiased opinion ;).

10:36 AM
:)

@Kuba do you have an interesting subject?

@JacobAkkerboom I think so but I've chosen theoretical way, I was ambitious... I should've start from simulations and focus on that. This is what I want to learn anyway :)
@JacobAkkerboom and now I decided to do the simulations but it is quite late :) I'm going to try anyway :)
@j
@JacobAkkerboom and what's the problem with yours?

@Kuba I did some simulations, but the models I used were very ad hoc. Now I am looking at some more theoretical stuff. Quite the other way around I suppose :)

@JacobAkkerboom I see :)

11:03 AM
@JacobAkkerboom I whish you luck :) now I have to get back to duties. Have a nice day.

@Kuba same to you! If your duties is thesis stuff, then double luck :) :P

@JacobAkkerboom I wish but unfortunately not :( :p

@halirutan It's nice to use a `SetDelayed`, but I think `PassEventsUp -> True` is unnecessary. (I think the two `EventHandler`s can be merged.)

Good to see you can still wish you could work on your thesis :). Cheers!

11:20 AM
@Silvia I didn't touch the code of the OP except for the SetDelayed and the additional Dynamic..

@Silvia No, of course not.

@halirutan Always nice to study Dynamic stuffs from you people!

@Silvia Usually, I try to make dynamic content selfcontained so that it still works even when the kernel quits.
Sometimes it is of course not wanted because the overhead is too large.

@halirutan Good point.. I usually delete all dynamic cells before save :D

2 hours later…
1:23 PM
OK, I need to rant.. anywhere.. wtf??
Let me tell you: Steve Jobs is really dead. Really. He must be dead, otherwise such things would never happen.
Today my MacPro arrived and you know what? The 4K display doesn't fit into the MacPro. The Apple Online Store sells it this way although there is one tiny sentence in the display description:
It says something like "HDMI Input is not available for the European market" and yes (!!) I have seen it and asked my reseller whether this means that I cannot use the 4K here. He told me that it is fine.
Now I'm left here with the wrong HDMI cable and something like this wouldn't have happen in former times. And this for the price of a car.

2:01 PM
@Mr.Wizard. I'm available now.

2 hours later…
3:40 PM
@Mr.Wizard. Going, now. Sorry we couldn't talk.

@halirutan I thought that display would be used through DisplayPort.

4:04 PM
@kirma Yes, what I wrote was a bit confusing.

@halirutan There is some relevant discussion here, I believe. In short, my guess is that the slow-down is due to a massive allocation of small arrays on the heap.

Sorry.

@halirutan When you do assignments in place, element-by-element, there aren't CopyTensor instructions in the loop, rather the modifications are done in-place - thus much faster.

@LeonidShifrin I did some tests in the meantime and it seems setting of (all) elements in a vector is faster with a loop if the vector-length is smaller than about 30. For larger vectors, the `v[[{p1,p2,...}]]=...` method is faster.

@halirutan Yep. If you read my answer there, I tried to speculate why is that. Basically, at some point, the cost of massive assignment becomes larger than the const of heap allocation.

4:08 PM
@kirma The monitor has a DisplayPort input (but no HDMI), therefore it cannot be directly connected to the MacPro.

@halirutan The heap allocation overhead is most pronounced for a bunch of small allocations.

@halirutan Sure, no problem. How are you, by the way?

@LeonidShifrin At the moment tired because I'm up since aehmm 19.5 hours. Pissed of because I really wanted to try my new Mac. But otherwise very well as usual :-)

@halirutan Sorry about your Mac. I agree, this wouldn't have happened a few years back.

4:12 PM
@LeonidShifrin Btw, house is growing very fast. Next week the building of the second floor starts.

@halirutan That's great! You should share some photos, or at least make sure you make them, to keep some memory of the process.

@LeonidShifrin We keep photos from every detail. I'm sure I manage to send you and update mail in the next days.
(I planned this anyway )

@halirutan Sounds good! I planned to write to you myself. So, looking forward! And, good luck with your Mac, I really hope this problem will somehow be resolved.

@halirutan support.apple.com/kb/ht5918 ... sure you tried on Thunderbolt ports already?

@halirutan I am myself using MacBook Pro, and like it a lot - it would be a shame is their standards of quality will get lower and lower. Such a great technology, would be a shame if it gets wasted.

4:20 PM
As far as I understand, those connectors are dual-use DisplayPort/Thunderbolt.

@LeonidShifrin @kirma It seems I need an DisplayPort-Thunderbolt adapter.

@halirutan I think this is quite common - I had to buy one too

@LeonidShifrin @kirma but, and this is the great but, for a computer >10k euro I want everything included.

@halirutan Very understandable

@halirutan Hmmmh. I'd say a cable, rather than a separate adapter... at those bitrates, I wouldn't use adapter. Interesting if they don't ship compatible cable, though!

4:22 PM
@kirma yes, I meant one of those things:
OK, I'm out. See you all!

@halirutan See you!
I am out too.

5:08 PM
hey hi there

5:31 PM
@m_goldberg It's nothing important anyway, but if you happen to be here now let me know.
Hello @CoolEuler
Hello @Sjoerd

@Mr.Wizard hi wiz

:-)

how yer doin?
enjoying the outdoors?

@Sjoerd Sorry, I was reading a moderator message written by someone who's first language isn't English.
I'm doing pretty well, and yes I have been enjoying the outdoors. We've had great weather this past week. How about you?

It has been relatively warm the last couple of months. Hardly a winter to speak of, and spring is looking good too.
Tomorrow, I'll have my telecommuting day and I think I'll spent part of it reading my work stuff outside

5:44 PM
Is there any downside to hardly any winter? Any concern of a drought etc.?

Well, many people here would say "no skating"

When you get a very cold winter the canals freeze, correct?

Yep. We have a famous skating tour along 11 cities in the northern part of the country. It's about 200 km, and a rather grueling event. Last century, weather allowed for only about 15 of those tours
but only 3 in the last 50 years

200 km! The legs burn at the thought.

Depending on the weather it takes between 7 and 12 hours (for the winner)
Sometimes, of the 16000 people starting only 69 manage to finish

5:51 PM
When there's no ice you can send a team here: leadvilleraceseries.com/run/leadvilletrail100run :^)

awesome
Something you're into? ;-)

Hardly. I do well to make it five miles. I still cannot comprehend such things.
And I mean five miles hiking, not running!

Are you close to a hiking area or do you need to take a ride first?

one moment
@SjoerdC.deVries I'm within day-trip distance of this: portlandhikersfieldguide.org/wiki/Columbia_River_Gorge_Hikes
Sorry it took so long to find the page I was looking for.

that's in miles and feet, right?

6:00 PM
@SjoerdC.deVries Correct.

@Mr.Wizard Have you ever done something like the Mark O. Hatfield Trail?

@SjoerdC.deVries Certainly not. I have a back condition that limits me; I try to keep things to five miles round trip. Fortunately there are a lot of beautiful options nevertheless. And I think I'll push myself to do this one this year.

We intend to visit NW US somewhere in the next few years. I probably could manage this but my wife has a hip problem
So, we probably would be parking lot- tourists

hi..

@SjoerdC.deVries I'm glad, and I'm sorry. How much can she manage?
welcome back @Cool

6:06 PM
1-2 miles
Hi @cool

hi....

@SjoerdC.deVries With mild elevation or flat? What about short and steep, e.g. 1/4 mile but 200 ft up?

got negative rep... n have no idea why...
can u direct me towards ans 2 question...

@Mr.Wizard Climbing is difficult for her.
@cool which question?

-1

Is it possible to get a max K-coverage problem solution(s) and/or number of possible solutions in Mathematica? Additionally ...When items of subset to be must cover is given Its NP-Hard problem, but a approximation solution ll be a great

6:11 PM
@SjoerdC.deVries If make it to the Columbia Gorge area I can help you put together a list things that should be possible. If she can push for one hike I can't think of a better one than the one I did no Sunday: Wahclella Falls Hike. It has limited elevation and none of it too steep, and it's two miles total.
You've got my email I believe. Let me know if/when I can help.

@CoolEulerProject It's probably because you don't show much effort yourself. There is neither a good starter in code, nor a good exposé of the question itself.

ok...

@Mr.Wizard @SjoerdC.deVries I agree that hiking in the NW US is great. I went to the Columbia Gorge a lot. One of my favorites was in Washington on the Olympic Peninsula, there was a hike that had an old airplane crash from the 50s at the top of a mountain you could go see.

ll work out that... thanks...

6:13 PM
@MichaelHale That's from the 50's crash?

@MichaelHale I have never made to to the O.P. but I'd like to this year. What are some highlights?

Yeah. I thought it looked like Dagobah from The Empire Strikes Back.
I only did two hikes on the OP, but they were both great. I just used the Washington Trails Association site to find things and make sure the conditions were good.

How's the weather in July?

Summers are awesome out there.

I always associated the NW with rain and drizzle

6:16 PM
In the Cascades I did Mt Si, Blanca Lake, Snow Lake, one or two others.
Mt Si is pretty popular, but I went with a lab group from Univ of Washington so the conversation distracted you from the extra people.

@Cool I see that your question has also picked up three close votes. Though I don't agree with the close reason myself I do think at present it is too broad. While isn't not unreasonable to wonder if there is some built-in function to address the problem, if there is not you're asking for too much and without focus. Perhaps you could pick a specific algorithm you wish to implement, then ask for help with that?

We may be going in 2015. Probably starting somewhere around Seattle, then in the direction of Yellowstone and back to the coast again.

@SjoerdC.deVries We have enough people already out here so, sure, "It's nothing but rain and drizzle." (Unofficially it's amazing from May through September... shhhh.)

6:21 PM
@SjoerdC.deVries Can you make it as far south as northern California? I wouldn't miss Yosemite.

@Mr.Wizard been there, done that

My old camera phone was low enough quality that it automatically added an oil painting effect.

@MichaelHale Is that Glacier NP?

@Mr.Wizard 1996

6:22 PM
@SjoerdC.deVries Good. Great, isn't it? :-)

No, went there when I was younger though. That is just Blanca Lake east of Seattle in the first.
The second was by a one room, wood heated cabin in Oregon where I spent a night.

@MichaelHale Thanks, I've never heard of it. It looks like a small Lake Louise, so I thought maybe Glacier.
@MichaelHale I hope you had good company that night. ;-)

@Mr.Wizard It was. We made a grand tour of the SW then. SF - Yosemity - Sequioia - Snow Canyon - Death Valley - Vegas - Bryce Canyon - Grand Canyon - Tucson - LA

Ah. I was too young to remember specific places in Glacier, but I remember some goats and more snow than I'd seen in my life to that point.
Company could have been better actually. It was a long, cold night with a couple of guys who came to visit me from Georgia.

Speaking of, have either of you been to Banff? I never have, but my mother loved it.
@MichaelHale Heh. There goes that fantasy. ;-p

6:29 PM
I haven't, but I've heard it's nice.

Just to Vancouver a couple of times, and Alaska on a cruise once.

@SjoerdC.deVries Yes. Perhaps you should look it up. It does look amazing.

Closest I got to Canada must have been the Niagara falls
Or perhaps Chicago

@Sjoerd Of course you've got Switzerland etc. closer to you, so perhaps not as extraordinary as that landscape seems to me.

6:35 PM
Yeah, but I think the population density in NW US and Canada is much lower than Europe, so it is easier to get the feeling of being away from everything. I haven't actually been though. The Alps do look great in pictures.

OK, I'm signing off for a while, but good talking with you both!

Ok, you too.

@Mr.Wizard Indeed. With the NW done, we would have rounded up (sic) the four corners of the US. We won't be seeing the great plains, but that's just Holland, only hotter and bigger.
@Mr.Wizard OK, bye!

When I moved from Atlanta to Seattle I drove, so I saw enough of the great plains to last me for a while.