anuranbaka / cppnumpy Goto Github PK
View Code? Open in Web Editor NEWCPP numpy compatible library
License: GNU General Public License v3.0
CPP numpy compatible library
License: GNU General Public License v3.0
Broadcasting behavior currently isn't implemented when using a matrix mask to index another matrix.
The following code should work:
Mat<> a({1,2,3,4,5,6,7,8,9},3,3);
Mat<bool> b({true, false, true},1,3);
a.i(b);
Just like the title says, we don't have one and need one before we can implement it
In Python, calling = causes a reference to be made to the matrix, but in C++ it creates a view. This leads to the following code not being translatable to C++:
import numpy as np
a = np.array([1,2,3,4])
b = a
a.shape = (2,2)
print(b.ndim)
of course in C++ there is no way to set the dims member of an existing matrix anyway, but I worry there may be other ways the abstraction leaks.
The reference counters on 32 bit machines are typically 32 bits, but we specify 64 bits.
Planned Resolution:
Change the reference counter to 32 bits to be compatible with 32 bit libraries. Cast any incoming 64 bit reference counter pointers to 32 bit and check that the endianness is such that this is okay. Big endian machines will not support wrapping 64bit pointers in the library.
Reported by @mepster
Performing a compound operation on two matrices with the same backing data results in an error due to lack of buffering.
For example:
Mat<> a({1,2,3,4,5,6},2,3);
a += a.roi(0,1,0,3);
a.print();
This should return:
[[2,4,6]
[5,6,7]]
But instead returns:
[[2,4,6]
[6,9,12]]
matrix size must be calculated each time an iterator is constructed with end(). Maybe store the end() iterator as a member?
A fresh download doesn't install on a clean system anymore. The problem is we added build directories that aren't in the repo, and it screws up make.
Add the empty directories to the repo or have them get generated at build time.
check if nested initializer lists are available
Mat M{{1,2},{3,4}};
Originally posted by @anuranbaka in #23 (comment)
The refcount being in the Mat header doesn't work because the header can be torn down by the program stack unwinding.
For now, let's see if things work by always dynamically allocating and destructing the base object. If that works, we can strip it down to a simpler base.
The README says:
The operator "^" is used for matrix multiplication rather than bitwise XOR
But "^" is the bitwise XOR operater... Perhaps you're actually using some other operator and "^" is a misprint?
Perhaps you are actually using the "@" operator in Python, which is reserved for matrix multiplication?
Matrices containing elements with different numbers of digits are difficult to read due to the single whitespace separating each element. Smarter formatting could be used for better readability.
open a ticket to evaluate the difference between the python behavior and c++
a=np.array([2,4])
b=np.array([1,3])
print(a|b)
Originally posted by @anuranbaka in #23 (comment)
Python effectively has a [] =
operator, implemented by __setitem__
, and it is also used in things like foo[bar] += buzz
For things that are a rectangular roi, C++ mostly does what Python does. But as far as I can tell there is no clear way for us to implement
a[a>5] += 7
in C++.
I think we probably need a fancy index object to make this work
Make CI able to build the project, so the regression test is useful
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.