34,313 reputation
481209
bio website
location ND
age 29
visits member for 1 year, 4 months
seen 2 hours ago
stats profile views 3,147

contact details

Visit Mathematica.SE


2h
comment How can I conveniently call igraph through RLink?
Thanks to Leonid for showing me how to use an external R installation on Mac!
14h
comment Why is StringExpression faster than RegularExpression?
I tried time pcregrep --buffer-size=100000000 '(?ms)(?:(?ms)\(ICD-9-CM (.+?)\))' test.txt >/dev/null with pcregrep 8.32. This doesn't replace, it only matches, so it may not be correct. It takes 0.09 s here.
14h
comment Why is StringExpression faster than RegularExpression?
Do you know what the ?: means? (I don't.) Maybe this is something worth mentioning to support then?
14h
comment Why is StringExpression faster than RegularExpression?
The answer might be in StringPattern`PatternConvert[re]... which is not the same as re.
14h
comment Why is StringExpression faster than RegularExpression?
I think you have v7. Just mentioning that it's the same in 9 too.
1d
comment Optimizing functions taking matrix arguments
Return is not needed here and you can also drop the ;. This is not just nitpicking: while in this particular example it does not make a difference if you use it or not, when used inside some functions, it will return from those functions and not from your function.
1d
comment Telling mathematica to output * instead of space for multiplication, so I can copy as plain text
For MATLAB, use what rm said. For C, use CForm.
2d
comment At what point should MLSetMessageHandler() be called?
@ToddGayley I noticed now that the output of mprep has MLMDEFN( void, MLDefaultHandler, ( MLINK mlp, int message, int n)) if MLINTERFACE >= 3, which seems to be the default for Mathematica 9. It has unsigned long otherwise.
2d
comment At what point should MLSetMessageHandler() be called?
@ToddGayley I was not aware that I need to send Abort[] explicitly when the return type is Manual, thanks for pointing that out!
2d
comment At what point should MLSetMessageHandler() be called?
@ToddGayley I got the msghandler prototype from this documentation page. It uses int types. I checked mathlink.h as well, and if I followed the definitions back correctly (it's easy to make a mistake with all the #ifdefs) then MessageHandlerObject is a MLHandlerUPP which is a MLHandlerProcPtr which is defined as MLMPROC( void, MLHandlerProcPtr, (MLINK mlp, int m, int n));. Are you sure that the arguments should be unsigned long?
May
20
comment At what point should MLSetMessageHandler() be called?
What I ended up with eventually was defining a function callable from Mathematica that set up the handler. I think I could also move calling this function into the template file.
May
20
comment At what point should MLSetMessageHandler() be called?
@ToddGayley and Leonid: Thanks! Otherwise does the handler look fine, calling stdhandler for everything except Interrupt and Abort? It was not clear to me which messages must be handled, and how.
May
20
awarded  export
May
20
awarded  Nice Question
May
19
comment I want to draw a graph using a weighted Adjacency matrix
How do you want the weights to modify the drawing of the graph?
May
19
revised CUDAQ[] returns False in version 9 while True in version 8
edited title
May
19
answered CUDAQ[] returns False in version 9 while True in version 8
May
19
answered How to set image DPI?
May
19
comment Can one identify the design patterns of Mathematica?
@OleksandrR. That's true, it can be used in any language.
May
19
comment CUDAQ[] returns False in version 9 while True in version 8
This has happened to me. Try this in v9: CUDAResourcesUninstall[]; CUDAResourcesInstall[]. The download will take some time.