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

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.
Mar
12
answered Efficient implementation of a linear complexity measure of binary sequences
Mar
10
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
@Jens So, thanks for the input, in particular it shows that some people read what I write, carefully enough :). I will make an edit and make my statements more precise, some time soon.
Mar
10
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
@Jens Yes, the first case I actually noticed, but was too lazy to correct my wording. Basically, my main point was that the decisions about renamings are made by Module. In the case Module[{z},Function[z,0]], it was smart enough to realize that simply keeping x in Function would be enough to avoid cinflicts. As to the second case, this seems to be a general problem with Module (and more generally, the emulation of lexical scoping in Mathematica): take Module[{z$, z}, 1], and you get the same. I wasn't aware of this particular issue, but I am not too surprised either.
Mar
8
comment Parallelization of REvaluate[]?
@Szabolcs I missed that one. Yes, this is the same idea - R libraries are just loaded into the JVM, so for all practical purposes, this is also just a parallel JLink problem. Actually, at the time, I saw both of your answers and upvoted both, but then I forgot about them. I think, people tend to remember their answers better than the answers of others, alas.
Mar
8
comment Parallelization of REvaluate[]?
@Szabolcs Actually, this may be important enough to include this as a section into the docs for RLink, for the next release.
Mar
8
comment Parallelization of REvaluate[]?
@Szabolcs Well, I think it is not quite a duplicate, because here one has to run several JVM and R instances, and while this is possible, it seems good to mention this explicitly. Also, this sort of uses for RLink seem general enough to merit its own discussion, even if this is a special case of the general question you have answered there.
Mar
8
comment Does pass-by-value affect the performance of function calls?
I think @Nasser makes a valid point. When one needs to modify something inside a function, passing symbol (variable) where that something is stored, by reference, greatly reduces the overhead of modification, since it is done in place. I actually also felt that this is worth mentioning back then, see my last comment to your answer on SO.
Mar
8
comment Does pass-by-value affect the performance of function calls?
@Nasser Actually, the question you linked is relevant, but only tangentially. Besides, the accepted answer there promotes dangerous practice of using Unevaluated, which is a wrong thing to do from the software development perspective. Instead, Hold- attributes should be used, as I emphasized in my answer there, and then also here.
Mar
8
comment Does pass-by-value affect the performance of function calls?
This excellent answer by @Szabolcs probably addresses most of this question.
Mar
8
comment OpenCL Dot Product
As an alternative, you may look for some Map-Reduce frameworks for GPUs, such as this. I never tried those, and it is probably also quite a bit of work. But the advantage here is that problems like your can be treated by Map-Reduce more directly and universally, while the first approach I suggested is not universal.
Mar
8
comment OpenCL Dot Product
The problem is that you can't do this directly using the out-of-the-box solution for a dot product, since GPU-s are directly helpful for massively parallel problems, while this one directly is not. What I would do is to glue all vectors you want to multiple into two large vectors, and pass them to GPU together with a list of lengths. Then, you will have to write your own custom thread scheduler, so that effectively a thread which is finished with one vector pair is rescheduled to another one. Should be doable, but some work. Besides, you need a really powerful GPU for all this to pay off.
Mar
7
comment Variant of the cutting-stock problem in Mathematica
@JacobAkkerboom Thanks. But keep in mind that the above function is not tail-recursive, and besides, tail-recursion in Mathematica has its own peculiarities
Mar
7
revised Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Added a more interesting example
Mar
7
comment Using ReadList and Skip to read a file with periodic alternation of useful and useless data
Alas, currently not an option for the files of ~ Gb size, see e.g. this discussion
Mar
7
revised Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
edited tags
Mar
7
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
I modified the title because the problem you faced in an instance of a more general and quite important issue. But if you don't like the new one, please feel free to roll back.
Mar
6
comment Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
@acl See if you like the new title I just made for it.
Mar
6
revised Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Made a title more general