Machine code and assembly code is sometimes called native code when referring to platform-dependent parts of language features or libraries.
2
votes
1answer
85 views
Reading a string-to-string map from an archive
I have a CArchive with contains a serialized CMapStringToString.
From my research it is my understanding that it is quite ...
8
votes
2answers
151 views
Call a lua function - the C++ way
I'm not that good when it comes to templates, especially when it comes to variadic templates. I want to show you some code where I use both - templates and variadic templates - to call a lua function. ...
2
votes
1answer
97 views
Two knot-removal function for curve and surface
Update
For the curve case, the control points is a vector, here \$\mathbf{P}_i=\{x_i, y_i\}\$
{P_0, P_1, ..., P_n}
While for surface case, the control nets is a ...
2
votes
2answers
154 views
How do I write my multithreading code correctly so that it is faster than a single thread?
I have the following code that I am trying to optimize. I am running it on a Linux machine with 24 cores. I thought I could use multithreading to make it faster, but it's somehow making it way slower ...
3
votes
1answer
99 views
Counting matrix elements that have “4” or “5” as a neighbor
I have a matrix (500x500) of integers. For each entry, I need to look at its surrounding neighbours (so 8 elements) and determine what the integers are, and run a function on these integers.
Here ...
3
votes
0answers
78 views
Reduce encoded length of UTF-8 encoded Ruby string in C extension
I'm writing a Ruby extension in C. It's a string processing module working on UTF-8 encoded strings only.
One method, full_width_to_ascii!, converts full width ...
5
votes
0answers
164 views
Calculating complex exponential numbers using OpenMP in Cython
I am trying to create a function that can either beat numexpr or perform comparably for the vectorized mathematical operation ...
4
votes
1answer
116 views
Same PyObject for a shared_ptr C++ object
I have a similar problem as in this mail. I want that every time I return the same C++ managed object to Python, I get the same PyObject. With the standard ...
3
votes
2answers
144 views
Hello World using Python embedded in C++, with RAII library initialization
I have written a small Hello World application that uses Python's C-API. The C library requires some functions to be called for global library (de-)initialization and the objects created by the ...
4
votes
1answer
108 views
Mean of the squares of differences for a large matrix
I have tried to obtain speed gains by transferring Matlab calculations to C and call it using .mex. My goal is to operate on a matrix \$B\$ which has roughly the dimension 10000x1000
$$
\frac{1}{\...
6
votes
3answers
5k views
k-nearest neighbors using MATLAB with MEX
I have implemented kNN (k-nearest neighbors) as follows, but it is very slow. I want to get an exact k-nearest-neighbor, not the approximate ones, so I didn't use the FLANN or ANN libraries.
...
7
votes
1answer
220 views