Questions tagged [c++]

The tag has no usage guidance.

6
votes
0answers
83 views

WXF encoder library for C++ (asking on may 2019) [duplicate]

Is there any updates regarding plans to open-source C library to support WXF? My question is related to "WXF encoder library for C++". Strongly apologize for opening a new question regarding this ...
2
votes
1answer
123 views

Meson build system + C/C++ LibraryLink, help needed for portability check/fix (Windows &MacOs)

As a proof of concept I have created a github repository that shows how to: use the Meson build system to create a Mathematica package using LibraryLink functions The goal is to provide an easy to ...
2
votes
0answers
75 views

LTemplate C++ code seems to run faster than the same code compiled outside of Mathematica

I am slightly puzzled by now and am not able to figure out what's going on inside of LibraryLink (used by LTemplate) to justify what I recognized: I have C++ code that is way too extensive to be ...
12
votes
1answer
219 views

WXF encoder library for C++

WXF is a fully documented binary encoding for Wolfram Language expressions. WRI has already published a Python encoder/decoder for this format. ExternalEvaluate ...
2
votes
2answers
240 views

WM 11.3.0.0 CompilerDriver[] fails to compile a C code with VS 2017 Community

I am new at using CCompilerDriver[]. I call the C compiler from W Mathematica using recent WM 11.3 update. It successfully identifies the Visual Studio 2017, But calling compiler returns errors. <...
0
votes
1answer
51 views

Defining general type of functions

In Mathematica the term "function" refers to an expression that is evaluated given an input, and has a return value. I was wondering if it's possible to define functions in the C++ sense, without ...
10
votes
2answers
266 views

Link server WSTP API feature not receiving incoming connections

I'd like to apologize ahead of time that this may be a very long post but want to get all of this out there. Also, this post really only pertains to those with WSTP/MathLink experience. My problem ...
5
votes
1answer
95 views

Hide WSTP application from taskbar

I just updated a small MathLink program that I made a while ago, and recompiled it using the new WSTP system (Mathematica 11.2). ...
29
votes
2answers
4k views

Why does Mathematica results differ from C++ results within machine precision?

I am trying to wrap my head around floating-point precision. Performing the following numeric operation: 275./6.*1.03692775514337 in Mathematica and C++ and ...
6
votes
1answer
116 views

MTensor from existing memory?

I am wondering whether it's possible to return a tensor from my C++ code using LibraryLink without copying the memory (because it's large). So, instead of ...
10
votes
3answers
695 views

Using Mathematica wlnet model in C++

Suppose if there is a trained net: SeedRandom[1234]; net = NetInitialize@NetChain[{5, 3}, "Input" -> 2]; It can predict image in mma: ...
1
vote
3answers
433 views

Importing floating-point numbers in scientific notation generated by a C++ program

I have a C++ program that outputs a file containing a list of floating point numbers, which I want to read into Mathematica. The file looks like: ...
14
votes
1answer
983 views

C++ interface to large project

We are developing a quite large mathematical software in C++ and would like to have a Mathematica interface. We have our own C++ library and our idea would be, to write a Mathematica wrapper class and ...
3
votes
2answers
424 views

Write Power in CForm[] as multiplication instead

Is there a simple way to make Mathematica write CForm[p^2] not as Power[p,2] but rather as ...
0
votes
0answers
273 views

Using shared library in LibraryLink

Recently I've asked a question somewhat related to this[*], but I consider this an actual new problem. So I hope it is indeed appropriate to ask you again. I have created a shared C++ library (with ...
1
vote
1answer
230 views

LibraryFunctionLoad for multivariate C++ function containing several arguments

I've been working on a project for quite a long time, and now when I finally want to use it in praxis I don't know how. I have created a shared library (libcwv.so) with a header (cwv.so) with nvidia'...
5
votes
0answers
138 views

Constraints on implementing the Wolfram language? [closed]

A long time ago (1991) Wolfram got upset when someone tried to implement Mathematica. Now there is the Wolfram Language. Are there any constraints (for example, legal constraints) on implementing ...
2
votes
1answer
653 views

Using Minuit2 to minimize a Mathematica function

FindMinimum is great, but sometimes it is difficult to get an idea of the uncertainties and intermediate evaluation diagnostics. How to define a function in ...
1
vote
1answer
139 views

MathLink to C++ member function

The task is to compile, link and install in Mathematica (9.0, Linux 64 bit) some functions defined in C++. These functions are defined within classes. I have access to the header which forward define ...
0
votes
1answer
42 views

Restricting the evaluation of variables [closed]

Hopefully you understand my question. I m calculating inverse kinematics of a robot and each subsequent value is dependant on the one before. For simple porting into c++ I would like something like ...
1
vote
0answers
250 views

Issue with WSTP

I'm trying to get Pythonika to work once again - with the latest version of the WSTP. The changes required are not many, basically just three: Change ML to WS Change mprep to wsprep Change mcc to ...
3
votes
2answers
1k views

What is the best way to work with complex number array in librarylink function in terms of C++ and Eigen?

I want to use C++ Eigen library in Mathematica Librarylink function. Currently, I have no problem dealing with real arrays. But I don't know what is the best way to deal with complex array in ...
5
votes
1answer
199 views

Initializing and keeping track of a large c++ object and reusing it from inside Mathematica

I have a c++ library function that calculates a distance between two vectors given an underlying matrix. ...
1
vote
0answers
85 views

How to simplify writing MathLink code? [closed]

This wonderful question inspired me to ask the analogue for MathLink, which is now known as Wolfram Symbolic Transfer Protocol (WSTP). The basic example addTwo is over complicated and under useful.
3
votes
1answer
68 views

Discard an entire (sub)expression on a MathLink link

Suppose that an expression like f[something, 12] was sent to a MathLink link, and we need to read off only the second part of ...
1
vote
1answer
403 views

Convert code from C++ to Mathematica [closed]

I need to know how to convert the following code in C++ to Mathematica. ...
4
votes
1answer
139 views

Importing binary structured C++ data file

I am trying to import a binary data file. It seems that BinaryReadList would be appropriate? However the data file is composed of c++ structures like this: ...
15
votes
2answers
262 views

What is the best way to transfer arbitrary-precision reals using WSTP?

I'm developing a Mathematica package, inside of which there is a number-crunching function. It uses a list of arbitrary-precision numbers as input and it takes a lot of time to do its job. So I've ...
9
votes
1answer
334 views

How can I wrap a C++ object in WSTP?

I am trying to wrap a sophisticated C/C++ API in Mathematica using WSTP, but can't work out how to return a pointer to a C/C++ data structure. This object was created on the C/C++ side of the wrapper, ...
0
votes
0answers
86 views

Linking to C++ files [duplicate]

I have written mathematica file that does manipulations on a certain set of points. I would like to access code that someone else has written for a least square fit in C++. How do I access this C++ ...
0
votes
1answer
470 views

Random numbers in C++ and Mathematica gives wrong results? [closed]

I have the following strange phenomenon which puzzles me!: I have a piecewise constant probability density given as ...
3
votes
1answer
219 views

Handling error in WSTP program C/C++

I have a program, written in C++, which uses WSTP to communicate with Mathematica 10 (i.e., linked using Install["name_program"]). How should my code report an ...
0
votes
1answer
6k views

Error message LNK2019, unresolved external symbol _output referenced in function __tr0

I've successfully compiled the simple addtwo function predefined in Mathematica as per: MathLink dependencies: "LNK2019: unresolved external symbol _MLMain" I am now attempting to write an ...
6
votes
0answers
477 views

How to force the compilation language to be C++ (not C) in CreateExecutable or CreateLibrary

I'm trying to speed up a section of a Mathematica 9.0.1 notebook by performing some calculations in C++ with the Cilk Plus and Threading Building Blocks tools available for the Intel C++ 14.0 compiler ...
1
vote
1answer
161 views

Hide MathKernel Tab on Taskbar when using C++ [duplicate]

I am connecting to MathKernel.exe using C++ via MathLink on Windows. Hence, to create the link, this is what I use: ...
1
vote
1answer
320 views

Read expression from Mathematica via Mathlink C++

This is a simple C++ program to send an expression to the_Mathematica_ Kernel and get its response. ...
1
vote
1answer
102 views

MLEvaluate() Function Gives Error

I am trying to link my C++ program to Mathematica Kernel. I am trying to use the MLEvaluate() evaluate but I receive an error while compilation. My codes are as below: ...
0
votes
0answers
65 views

Compiling Visual Studio C++ to Run on Computers without Mathematica [duplicate]

I have written a console application on Visual Studio C++ as below ...
2
votes
1answer
616 views

Creating a C++ project with Visual Studio 2010

I am trying to create a GUI using Microsoft Visual Studio C++ 2010 by calling Mathematica in my codes. I have done everything step by step as mentioned here Then I wrote this code as mentioned in ...
18
votes
1answer
1k views

Calling Mathematica from Visual Studio - example

I am trying to set up a connection between Visual Studio 10 and Mathematica 8.0 on a Windows system. I found several sources of information on the Wolfram website, but I get entirely lost. Most of the ...
-1
votes
1answer
487 views

Making a C++ callable .lib or .dll file from a Mathematica notebook [duplicate]

MATLAB supports conversions of their function files into C++ callable libraries. I was wondering if the same feature is also available in Mathemathica? If yes, can you please guide me where I can ...
7
votes
2answers
1k views

How to convert data types in a LibraryLink wrapper

I have a dynamic library which I want to load into Mathematica using LibraryLink. I don't have access to the source code of the library, so I need a C wrapper to do the job. In the C wrapper, I would ...
2
votes
1answer
296 views

Executing C programs within mathematica [duplicate]

I have a requirement for executing a C program within Mathematica. The user will provide the inputs and the expected results on a front end. Mathematica runs the C file, obtains the result for the ...
0
votes
1answer
643 views

using Mathematica's matrix multiplication in C++

Is there any way that I can utilize Mathematica's matrix multiplication in a C++ program? I'm making a 3D graphics engine (for class) in C++ and I would really like to use Mathematica for all of my ...
9
votes
2answers
551 views

MathLink and C++ vector container

The Problem. I have a C++ class that does some computations, and returns a C++ vector object (the length of which can possibly vary with each run). I want to store each of these vectors as a list in ...