From 25ce447853ea50791b0c001ea4f8f8fa5e7a4a58 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 26 Dec 2023 23:21:33 +0100 Subject: [PATCH] Added a raw pointer based constructor to MLPPVector. --- mlpp/lin_alg/mlpp_vector.cpp | 10 ++++++++++ mlpp/lin_alg/mlpp_vector.h | 1 + 2 files changed, 11 insertions(+) diff --git a/mlpp/lin_alg/mlpp_vector.cpp b/mlpp/lin_alg/mlpp_vector.cpp index 53660ed..5f0ec7f 100644 --- a/mlpp/lin_alg/mlpp_vector.cpp +++ b/mlpp/lin_alg/mlpp_vector.cpp @@ -1457,6 +1457,16 @@ MLPPVector::MLPPVector(const PoolRealArray &p_from) { } } +MLPPVector::MLPPVector(const real_t *p_from, const int p_size) { + _size = 0; + _data = NULL; + + resize(p_size); + for (int i = 0; i < _size; i++) { + _data[i] = p_from[i]; + } +} + MLPPVector::~MLPPVector() { if (_data) { reset(); diff --git a/mlpp/lin_alg/mlpp_vector.h b/mlpp/lin_alg/mlpp_vector.h index c1258cb..0b2f64a 100644 --- a/mlpp/lin_alg/mlpp_vector.h +++ b/mlpp/lin_alg/mlpp_vector.h @@ -252,6 +252,7 @@ public: MLPPVector(const MLPPVector &p_from); MLPPVector(const Vector &p_from); MLPPVector(const PoolRealArray &p_from); + MLPPVector(const real_t *p_from, const int p_size); ~MLPPVector();