returning numpy arrays via pybind11

I have a C++ function computing a large tensor which I would like to return to Python as a NumPy array via pybind11. From the documentation of pybind11, it seems like using STL unique_ptr is desirable. In the following example, the commented out ...
more »

2017-06-20 19:06 (1) Answers

Cache behaviour - Vector vs Containers

In one of Scott Meyers talks, I understood that while accessing an element in an array/ vector, the subsequent memory (based on forward or reverse access pattern) is brought along in the cache line for CPU access. In that case for non relatively huge...
more »

2017-06-19 23:06 (0) Answers

Is using List<Byte> not good idea?

I need to re-write some C++ code in Java that I wrote years ago. In C++, I used a std::vector<unsigned char> buffer to implement a buffer which I would retrieve from a socket connection. With this buffer I do all kinds of operations: Have a...
more »

2017-06-19 04:06 (2) Answers

Class cross referencing?

I come from a C++ background and I am a bit lost without the whole pointer concept in python. Or at least it's unclear. For instance, I want to create a game of tick tack toe using OOP in Python. I have a couple classes like so: class Game(object): ...
more »

2017-06-18 01:06 (1) Answers

urlmon - stuck cache

I need to download one file every 5 minutes. The problem is my program saves cache and it downloads the same file for 2 days. I heard about the function DeleteUrlCacheEntry(), but I don't know the right syntax. I spent whole day to solve this problem...
more »

2017-06-17 22:06 (0) Answers

C++: Class within another class as type?

could someone explain me this kind of "inheritance" which can be found in class Y: private? class X { private: char c_; public: X(char c) : c_(c){} }; class Y { private: X x_; // What is this ? public: Y(X x): x_(x){} }; int main() { X m...
more »

2017-06-15 18:06 (1) Answers

How to sort numbers in a large text file

My task is to sort a large text file (>1GB) where numbers are arranged one per row as in the following example: 1906885614 1069046615 1576929003 1690826360 1540261768 786870227 1737467783 295136587 685162468 This is what I have done so far. #inc...
more »

2017-06-15 16:06 (2) Answers

FPGA - CPU Latency measurement with C/C++

I am trying to measure Read/write Latency between an ARM CPU and An FPGA in the same board. I am wondering if using the global timer is sufficient to report this latency in term of clock cycles, because the ARM and the FPGA are running at different f...
more »

2017-06-15 13:06 (3) Answers

Use-case of #pragma start and #pragma exit

#pragma startup and #pragma exit: These directives helps us to specify the functions that are needed to run before program startup( before the control passes to main()) and just before program exit (just before the control returns from main()...
more »

2017-06-15 09:06 (3) Answers

Having trouble with class constructors printing

I'm trying to learn how classes and their constructors work by creating a Time class that includes an hour, minute, and second. I wanted to print one time by using the default constructor and one through user input. While my program compiles, it does...
more »

2017-06-14 23:06 (4) Answers

QT QApplication:setFont() Questions

In my main.cpp I set the font of the application like so: //Font QString fontPath = ":/data/COUR.TTF"; int id = QFontDatabase::addApplicationFont(fontPath); QString family = QFontDatabase::applicationFontFamilies(id).at(0); QFont default_font(family...
more »

2017-06-14 12:06 (0) Answers

C++ template class in header

this is my first question so i hope it wont be super stupid one. I read all related posts on this topic but i still didnt manage to apply that on my situation. I made simple function sortVectByName which sorts vector of class player, which works just...
more »

2017-05-26 22:05 (0) Answers

Ways to optimise this code

I am exploring ways to optimise the code that follows. The code loops over a string. For the ith character in the string, the code increments one entry in a 2D array at the ith column. The exact entry at the ith column that is incremented depends on...
more »

2017-05-26 21:05 (2) Answers

returning an array as an object in C++

I'm just recently getting into C++ and bashing my head a little bit on the following topic: I have a Class with 3 double values of which I create the object "supportRefl[4]" as an array. I now want to return the array in the function "position" of ...
more »

2017-05-26 21:05 (3) Answers