PIVector reshape and etc...
This commit is contained in:
@@ -260,6 +260,7 @@ class PIP_EXPORT PIMathVector {
|
||||
public:
|
||||
PIMathVector(const uint size = 0, const Type & new_value = Type()) {c.resize(size, new_value);}
|
||||
PIMathVector(const PIVector<Type> & val) {c = val;}
|
||||
PIMathVector(PIVector<Type> && val) : c(std::move(val)) {}
|
||||
PIMathVector(std::initializer_list<Type> init_list) {c = PIVector<Type>(init_list);}
|
||||
|
||||
template<uint Size>
|
||||
@@ -271,6 +272,14 @@ public:
|
||||
for (uint i = 0; i < v.size(); ++i) v.c[i] = fn[i] - st[i];
|
||||
}
|
||||
|
||||
static PIMathVector zeros(const uint size) {return PIMathVector(size, Type());}
|
||||
static PIMathVector ones(const uint size) {return PIMathVector(size, Type(1));}
|
||||
static PIMathVector arange(const Type start, const Type stop, const Type step = Type(1)) {
|
||||
PIVector<Type> v;
|
||||
for (Type i = start; i < stop; i+= step) v << i;
|
||||
return PIMathVector(std::move(v));
|
||||
}
|
||||
|
||||
uint size() const {return c.size();}
|
||||
_CVector & resize(uint size, const Type & new_value = Type()) {
|
||||
c.resize(size, new_value);
|
||||
|
||||
Reference in New Issue
Block a user