Porting OCTAVE C++ to iOS - c++

i'd been surfing the web for several hours finding always the same sites and no real answer to my query. Here's the thing, i'd like to port some of the Octave functions to a iPad/iPhone app.
i'd already tried to mix C++ with Obj-C and it works like a charm BUT i haven't been able to find the right source of OCTAVE to compile at least the very core of it, i did download the source code from sourceforge.net but i'd had seen some fortran and some other languages classes but not c++ classes.
Does anyone over here had found or had worked with some C++ classes that holds the OCTAVE functions so i can port that to iOS.
Thanks in advance for your time.
Regards,
Jorge.

This may not answer your question, but might help: If the Octave functions you are using are relatively simple, you could try using a linear algebra package such as Armadillo. The docs contain a conversion sheet from Octave/MATLAB to C++.

Check if the functions you need are in Accelerate.framework, it embeds BLAS and it's optimized for each platform.

Related

Converting from C++ with OpenGL to Objective-C code

I recently bought a Mac, and want to rewrite a few of my programs in Objective-C with Cocoa, but have no experience in either.
What I imagine would be the easiest to start with was some of my OpenGL code in C/C++ (just my classes, macros, and math functions mostly). I read somewhere C++ code can be used in Objective-C++ compilers. Is this true, and if so, how do I include the files?
Also, where can I find good resources on how to maybe start a basic application with Cocoa in Objective-C? The resources for Cocoa seem to be sparse compared to that of Windows and OpenGL, so I am having trouble finding information (free information mind you).
I would appreciate any help at all, also let me know if you think this conversion is a bad idea. Thanks in advance!
Why converting when you can import the C++ code as is? You just have to change your objective-C files that call C++ functionality from .m to .mm, please check the following link:
http://answers.oreilly.com/topic/631-how-to-get-c-and-objective-c-to-play-nicely-in-xcode/

Can I use C++ with UDK?

Can I use C++ with UDK? I know they mention unrealscript on their page but I've also heard that C++ can be used instead, is that so?
It depends. If you use the free version of UDK you can't code the game in C++, but you can include self written DLLs which can be written in C++.
If you become a licensee you get the C++ source code of the unreal engine 3 and then are able to program in C++.
But getting the source code is very expensive, several grand if I recall correctly, so you are probably stuck with UnrealScript for the majority of your time.
More information about how use DLL:
Calling DLLs from UnrealScript (DLLBind)
Unreal Engine 4 was released recently for 20$/month + 5% of profits, and you get access to its source code which you can compile with your code together.
However, you won't find the UnrealScript component, the only scripting solution available is the GUI-based Kismet-like thingy.

code for CRF implementation in C++ or Matlab for images

I need some code for CRF implementation in C++ or Matlab for images for segmentation problem. Which is the more appropriate code library? It will be great if it supports higher order energy terms
Thanks in advance.
I've had great success with Justin Domke's JGMT. It is written in C++ and can be used from Matlab. I would recommend you look at this library first.
There are plenty of other options: CRFSuite which is written in C++ but easily accesible from Python and stuff.
There is also CRF++ which is written in C++ and does have bindings for Python and Ruby.

Reading/manipulating images in C++

I am a frustrated newbie of C++ who would like to do the simple task of extracting a pixel matrix from an image file, do some transformation, and then output the modified matrix to an image format of my choosing.
I've given libpng a try and it's API is a mess and hardly readable. Interestingly, some people said it's the best available for C++. I gave my software developer cousin a call and he told me to use OpenGL. So, I did some Googling and I still haven't found a straight answer.
It appears getting a simple "int* readPNG(char* path)" is too much to ask for when the likes of Java, Matlab, and python have these things included in their standard libraries. This is just ridiculous! How do you pros come by and what libraries do you use?
Also a few trivial C++ questions:
- Is there any way to organize classes in a hierarchy like how packages are used in Java? I tried filters in Visual C++ but they don't seem to be the same thing.
- Is there any way to get easily comprehensible stack traces for runtime failures?
Try OpenCV. It is an image processing library with very simple features for editing and saving the images. It will serve your purpose. It also comes with very elegant documentation.
I've found ImageMagick's Magick++ library to be the most useful tool for handling image formatted data programmatically.
C++ has namespaces like Java but they are much more difficult to use and may only make things less readable. As for stack traces, I recommend combing the existing stackoverflow answers for that. In short, it's not simple.
I suggest you improve your Google-fu. There are lots of image processing libraries for C++, including the Boost Generic Image Library, which is as close to standard as you'll get. If you don't have Boost installed and minimal fuss installing libraries, you can always try The CImg Library.
As for your other questions (e.g. stack traces), you'll need to ask separate questions.
I'd suggest Magick++, the C++ API to ImageMagick.
As for packages: you can use namespaces, but that's not nearly comparable to Java's packages (no package-level access etc). They're mostly what they're called: a means to organize names.
Stack traces are not trivial in C++. And there's no platform-independent way of implementing them that I'm aware of.
If you need these features, I just wonder why you don't stick with Java or Python or the likes ? ...
1) Try freeImage - very easy to use and the documentation is readable.
freeimage site
2) for stack traces: which environment are you working with? In Visual Studio there is Stack window (Debug/Windows/Call Stack - Alt 7),
You can also use DebugView and OutputDebugString - not really traces the stack, but can be very usable in debugging. .
I recommend DevIL (formerly known as OpenIL). It has read and write support for 17 formats, and supports many more for just reading.
This is my answer to my very own question here:
Some of the suggested libraries up there have issues with installation with Visual Studio 2010, offer practically no instructions for installation with Visual Studio (i.e. FreeImage), or simply have ridiculously messy API's (i.e. libpng).
If you are new to C/C++, please be careful about what library to choose. Even if there are technical forums roaming with gurus who knows all the answers, you are most likely on your own spending days experimenting and piecing up clues that experienced volunteers could've easily answered in 2 sentences (if they bothered).
Now, what works for me is the OpenCV image library (http://opencv.willowgarage.com/), which is introduced by Mister daerty0153 up there. When you go on the website, don't download the superpack from sourceforge. Instead, read the installation instructions (http://opencv.willowgarage.com/wiki/InstallGuide) and choose what platform you are using.
In my case, I use Visual Studio 2010 as my IDE and so this is the actual subpage that is relevant: http://opencv.willowgarage.com/wiki/VisualC%2B%2B
One problem I encountered is letting VS2010 recognize the .dll files and is not remedied by following those instructions. My solution was to copy all of them to my project folder and that solves all the problem. Some suggested it is a VS 2010 bug.
Hope it helps others suffering from the same situation.

Call MATLAB APIs in C/C++

I just heard from somewhere that for numerical computation, "MATLAB does offer some user-friendly APIs. If you call these APIs in your C/C++ code, you can speed up computation dramatically."
But I did not find such information in MATLAB documents like http://www.mathworks.com/support/tech-notes/1600/1622.html and http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/bp_kqh7.html. All I learned from these websites is that MATLAB can be called in C and C++ by Matlab engine or by compiling M-files into libraries by mcc. They don't mention any built-in numerical MATLAB APIs that can be called in C/C++.
Can someone please clarify?
Thanks and regards!
You want the "Engine" routines. This allows you to start up a background MATLAB process from C and execute calculations on it: relevant MATLAB documentation.
It works pretty well, have a look at the examples. I would say the most annoying thing getting it working is marshaling the data between C and MATLAB. But that's always a problem when doing this kind of thing.
It sounds like you're looking for the code generation tools in the embedded matlab toolbox or real time workshop.
Do doc eml and look for a the LMS (least mean square) equalizer demo.
The code generator is quite good, it will give you a make file that will build a static library. It's easy to use with your stand alone C/C++ code.
There could be a few things that quote is referencing, I assume that it is referring to the MATLAB Compiler. So going from MATLAB -> C++ you can use the compiler to build standalone "faster" applications. However, when speed testing the improvement, I've noticed it to be negligible. Honestly, you're probably far better off coding your work in C from the get-go, the code that the compiler generates is spaghetti and non-object oriented. I should also mention that this is an expensive extension to Matlab.
You can use the MCR in your own c++ project as a stand-alone library (details)... but you might get similar results using Numerical Recipes.
Disclaimer: I used this product 2-3 years ago, things could be different now.