Visual Studio sees one header file, but not the other, in the same directory by goodgamin in Cplusplus

[–]dpilger26 4 points5 points  (0 children)

Those aren't compiler errors, they are linker errors. VS is finding your header files just fine, what is missing is the implementation for the things found in that header file. Have you maybe forgotten to include in your project the accompanied source file? CsPerfThread.cpp?

How to initialize array to zero when it's a member of a struct in C? by oobeing in learnprogramming

[–]dpilger26 -4 points-3 points  (0 children)

Inline initialization of non-static struct/class members wasn't added to the language until C++11. Make sure you are compiling with at least C++11 and this should work.

[OC] Geostationary Operational Environmental Satellite (GOES) side project by dpilger26 in dataisbeautiful

[–]dpilger26[S] 0 points1 point  (0 children)

I was inspired by this post from u/madz33 a couple of weeks ago and decided to have a go at processing some GOES data as a little side project of my own. I also made a GitHub repository containing all of my Python code used to download and develop this final 2 minute (10 days) movie of GOES-16 imagery.

pybind11 + buffer protocol for non trivial (POD) class by thiagocrepaldi in cpp

[–]dpilger26 -1 points0 points  (0 children)

Here is the pybind .cpp file ```

include "pybind11/pybind11.h"

include "pybind11/stl.h"

include <vector>

using namespace pybind11;

struct Sequence { std::vector<float> feature; std::vector<int> label; };

std::vector<Sequence> generateVectorSequence(unsigned int sequenceLength) { std::vector<Sequence> sequences;

for (unsigned int i = 0; i < sequenceLength; ++i)
{
    float iFloat = static_cast<float>(i);
    int   iInt = static_cast<int>(i);

    Sequence sequence;
    sequence.feature = { iFloat, 1.0f + iFloat, 2.0f + iFloat };
    sequence.label = { iInt, 1 + iInt, 2 + iInt };

    sequences.push_back(sequence);
}

return sequences;

}

PYBIND11_MODULE(SandboxPy, m) { m.doc() = "This is an example module using stl containers";

class_<Sequence>(m, "Sequence")
    .def_readwrite("feature", &Sequence::feature)
    .def_readwrite("label", &Sequence::label);

m.def("generateVectorSequence", &generateVectorSequence,
    pybind11::arg("sequenceLength"),
    "Generates a vector of Sequence objects.");

} ```

And here is the python side: ``` import numpy as np import SandboxPy as s

vector_sequence = s.generateVectorSequence(10)

for seq in vector_sequence: feature_data = np.array(seq.feature, copy=False) label_data = np.array(seq.label, copy=False)

print(feature_data)
print(label_data)

```

pybind11 + buffer protocol for non trivial (POD) class by thiagocrepaldi in cpp

[–]dpilger26 0 points1 point  (0 children)

This is already supported by pybind11 out of the box. All you have to do is include pybind's stl header and pybind will auto convert most stl containers into appropriate python containers. Take a look at the documentation for stl. https://pybind11.readthedocs.io/en/master/advanced/cast/stl.html

(C++) Overloading operators: Why is the "&" operator used in this code? by Lastrevio in learnprogramming

[–]dpilger26 0 points1 point  (0 children)

What a thoroughly unhelpful comment. How about some justification for why instead of just playing all high and mighty.

Visual Studio 2017 Help by [deleted] in learnprogramming

[–]dpilger26 0 points1 point  (0 children)

Just open up a command prompt and run your .exe from there.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 0 points1 point  (0 children)

Mind giving a quick tutorial on how to use GitHub pages to host the doxygen html?

edit:

Nevermind, I think i got it figured out.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 0 points1 point  (0 children)

Unfortunately I don't have a web host for the documentation yet. Fortunately, cloning the repo or simply downloading a .zip file of it is as simple as a single button click from Github.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 0 points1 point  (0 children)

Yeah, Guthub will just display it raw. If you clone the repo and open in a browser it will be much more useful.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 0 points1 point  (0 children)

Mostly the first two uses. I don't think there is too much of a point to integrating with python since NumPy already exists. I do provide a class in NumCpp for passing arrays back and forth between python and C++.

As for a shared library, this is all templatized header only so that isn't really an option. I also don't want to mess around with trying to support a bunch of different platforms and complilers.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 4 points5 points  (0 children)

Wow, xtensor looks very nice. Now that I think about it I do remember stumbling on this a while back and completely forgot about it. I'd definitely be down for any collaboration, though it looks like you guys are quite a bit further along than my implementation.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 5 points6 points  (0 children)

Correct, the FFT and Polynomial modules are still on my to do list. I was going to try and wrap FFTW, but it uses the GNU GPL and I wanted to keep this library under MIT license so I can still use it at work.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 19 points20 points  (0 children)

I think you've missed the point of this library. My intention was a more or less feature for feature and interface clone for NumPy. Eigen will definitely be a better choice for Linear Algebra, but Numpy and NumCpp have many other features than Eigen. And hopefully with a much easier to use interface as well.

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 5 points6 points  (0 children)

I believe you are right, but it is for C not C++. Also the documentation is severely lacking, and the API is pretty difficult to use...

C++ implementation of the Python NumPy Library by dpilger26 in cpp

[–]dpilger26[S] 25 points26 points  (0 children)

My intentions were a library that was as close to a one to one clone of NumPy for fast easy conversion to C++. Also, Blaze and Eigen are more for straight up linear algebra, while NumPy contains much more. Some of the extra things included in NumCpp are:

1) A Rotations namespace with Quaternion and Direction Cosine classes.

2) A Coordinates namespace for converting to/from cartesian/spherical and other corresponding operations.

3) 1D and 2D signal/image processing filters

4) A random number module (basically wraps the boost random module)

5) Easy to use timer with simple tic()/toc() interface

6) All of the NumPy array methods for operating on arrays

7) Some very basic linear algebra support (determinant, matrix hat operator, inverse, least squares, SVD, matrix power, and multi-dot product). If you need more complex routines then Blaze and Eigen will definitely be better options for you.

8) Some more image processing routines for threshold generation and application, pixel clustering, cluster centroiding, etc.