61,817 reputation
6186278
bio website mathprogramming-intro.org
location St. Petersburg, Russia
age 38
visits member for 3 years
seen 5 hours ago

Ok, an obligatory note: opinions expressed here are mine and not those of my employer.


7h
comment Having used Mathematica as a “gateway” language, where to from here?
@DaoTRINH Great! Hope you'll find it useful. To me, that page is mostly marketing, I'd prefer something going way deeper into details.
11h
comment Having used Mathematica as a “gateway” language, where to from here?
@DaoTRINH Frankly, I have no idea. Sorry.
Jan
22
comment How to recursively check is a graph is a binary search tree?
I would not use built-in Graph algorithms for this problem. They might not be a good match, and also won't help you much, given your motivation. As to the check, you can write your own depth-first traversal code in just a couple of lines of code, and test if this is indeed a binary tree, and if leaves / branches are properly ordered.
Jan
22
comment How to compute the longest non-contiguous common sequence?
There is LongestCommonSubsequence. AFAIK, the complexity is O(n^2) in general. Perhaps, in some cases, when certain additional information about sequences is available, there exist faster algorithms.
Jan
19
comment Make my data-structure atomic
Oh, c'mon, man, I'd never be even remotely as amazing as you :) I wouldn't even think that providing so many quality answers is humanly possible.
Jan
19
comment Make my data-structure atomic
@Mr.Wizard Because I learned about this from someone else, and can't take the credit for this info. Most of my non-CW posts contain either programs I wrote myself, or things I've discovered myself rather than learned from another person.
Jan
17
awarded  Yearling
Jan
4
comment Fast matrix multiplication in MMA and GPU
@yashar You may find this comparison interesting. My own experience with GPU / CUDA has been that this is an art. Depending on how deeply you understand the GPU architecture, the problem at hand, the power of the particular GPU you have vs. the power of your CPU, and some other factors, your results can vary significantly. For matrix multiplication, it's probably safe to assume that you can get a speedup about 5x-10x with a modern GPU (compared to a modern CPU) without a huge effort. Perhaps, with more effort, you can get more.
Dec
24
comment Expressions containing globally undefined symbols inside a function where they are defined
This viewpoint is wrong. Read this, and this.
Dec
22
comment Listable vs Parallel
@Mr.Wizard Will do, when I get a bit more time.
Dec
22
comment Listable vs Parallel
... to clarify this difference. As to parallel, the kernel-level parallelism is a coarse-grained one, so it's automatic use can't be justified in general, as often the kernel communication overhead will be more expensive than what you gain from using more than one kernel. So, to summarize, there are two types of Listability and two levels of parallelism, and your suggestion would IMO only make sense for fine-level parallelism applied automatically to all kernel functions (low-level Listability). This may happen some day, but to my knowledge, currently this is not the case.
Dec
22
comment Listable vs Parallel
No, they are generally not the same. Only a fraction of the Listable functions in the kernel can utilize all available threads. Besides, there are two different levels of Listability, the one which is low-level (used in kernel functions), and which allows to push all work into the kernel and avoid top-level threading, and the top-level, which is more a convenience to avoid explicit use of Map, than a speed booster. Check out this answer of mine, where I tried ...
Dec
19
awarded  Nice Answer
Dec
18
comment Difference between Association and Dispatch
@Murta Ok, done as requested.
Dec
18
answered Difference between Association and Dispatch
Dec
18
comment Difference between Association and Dispatch
@alancalvitti Can't say, too little information. Associations can hold millions of key-value pairs easily, but are not too memory-efficient. It all depends on how large the total number of key-value pairs is, and whether or not it is feasible to store them in an Association in memory. There are other factors too.
Dec
18
comment Difference between Association and Dispatch
If you are not going to change your list of rules after you construct them, Dispatch is pretty good. The main difference is that it is cheap to add new key-value pairs to associations, constructing new associations - not so with Dispatch. You can somewhat emulate the action of Dispatch-ed rules on a list of elements, by using Lookup with Associations. Lookup can take a list of keys. It has also optional argument for a default value. Not sure if it can do both at the same time, don't remember.
Dec
12
comment Function that returns the second argument of Reap
@halirutan Yep, same feelings here. +1.
Dec
12
comment Function that returns the second argument of Reap
Reap is not a simple function. It is closer to scoping constructs in spirit. It has a Hold attribute, so that the code evaluates only inside of it, but not before being passed. You need to set HoldAll or HoldFirst attribute to your Reap2, if you want it to behave properly.
Dec
9
awarded  Good Answer