« first day (2061 days earlier)      last day (2724 days later) » 

zhk
zhk
14:48
@rhermans ANy luck with the overflow problem?
15:11
@zhk not really looking into it. Sorry.
zhk
zhk
15:28
@rhermans no problem dear. Thx
15:52
@halirutan What is it that you expect to get from Julia that M won't do for you?
Currently I see three clear advantages: 1. not putting all your eggs in one basket 2. open-source 3. fast for algorithmic stuff
Anything else?
16:20
@Szabolcs Especially point 3 is interesting for me. Mainly that you can use auto-vectorization and inspect the created LLVM code is a killing feature for me. And yes, since everything is open, there is no guessing, no hidden features, no surprises that you can't investigate.
One additional thing is absolutely turning me on: You can compile any julia code into a self-containing exe or library. This means, it should be fairly easy to build a LibraryLink function for Mathematica, that calls things that were implemented in Julia but you don't need any Julia on the machine that uses your package.
You know, it's the equivalent of "Take any Mathematica code and turn it into a program that doesn't need Mathematica anymore".
@halirutan I've been thinking for a while about making LTemplate support multiple languages. It's an interface generator after all. Why not generate an interface to a Julia library instead of a C++ one?
@Szabolcs I have been playing a bit and I would have pinged you anyway exactly for this reason that I wanted to ask if LTemplate is probably a candidate that can help.
(Need to go out but will talk about this later.)
16:30
@Szabolcs Yep. I'll leave you something to read.
My current knowledge is that there are 3 possible ways to use Julia with Mathematica:
1. You can use Julia code directly by taking their C-API, initialize the julia runtime, load your file, get a pointer to the function you want to call and wrap everything nicely so that you can call it from Mathematica. You need Julia on your machine for this.
2. You use your Julia code to create a so called pre-compile Julia image. This can be loaded and it works like 1. but you have a shorter startup time.
3. You take your Julia code and create object code (or an exec). Then, calling the Julia function d
16:47
I'm not entirely sure myself, what my motives behind this exactly are. I guess interest is one of the driving forces, but there is also "not putting everything on one card" as you say it. Since we don't know for how long we have to stick with the old Mathematica compiler, I'm seeing an opportunity to have a way to provide fast compiled functions that can be written in a scientific language rather the C.
So if we had a framework that let's you call CreateJuliaLibrary and you can use LibraryFunctionLoad, IMO that would be the absolute killer app. After all, Julia is so much richer than what we can do with Compile at the moment and of course I'm interested in the speed comparison.
@halirutan Maybe it is irrelevant, but are you aware of the new function ExternalEvaluate in 11.2?
17:04
@xslittlegrass That's not gonna help us here. We don't want to simply call Julia from within Mathematica. I want a connection at the native level so that we can create an equivalent of compiled-functions that run as fast as possible.
17:15
@xslittlegrass To give a very specific example: Assume you are working on a large matrix in Mathematica and you want to call some external function that works on the array. There is only one way to do this without copying and sending the matrix to the other language and that is to use LibraryLink and work directly on the same memory that Mathematica is using. Even if we need to copy it, it is definitely better to do the type transformation in the native object code, than sending a string.
17:28
@halirutan Thanks for the explanations. Are you using Julia in your daily work? Apart from Julia and Mathematica, what are the other languages do you use daily? I'm starting to looking for jobs and found only knowing Mathematica is very difficult to get a job.
So I start to pick up Python and C++, and I find that the thinking in these languages are very different than Mathematica. And it would be interesting to hear your opinions on other languages from an experience Mathematica user point of view.
@xslittlegrass I'm currently not using Julia on a daily basis and although I can read Python, I'm not using it. I feel your pain that finding a job related to Mathematica is not easy. In university I can use whatever I like. In industry this this different and finding a job-offer that says "We are earching for an analyst that is fluent in the Wolfram Language" is basically non-existent statistically speaking.
Personally, I'm using Mathematica, Java and Kotlin. I know my way with C/C++ although I'm not using it every day. If you consider any scientific related work, where you need a good set of mathematical stuff in your toolbox, there are indeed only a handful of modern languages. Many people use R, Python and since a few years Julia is becoming very popular. Note that these are free languages, opposed to Matlab, SPSS and other tools.
For me, it was a bit different. I started with C, Java and Haskell when I was a student. So I had seen a lot of for-loops and object-oriented code, before I saw how nice functional programming is when I had the luck to work with a professor that was incredibly smart with Haskell.
Mathematica combined a lot of paradigms I had already used.
I don't know what kind of job you are trying to find, so a good recommendation is hard. Especially when you have kind of two extremes with C++ and Python.
The first one can be extremely low-level while Python is a very high-level language that hides most of the nasty details.
17:48
@halirutan How does your workflow look like using Java and Mathematica? For example, do you use Mathematica as the main language and Java as a supplement though JLink, or do you use them separately in different projects? When I write python or C++, I have to try very hard to suppress my temptations to switch back to Mathematica, because the implementations of in Mathematica would have been so much easier.
@halirutan I'm currently looking for job in software development in deep learning / autonomous driving. But all the jobs I interviewed so far requires the coding test in either python or c++. These coding test are problems like here leetcode.com/problemset/algorithms
@xslittlegrass Is 11.2 desktop available already on the Desktop (e.g. as trial)? I mean the final release, not beta.
@Szabolcs I don't think so. I'm using the beta test version.
@Szabolcs I have a question about LTemplate. Is is possible to use the stl containers in LTemplate? For example vectors?
18:05
@xslittlegrass How it works is that there's a C++ class for wrapping each LibraryLink type, such as MTensor, MSparseArray, etc. If you want a function that can receive a real vector from Mathematica, its argument must be of type RealTensorRef, which is a wrapper for (a pointer to) an MTensor.
This class does have begin, end and size member functions, as well as indexing with operator [].
This way it does have some STL compatibility, and can use some STL algorithms.
I should probably have more complete support for the Container concept though ...
What you cannot do is make your function argument of std::vector<double> type.
But you can easily copy into an std::vector, as std::copy works.
Any suggestions are of course welcome.
I am planning a major overhaul as soon as I have time.
I want to add support for more LibraryLink types, in particular RawArray and MImage.
And I want to add template support. Right now you must specify the element types of LibraryFunction arguments. You can have a real vector or an integer vector, but not an arbitrary vector that might be either.
I plan to allow specifying a list of element types (real, integer, complex) which are accepted, and have them call a template function with the corresponding type, e.g. f<double>, f<mint>, etc.
This will be particularly useful with MImage, where it is usually desirable to have the same algorithm work for multiple image types (8-bit, 16-bit, etc.)
But I'm not yet sure what the best way is to do this ...
Thanks for the explanation. To support MImage would be very useful. Right now I just started to use LTemplate so I don't have any suggestions. But I plan to use it more extensively as I practice C++. I'll have more suggestions/questions after that. Thanks for sharing LTemplate!
18:45
@halirutan To rewrite LTemplate to work with both C++ and Julia would be a lot of work. But something analogous to LTemplate should be very feasible. LTemplate simply generates the glue code between plain LibraryLink and a C++ class. It could instead generate Julia code.
I don't know Julia almost at all, but I guess the interface would be slightly different.
It would focus on free functions rather than classes with member functions.
And perhaps the MTensors would need to be copied over (unless it is possible to construct a Julia array from a pre-initialized part of memory).
Alternatively, there could be a special MTensor type in Julia just for this, but I guess mapping MTensors directly to Julia arrays would be friendlier.
18:57
@halirutan But I think the first option is more interesting: a MATLink-like Julia interface that allows calling Julia functions directly from Mathematica. It couldn't be as fast as the third option though.
And it would be more work to make too.
Considering the effort needed for the first option, the third one is more realistic.
I think trying to learn Julia/other well first before attempting a Mathematica link would be more beneficial as otherwise there is always the temptation to only do the bare minimum (which might be inefficient) and fall back to Mathematica. Not that there is anything inherently wrong with that approach but you probably might be missing out on developing skills in a new language.
I work almost 100% in python for the past 3 years and I don't miss Mathematica. Perhaps you might not miss it either if you go all in on Julia (or might need it only for other things)...
19:34
4
Q: Ask Question - Tags box: Placeholder

Mathe172I'm not sure how much of an impact this has on choosing tags, but this seems a bit contradicting at the very least: The Tags box has the following placeholder: at least one tag such as (bugs image-processing plotting), max 5 tags Image: And the description of the bugs tag: This tag i...

19:49
@R.M. Yes, absolutely.
20:00
The link approach (like MATLink) requires a lot of work and deep knowledge of the target system.
The LibraryLink interface approach is different. It's for connecting systems which are good at different things, like Mathematica and C++.
I do like C++ (despite everything). It is flexible enough that it has libraries that make certain scientific computing tasks very easy.
Check out Armadillo: arma.sourceforge.net It has an almost MATLAB-like syntax.
It also has several other higher level libraries built on top of it.
It can integrate with LTemplate quite well. E.g. Armadillo errors usually result in an exception being thrown, which LTemplate will catch and print the message in a user friendly way. Here's a very small demo I made last year: dropbox.com/s/kbxx5gtqevfbb7m/Arma.zip?dl=0
20:18
@xslittlegrass Sorry for the delay. 3 of 4 kids wanted to look Arielle and I took the time to give my eldest a hair-cut :)
I work in 2 major modes: 1. official work and 2. fun projects. For my official research, I didn't really needed more than Mathematica and Java for writing algorithms. Some years ago, I started to write an image processing library in highly parallel C++. Nowadays, I can usual work with the stuff that comes with Mathematica since speed often doesn't really matter in my experiments.
For fun projects, I look at everything that sounds sort of interesting and I take a much broader view. For instance, I dive quite regularly into website development and changed my site from Joomla, to Pelican to Jekyll, just to understand the workflow and how things are done.
Another thing are the JavaScript snippets I wrote for SE (the highlighter, the editor-additions). I don't really like JS, but I did it anyway, just for the fun of it and just because it was the right language to use in this context.
Quite recently, I got interested in Swift and Kotlin. Initially, I looked into Swift but since this particularly targets the Mac OS platform, I wouldn't have any real use for it. Kotlin is different. It's completely transparent with Java and you can mix the two languages like you want. I showed a few days ago how easy it is to call Kotlin from Mathematica just because it compiles down to JVM byte code. This is something I definitely keep in mind because the language is well designed and supports
a lot of functional paradigms.
The Mathematica Plugin is completely written in Java, but now I'm writing new stuff in Kotlin.
20:49
@xslittlegrass As for your interview problem, there isn't really a solution. Knowing C++ takes years, especially if you haven't any chance to use it before. And "just learning it" won't help. You need a real project to work on. I haven't met anyone yet who was good in a language and learned it purely from tutorials.
@Szabolcs Maybe there is a middle way. What I'm thinking about is to use Julia's introspection to access the types of the functions that are exported. Knowing the C-type would reduce the problem to creating the glue between the Julia types and LibraryLink.
@Szabolcs At the moment, I don't see any use-case of "creating Julia code" from within Mathematica. There is one exception: If much of the core part of Mathematica can be translated to Julia, then we could write a better Compile that just uses Julias features to create fast code. But this is definitely much work.
21:16
@halirutan What I meant was that that code would be the glue between the LibraryLink API and something more convenient. LTemplate now generates C++ code which does the same, i.e. do all the MArgument_getInteger, etc. I think Julia is flexible enough that it can handle this without needing any extra C glue code.
 
1 hour later…
22:25
@halirutan Thanks for the advice, which is very helpful and informative!
@R.M. What is your opinion on Python compared to Mathematica, since you are an expert on both?
23:26
@Szabolcs Yes, this is my point. We got two options: we create a library function that calls Julia, passes the arguments and takes care of the necessary type-work. For this, we need the Julia engine which in itself needs some time to start up. Additionally, the Julia script that is our function needs to be compiled.
The other option that I'm more interested in doesn't need Julia at all in the end. We take a Julia script, compile it in a special way with julia and get an .o file that contains everything. This .o file needs to be linked with the LibraryLink wrapper and then you have a pure native library. No Julia required for the end-user.
He just calls a LibraryLink function as if everything was written in C to begin with.

« first day (2061 days earlier)      last day (2724 days later) »