Commit aa5cad36 authored by Ben Huber's avatar Ben Huber

fixed compilation with gcc 7.1

parent c1f013a4
Pipeline #770 passed with stages
in 8 minutes and 24 seconds
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <memory> #include <memory>
#include <map> #include <map>
#include <mutex> #include <mutex>
#include <functional>
#include <suitesparse/cholmod.h> #include <suitesparse/cholmod.h>
#include <suitesparse/SuiteSparseQR.hpp> #include <suitesparse/SuiteSparseQR.hpp>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <set> #include <set>
#include <random> #include <random>
#include <functional>
#include "basic.h" #include "basic.h"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <limits> #include <limits>
#include <memory> #include <memory>
#include <random> #include <random>
#include <functional>
#include "basic.h" #include "basic.h"
#include "misc/containerSupport.h" #include "misc/containerSupport.h"
...@@ -159,7 +160,7 @@ namespace xerus { ...@@ -159,7 +160,7 @@ namespace xerus {
* @param _dimensions the dimensions of the new tensor. * @param _dimensions the dimensions of the new tensor.
* @param _data inital dense data in row-major order. * @param _data inital dense data in row-major order.
*/ */
explicit Tensor(DimensionTuple _dimensions, std::unique_ptr<value_t>&& _data); explicit Tensor(DimensionTuple _dimensions, std::unique_ptr<value_t[]>&& _data);
/** /**
...@@ -663,7 +664,7 @@ namespace xerus { ...@@ -663,7 +664,7 @@ namespace xerus {
/** /**
* @brief Resets the tensor to the given dimensions and representation. * @brief Resets the tensor to the given dimensions and representation.
* @details Leaves the Tensor in the same state as if newly constructed with the the same arguments. * @details Leaves the Tensor in the same state as if newly constructed with the the same arguments.
* @param _dimensions the dimensions of the new tensor. * @param _newDim the dimensions of the new tensor.
* @param _representation the new representation of the tensor. * @param _representation the new representation of the tensor.
* @param _init (optional) data treatment, i.e. whether the tensor shall be zero initialized. * @param _init (optional) data treatment, i.e. whether the tensor shall be zero initialized.
*/ */
...@@ -672,7 +673,7 @@ namespace xerus { ...@@ -672,7 +673,7 @@ namespace xerus {
/** /**
* @brief Resets the tensor to the given dimensions, preserving the current representation. * @brief Resets the tensor to the given dimensions, preserving the current representation.
* @param _dimensions the dimensions of the new tensor. * @param _newDim the dimensions of the new tensor.
* @param _init (optional) data treatment, i.e. whether the tensor shall be zero initialized. * @param _init (optional) data treatment, i.e. whether the tensor shall be zero initialized.
*/ */
void reset(DimensionTuple _newDim, const Initialisation _init = Initialisation::Zero); void reset(DimensionTuple _newDim, const Initialisation _init = Initialisation::Zero);
...@@ -685,7 +686,7 @@ namespace xerus { ...@@ -685,7 +686,7 @@ namespace xerus {
/** /**
* @brief Resets the tensor to the given dimensions and uses the given data. * @brief Resets the tensor to the given dimensions and uses the given data.
* @param _dimensions the dimensions of the new tensor. * @param _newDim the dimensions of the new tensor.
* @param _newData new dense data in row-major order. * @param _newData new dense data in row-major order.
*/ */
void reset(DimensionTuple _newDim, const std::shared_ptr<value_t>& _newData); void reset(DimensionTuple _newDim, const std::shared_ptr<value_t>& _newData);
...@@ -693,7 +694,7 @@ namespace xerus { ...@@ -693,7 +694,7 @@ namespace xerus {
/** /**
* @brief Resets the tensor to the given dimensions with data @a _newData. * @brief Resets the tensor to the given dimensions with data @a _newData.
* @param _dimensions the dimensions of the new tensor. * @param _newDim the dimensions of the new tensor.
* @param _newData new dense data in row-major order. * @param _newData new dense data in row-major order.
*/ */
void reset(DimensionTuple _newDim, std::unique_ptr<value_t[]>&& _newData); void reset(DimensionTuple _newDim, std::unique_ptr<value_t[]>&& _newData);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <set> #include <set>
#include <memory> #include <memory>
#include <functional>
#include "misc/fileIO.h" #include "misc/fileIO.h"
#include "indexedTensor.h" #include "indexedTensor.h"
......
...@@ -65,8 +65,8 @@ namespace xerus { ...@@ -65,8 +65,8 @@ namespace xerus {
} }
Tensor::Tensor(DimensionTuple _dimensions, std::unique_ptr<value_t>&& _data) Tensor::Tensor(DimensionTuple _dimensions, std::unique_ptr<value_t[]>&& _data)
: dimensions(std::move(_dimensions)), size(misc::product(dimensions)), representation(Representation::Dense), denseData(std::move(_data)) { : dimensions(std::move(_dimensions)), size(misc::product(dimensions)), representation(Representation::Dense), denseData(_data.release()) {
REQUIRE(size != 0, "May not create tensors with an dimension == 0."); REQUIRE(size != 0, "May not create tensors with an dimension == 0.");
} }
...@@ -600,7 +600,7 @@ namespace xerus { ...@@ -600,7 +600,7 @@ namespace xerus {
representation = Representation::Dense; representation = Representation::Dense;
} }
denseData = std::move(_newData); denseData.reset(_newData.release());
} }
void Tensor::reset(DimensionTuple _newDim, std::map<size_t, value_t>&& _newData) { void Tensor::reset(DimensionTuple _newDim, std::map<size_t, value_t>&& _newData) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment