Reputation
69,183
Next tag badge:
211/100 score
19/20 answers
Badges
6 204 295
Newest
 Nice Answer
Impact
~447k people reached

Mar
13
comment Efficient implementation of a linear complexity measure of binary sequences
Lisp is still on my wish list to learn, but from what I learned already I know that it will be among my favorite languages. In javasript, OTOH, I do some real stuff from time to time. So, becoming better at js is a more immediate need for me, but Lisp stands there right after it, on my todo list. But, recently I haven't had much time for anything except my direct work, which is Mathematica (sometimes plus C or Java).
Mar
13
comment Efficient implementation of a linear complexity measure of binary sequences
+1. This is nice. About native vs.not, I am not sure I am in your & Andreas's camp. I tend to like languages which are good both to write in and generate code for, and as far as I can tell now, C, javascript and Lisp (and also Mathematica) are some representatives, while Java is likely not. But that's just my current opinion, I know that some people actually generate Java code.
Mar
13
comment MixtureDistribution in Mathematica 7
@Cham I agree with Sjoerd. "I now feel discouraged to ask any question on this forum ! :-(" - you shouldn't feel discouraged. However, we must maintain the reasonably high standards for the questions asked here, if we want this place to be the world's primary place to ask professional questions about Mathematica, and not degrade into student forum or the like. With all due respect, the sort of information you asked for is trivial to locate using Help.
Mar
13
awarded  packages
Mar
13
comment How make f[{x,y}] evaluate as f[x,y]?
I don't really know a better way than just put them into a List. But, this is easier to explain than Apply and Sequence, so may be this is then the way to go.
Mar
12
comment Dropping n consecutive terms from a list periodically
+1. This will be hard to beat.
Mar
12
comment Efficient implementation of a linear complexity measure of binary sequences
@Stefan No worries :-). You are partly right too. I've been out of practice in C for a while, so that's why I did not pay much attention to optimizations, even though they occurred to me. Had I written this a few years ago when I was coding in C all the time and chances are that I would have included those without even thinking (that's probably the way you felt about it), and perhaps only then remove some of them for readability.
Mar
12
comment Faster alternatives for DayOfWeek
Yes, that sounds good :-)
Mar
12
comment How make f[{x,y}] evaluate as f[x,y]?
I think that my explanation here, which is just 3 lines, is more or less all there is to it.
Mar
12
comment Faster alternatives for DayOfWeek
@Stefan Completely agree on the importance of interfaces. This is also of a professional interest to me, as well as being interested as a user. Re: blog: I owe at least a few blog posts for SE blog - I promised many. Have been swamped in the last few months though, recently haven't been much free time. Hope things will change.
Mar
12
comment How make f[{x,y}] evaluate as f[x,y]?
"so Sequence along with Apply is much too sophisticated for them" - but here is a problem: what you request is not quite a trivial manipulation, and Apply and Sequence are exactly the tools. I can imagine that one may be able to find some twisted ways out, but I am sure those will be (much) harder to understand than Apply or Sequence. Actually, I don't consider the latter two so hard to comprehend. Apply "eats up" the head it operates on, replacing by another one, while Sequence means "no head", and gives a bare sequence of function's arguments. Not hard, even for a newbie.
Mar
12
comment Faster alternatives for DayOfWeek
@AndreasLauschke Yep, all your points make perfect sense to me.
Mar
12
comment Faster alternatives for DayOfWeek
@Andreas Re:Java compiler - it should be inside. My relaoder uses that. The JRE shipped with Mathematica is a bit non-standard, exactly in that it includes the compiler, while standard JREs don't. But I did not check for the version 9.
Mar
12
comment Faster alternatives for DayOfWeek
Oh boy, it's been 8 months already. The time is flying. Can't say I am too happy about that, I could have been more productive...
Mar
12
comment Faster alternatives for DayOfWeek
@Andreas Yes, true. Re: Stefan: There are tons of similar things to be done for Mathematica. One reason I like Mathematica as a platform is that so little has been done yet in terms of seamless interops with other languages / tools, and development tools for all this. So, I can learn by making some of these things (if only I had enough time for that ...:-)). By the way, Andreas has made big progress in this area with his JVM tools, they should get more traction.
Mar
12
comment Faster alternatives for DayOfWeek
+1. I should try using Joda library to see if I can beat that, but even if it so happens that pure Java code is somehow faster, I will probably lose anyway due to JLink/MathLink data transfer overhead - not to mention that this overhead is huge for smaller lists, which is not the case for LibraryLink.
Mar
12
comment Efficient implementation of a linear complexity measure of binary sequences
@Stefan "I'll stop" - no, why? I was just explaining my attitude for this particular answer. Actually, it may also be that your interpretation of it (getting the optimized version) is closer to what the OP wanted. I just wanted to illustrate that particular aspect of plain export of M code into C more or less verbatim, and the difference in performance, but it does not mean that my interpretation is the right one. For the one of "give me the fastest possible code", your suggestion is spot on and your version is better than mine.
Mar
12
comment Efficient implementation of a linear complexity measure of binary sequences
@Stefan By attribution I meant that I will mention that that input came from you :-). Re: understanding - not all folks here know C, and things like n & m-1 or memcpy can be cryptic enough for those who don't know it. My point basically was that just taking the code from Compile pretty much verbatim, and leaving all the rest to the compiler without doing further optimizations, can still lead to a rather dramatic speed-up in this case.
Mar
12
comment Efficient implementation of a linear complexity measure of binary sequences
@Stefan As I get some spare moment again, I will edit in your input (with attribution, of course).
Mar
12
comment Efficient implementation of a linear complexity measure of binary sequences
@Stefan Thanks for your input. I was not concerned with squeezing the every last millisecond out of the code, or I would have employed similar optimizations. My point was to have code with minimal changes from Mathematica's Compile, so that it is easy to follow for folks not too familiar with C ( I would have probably missed the unroll loops option but other things you described did cross my mind). So, the code may be badly written for the C standards, but it has been done intentionally, to make it easier to understand.