mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-12-22 15:06:47 +01:00
Added a new helper method to MLPPMatrix.
This commit is contained in:
parent
ecf5e300de
commit
dfee510778
@ -558,6 +558,18 @@ void MLPPMatrix::set_from_arrays(const Array &p_from) {
|
||||
}
|
||||
}
|
||||
|
||||
void MLPPMatrix::set_from_ptr(const real_t *p_from, const int p_size_y, const int p_size_x) {
|
||||
_data = NULL;
|
||||
|
||||
ERR_FAIL_COND(!p_from);
|
||||
|
||||
resize(Size2i(p_size_x, p_size_y));
|
||||
int ds = data_size();
|
||||
for (int i = 0; i < ds; ++i) {
|
||||
_data[i] = p_from[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
std::vector<std::vector<real_t>> MLPPMatrix::gramMatrix(std::vector<std::vector<real_t>> A) {
|
||||
return matmult(transpose(A), A); // AtA
|
||||
@ -3005,6 +3017,18 @@ MLPPMatrix::MLPPMatrix(const Array &p_from) {
|
||||
set_from_arrays(p_from);
|
||||
}
|
||||
|
||||
MLPPMatrix::MLPPMatrix(const real_t *p_from, const int p_size_y, const int p_size_x) {
|
||||
_data = NULL;
|
||||
|
||||
ERR_FAIL_COND(!p_from);
|
||||
|
||||
resize(Size2i(p_size_x, p_size_y));
|
||||
int ds = data_size();
|
||||
for (int i = 0; i < ds; ++i) {
|
||||
_data[i] = p_from[i];
|
||||
}
|
||||
}
|
||||
|
||||
MLPPMatrix::~MLPPMatrix() {
|
||||
if (_data) {
|
||||
reset();
|
||||
|
@ -136,6 +136,7 @@ public:
|
||||
void set_from_mlpp_vectors_array(const Array &p_from);
|
||||
void set_from_vectors(const Vector<Vector<real_t>> &p_from);
|
||||
void set_from_arrays(const Array &p_from);
|
||||
void set_from_ptr(const real_t *p_from, const int p_size_y, const int p_size_x);
|
||||
|
||||
//std::vector<std::vector<real_t>> gramMatrix(std::vector<std::vector<real_t>> A);
|
||||
//bool linearIndependenceChecker(std::vector<std::vector<real_t>> A);
|
||||
@ -359,6 +360,7 @@ public:
|
||||
MLPPMatrix(const MLPPMatrix &p_from);
|
||||
MLPPMatrix(const Vector<Vector<real_t>> &p_from);
|
||||
MLPPMatrix(const Array &p_from);
|
||||
MLPPMatrix(const real_t *p_from, const int p_size_y, const int p_size_x);
|
||||
|
||||
~MLPPMatrix();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user