halirutan / Wolfram-Language-IntelliJ-Plugin-Archive

Wolfram Language and Mathematica plugin for IntelliJ IDEA.
https://wlplugin.halirutan.de/
Other
193 stars 26 forks source link

Basic Documentation: How can I get started with Idea/CLion #160

Closed alexishughes closed 4 years ago

alexishughes commented 4 years ago

Hi @halirutan, I have only used Mathematica once with an IDE - I got Visual Studio to add 2+2 and the module was defined in Mathematica. I feel sure your plugin will be a lot cooler to use - what I need is a few concrete examples -

1: I have successfully added a new Wolfram Mathematica Package (wolfram1.m) to my Java project, how can I call it from the Java application?

2: If I were more advanced, how, for instance, could I capture data from my camera in java and then process a Canny edge detection or Laplacian on it using my GPU, and then get the data back.

3: There is no documentation on CLion at all that I can find! But I feel I'll probably want to write in C++ at some point too.

I'm really enthusiastic about this project - as a newbie I could help to write a startup guide - in return for some TeamViewer time and a few answers to (probably) trivial questions. If you wish this, please message me. Or, please send links to any and all technical info and I'll wade through it.

halirutan commented 4 years ago

I got Visual Studio to add 2+2

To avoid any confusion: IntelliJ IDEA and CLion don't calculate anything. These are environments to help you write code efficiently and manage your projects. All code is run by (1) your machine in case of compiled C/C++ programs, (2) the Java runtime in case of Java, and (3) Mathematica (or a Wolfram Language Engine) in case of Wolfram Language code.

That being said, here are some links to documentation. In the case of Wolfram Language code, you find all documentation in the Help Center by pressing F1 inside Mathematica or going to Wolfram's online help. All documentation for IntelliJ IDEA is here and all documentation of CLion is here. Note that CLion uses the same underlying infrastructure as IDEA and most things that you look up in the IDEA help will work in CLion as well.

1: I have successfully added a new Wolfram Mathematica Package (wolfram1.m) to my Java project, how can I call it from the Java application?

The part that connects Mathematica and Java and lets you send data between the two is called JLink, and you find its documentation and examples here. If you want some real-world example, you can look at my Spectralis Raw Data Import Library which loads image data with a Java library and sends it back to Mathematica.

2: If I were more advanced, how, for instance, could I capture data from my camera in java and then process a Canny edge detection or Laplacian on it using my GPU, and then get the data back.

That doesn't seem to have anything to do with Mathematica, although you can use CurrentImage to get an image from your cam and then apply any filter you want. Try this in a Mathematica notebook:

Dynamic[EdgeDetect[CurrentImage[], 3]]

3: There is no documentation on CLion at all that I can find! But I feel I'll probably want to write in C++ at some point too.

I gave the documentation link for CLion above. If you're asking how to connect. If you're asking how to connect Mathematica and C/C++, you should start reading the Wolfram LibraryLink user guide carefully.

alexishughes commented 4 years ago

Thanks, Patrick. I knew it was a link. I thought the plugin might be able to start Mathematica and run the code. I was also wondering about bindings to Java/C++. Obviously efficient way to do Canny/Laplacian is just to link to OpenCV etc. But I was looking for more versatility - and a none-too-trivial first project. This info is excellent.

szhorvat commented 4 years ago

For calling C or C++ functions from Mathematica, see https://mathematica.stackexchange.com/q/8438/12

However, interoperability between Mathematica and other systems really has nothing to do with the IntelliJ plugin. The plugin does not help you in doing this.

szhorvat commented 4 years ago

New users often believe that this IDE is an alternative interface to Mathematica. That is not the case, and IMO it should not be an aim.

The usual workflow is that one edits a package file using the IDE while concurrently having the Mathematica Front End open. The package can be loaded and tested from a notebook.

Notebooks are excellent for interactive work, and should be the centre of your workflow.

The IDE is a (very) smart editor, but it is not for running code.

alexishughes commented 4 years ago

Ty, @szhorvat, I'll work through all you and @halirutan have posted and I hope to use my notes to produce a newbies' guide.