Sync public subset from Flux

This commit is contained in:
Gitea CI
2025-10-08 16:08:04 +00:00
parent 35023cb7e1
commit 1c93024ff2
10 changed files with 260 additions and 133 deletions

View File

@@ -23,7 +23,7 @@ namespace utils{
class Matrix{
public:
Matrix() : rows_(0), cols_(0), data_() {} // Default constructor
#include <random>
// Constructor to initialize matrix with rows × cols and a fill value
Matrix(uint64_t rows, uint64_t cols, const T& value = T())
: rows_(rows), cols_(cols), data_(rows * cols, value) {}

View File

@@ -7,7 +7,7 @@
#include <initializer_list>
#include "./utils/random.h"
#include <cstdint>
#include <type_traits>
#include <stdexcept>
@@ -38,6 +38,24 @@ public:
void random(const uint64_t size, const T& lower, const T& higher){
v.resize(size, T{0});
// Copy data row by row
for (uint64_t i = 0; i < size; ++i) {
v[i] = utils::random(lower, higher);
}
}
//##########################################################
//# VECTOR: --- basic properties --- #
//##########################################################