mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Vector, Matrix and Tensor3 api cleanups.
This commit is contained in:
parent
ce49ed294b
commit
90dbd6657e
@ -112,8 +112,8 @@ void MLPPMatrix::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("resize", "size"), &MLPPMatrix::resize);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPMatrix::get_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPMatrix::set_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPMatrix::get_element);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPMatrix::set_element);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_row_pool_vector", "index_y"), &MLPPMatrix::get_row_pool_vector);
|
||||
ClassDB::bind_method(D_METHOD("get_row_mlpp_vector", "index_y"), &MLPPMatrix::get_row_mlpp_vector);
|
||||
|
@ -246,19 +246,6 @@ public:
|
||||
|
||||
return _data[p_index_y * _size.x + p_index_x];
|
||||
}
|
||||
_FORCE_INLINE_ real_t get_element(int p_index_y, int p_index_x) {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
|
||||
return _data[p_index_y * _size.x + p_index_x];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element_bind(int p_index_y, int p_index_x) const {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
|
||||
return static_cast<real_t>(_data[p_index_y * _size.x + p_index_x]);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element(int p_index_y, int p_index_x, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index_x, _size.x);
|
||||
@ -267,13 +254,6 @@ public:
|
||||
_data[p_index_y * _size.x + p_index_x] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element_bind(int p_index_y, int p_index_x, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index_x, _size.x);
|
||||
ERR_FAIL_INDEX(p_index_y, _size.y);
|
||||
|
||||
_data[p_index_y * _size.x + p_index_x] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector<real_t> get_row_vector(int p_index_y) {
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, Vector<real_t>());
|
||||
|
||||
|
@ -129,8 +129,8 @@ void MLPPTensor3::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("resize", "size"), &MLPPTensor3::resize);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPTensor3::get_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPTensor3::set_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index_x", "index_y"), &MLPPTensor3::get_element);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index_x", "index_y", "val"), &MLPPTensor3::set_element);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_row_pool_vector", "index_y"), &MLPPTensor3::get_row_pool_vector);
|
||||
ClassDB::bind_method(D_METHOD("get_row_mlpp_vector", "index_y"), &MLPPTensor3::get_row_mlpp_vector);
|
||||
|
@ -250,21 +250,6 @@ public:
|
||||
|
||||
return _data[p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z];
|
||||
}
|
||||
_FORCE_INLINE_ real_t get_element(int p_index_y, int p_index_x, int p_index_z) {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_z, _size.z, 0);
|
||||
|
||||
return _data[p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element_bind(int p_index_y, int p_index_x, int p_index_z) const {
|
||||
ERR_FAIL_INDEX_V(p_index_x, _size.x, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, 0);
|
||||
ERR_FAIL_INDEX_V(p_index_z, _size.z, 0);
|
||||
|
||||
return static_cast<real_t>(_data[p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z]);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element(int p_index_y, int p_index_x, int p_index_z, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index_x, _size.x);
|
||||
@ -274,14 +259,6 @@ public:
|
||||
_data[p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element_bind(int p_index_y, int p_index_x, int p_index_z, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index_x, _size.x);
|
||||
ERR_FAIL_INDEX(p_index_y, _size.y);
|
||||
ERR_FAIL_INDEX(p_index_z, _size.z);
|
||||
|
||||
_data[p_index_y * _size.x + p_index_x + _size.x * _size.y * p_index_z] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Vector<real_t> get_row_vector(int p_index_y, int p_index_z) {
|
||||
ERR_FAIL_INDEX_V(p_index_y, _size.y, Vector<real_t>());
|
||||
ERR_FAIL_INDEX_V(p_index_z, _size.z, Vector<real_t>());
|
||||
|
@ -56,8 +56,8 @@ void MLPPVector::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("size"), &MLPPVector::size);
|
||||
ClassDB::bind_method(D_METHOD("resize", "size"), &MLPPVector::resize);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index"), &MLPPVector::get_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index", "val"), &MLPPVector::set_element_bind);
|
||||
ClassDB::bind_method(D_METHOD("get_element", "index"), &MLPPVector::get_element);
|
||||
ClassDB::bind_method(D_METHOD("set_element", "index", "val"), &MLPPVector::set_element);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("fill", "val"), &MLPPVector::fill);
|
||||
ClassDB::bind_method(D_METHOD("insert", "pos", "val"), &MLPPVector::insert);
|
||||
|
@ -165,26 +165,12 @@ public:
|
||||
ERR_FAIL_INDEX_V(p_index, _size, 0);
|
||||
return _data[p_index];
|
||||
}
|
||||
_FORCE_INLINE_ real_t get_element(int p_index) {
|
||||
ERR_FAIL_INDEX_V(p_index, _size, 0);
|
||||
return _data[p_index];
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t get_element_bind(int p_index) const {
|
||||
ERR_FAIL_INDEX_V(p_index, _size, 0);
|
||||
return static_cast<real_t>(_data[p_index]);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element(int p_index, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index, _size);
|
||||
_data[p_index] = p_val;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ void set_element_bind(int p_index, real_t p_val) {
|
||||
ERR_FAIL_INDEX(p_index, _size);
|
||||
_data[p_index] = p_val;
|
||||
}
|
||||
|
||||
void fill(real_t p_val) {
|
||||
for (int i = 0; i < _size; i++) {
|
||||
_data[i] = p_val;
|
||||
|
Loading…
Reference in New Issue
Block a user