diffusion.h

I'm done with the backbone of it, I haven't had feedback on it.
This commit is contained in:
2025-09-29 20:54:06 +02:00
parent 99e0f3fda4
commit a86410fda7
14 changed files with 307 additions and 140 deletions
+4
View File
@@ -0,0 +1,4 @@
// "./utils/generators.h"
#pragma once
#include "./utils/generators/linspace.h"
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "utils/vector.h"
namespace utils{
template <typename T>
void inplace_linspace(utils::Vector<T>& a, T start, T stop, bool endpoint=true){
uint64_t N = a.size();
T step;
if (endpoint){
step = (stop - start) / static_cast<T>(N - 1);
}else{
step = (stop - start) / static_cast<T>(N);
}
for (uint64_t i = 0; i < N; ++i){
a[i] = start + (step*static_cast<T>(i));
}
}
template <typename T>
utils::Vector<T> linspace(T start, T stop, uint64_t N, bool endpoint=true){
utils::Vector<T> a(N);
inplace_linspace(a, start, stop, endpoint);
return a;
}
} // end namespace utils
+1
View File
@@ -3,3 +3,4 @@
#include "./utils/vector.h"
#include "./utils/matrix.h"
#include "./utils/generators.h"