summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-19 12:17:36 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-05-19 12:17:36 -0300
commit7c44546421ed1c4bc6e5135ec90bccac2a0ac436 (patch)
tree9ac0e633f7b7a9e356ae8e53a2801365bc55de35
parent13bfd9e1cdfe3bc2cc109af67e0648516b5787ea (diff)
downloadcode-7c44546421ed1c4bc6e5135ec90bccac2a0ac436.tar.gz
code-7c44546421ed1c4bc6e5135ec90bccac2a0ac436.tar.bz2
code-7c44546421ed1c4bc6e5135ec90bccac2a0ac436.zip
Cleaned up header inclusions, and renamed some p-spin functions
-rw-r--r--log-fourier.cpp15
-rw-r--r--log-fourier.hpp5
-rw-r--r--log-fourier_integrator.cpp1
-rw-r--r--log_get_energy.cpp2
-rw-r--r--p-spin.cpp16
-rw-r--r--p-spin.hpp5
6 files changed, 23 insertions, 21 deletions
diff --git a/log-fourier.cpp b/log-fourier.cpp
index 07429f1..16a7f3f 100644
--- a/log-fourier.cpp
+++ b/log-fourier.cpp
@@ -1,8 +1,7 @@
#include "log-fourier.hpp"
#include "p-spin.hpp"
-#include <complex>
+
#include <fstream>
-#include <types.hpp>
Complex Γ(Complex z) {
gsl_sf_result logΓ;
@@ -186,8 +185,8 @@ std::tuple<std::vector<Complex>, std::vector<Complex>> ΣD(LogarithmicFourierTra
std::vector<Real> Σ(C.size());
Real β² = std::pow(β, 2);
for (unsigned n = 0; n < C.size(); n++) {
- D[n] = β² * df(λ, p, s, C[n]);
- Σ[n] = β² * R[n] * ddf(λ, p, s, C[n]);
+ D[n] = β² * ∂f(λ, p, s, C[n]);
+ Σ[n] = β² * R[n] * ∂∂f(λ, p, s, C[n]);
}
std::vector<Complex> Σhat = fft.fourier(Σ, false);
std::vector<Complex> Dhat = fft.fourier(D, true);
@@ -207,7 +206,7 @@ Real energy(const LogarithmicFourierTransform& fft, const std::vector<Real>& C,
for (unsigned n = 0; n < C.size(); n++) {
if (C[n] > 1 || R[n] > 1) n₀ = n % 2 == 0 ? n / 2 : (n + 1) / 2;
}
- Real E = fft.t(2*n₀) * df(λ, p, s, 1);
+ Real E = fft.t(2*n₀) * ∂f(λ, p, s, 1);
for (unsigned n = n₀; n < C.size()/2-1; n++) {
Real R₂ₙ = R[2*n];
Real R₂ₙ₊₁ = R[2*n+1];
@@ -220,9 +219,9 @@ Real energy(const LogarithmicFourierTransform& fft, const std::vector<Real>& C,
Real h₂ₙ = fft.t(2*n+1) - fft.t(2*n);
Real h₂ₙ₊₁ = fft.t(2*n+2) - fft.t(2*n+1);
- Real f₂ₙ = R₂ₙ * df(λ, p, s, C₂ₙ);
- Real f₂ₙ₊₁ = R₂ₙ₊₁ * df(λ, p, s, C₂ₙ₊₁);
- Real f₂ₙ₊₂ = R₂ₙ₊₂ * df(λ, p, s, C₂ₙ₊₂);
+ Real f₂ₙ = R₂ₙ * ∂f(λ, p, s, C₂ₙ);
+ Real f₂ₙ₊₁ = R₂ₙ₊₁ * ∂f(λ, p, s, C₂ₙ₊₁);
+ Real f₂ₙ₊₂ = R₂ₙ₊₂ * ∂f(λ, p, s, C₂ₙ₊₂);
E += (h₂ₙ + h₂ₙ₊₁) / 6 * (
(2 - h₂ₙ₊₁ / h₂ₙ) * f₂ₙ
diff --git a/log-fourier.hpp b/log-fourier.hpp
index 5651ddb..755f7e9 100644
--- a/log-fourier.hpp
+++ b/log-fourier.hpp
@@ -1,10 +1,11 @@
#pragma once
+
#include "types.hpp"
-#include <cmath>
-#include <fftw3.h>
#include <vector>
#include <tuple>
+
+#include <fftw3.h>
#include <gsl/gsl_sf_gamma.h>
class LogarithmicFourierTransform {
diff --git a/log-fourier_integrator.cpp b/log-fourier_integrator.cpp
index 30354a6..3ae00dd 100644
--- a/log-fourier_integrator.cpp
+++ b/log-fourier_integrator.cpp
@@ -1,4 +1,5 @@
#include "log-fourier.hpp"
+
#include <getopt.h>
#include <iostream>
#include <iomanip>
diff --git a/log_get_energy.cpp b/log_get_energy.cpp
index 9ec8145..d156fd4 100644
--- a/log_get_energy.cpp
+++ b/log_get_energy.cpp
@@ -1,6 +1,6 @@
#include "log-fourier.hpp"
+
#include <getopt.h>
-#include <iomanip>
#include <iostream>
#include <iomanip>
#include <filesystem>
diff --git a/p-spin.cpp b/p-spin.cpp
index 3691ed6..ba18c6a 100644
--- a/p-spin.cpp
+++ b/p-spin.cpp
@@ -1,25 +1,25 @@
#include "p-spin.hpp"
-inline Real fP(unsigned p, Real q) {
+inline Real fₚ(unsigned p, Real q) {
return 0.5 * pow(q, p);
}
-inline Real dfP(unsigned p, Real q) {
+inline Real ∂fₚ(unsigned p, Real q) {
return 0.5 * p * pow(q, p - 1);
}
-inline Real ddfP(unsigned p, Real q) {
+inline Real ∂∂fₚ(unsigned p, Real q) {
return 0.5 * p * (p - 1) * pow(q, p - 2);
}
Real f(Real λ, unsigned p, unsigned s, Real q) {
- return (1 - λ) * fP(p, q) + λ * fP(s, q);
+ return (1 - λ) * fₚ(p, q) + λ * fₚ(s, q);
}
-Real df(Real λ, unsigned p, unsigned s, Real q) {
- return (1 - λ) * dfP(p, q) + λ * dfP(s, q);
+Real ∂f(Real λ, unsigned p, unsigned s, Real q) {
+ return (1 - λ) * ∂fₚ(p, q) + λ * ∂fₚ(s, q);
}
-Real ddf(Real λ, unsigned p, unsigned s, Real q) {
- return (1 - λ) * ddfP(p, q) + λ * ddfP(s, q);
+Real ∂∂f(Real λ, unsigned p, unsigned s, Real q) {
+ return (1 - λ) * ∂∂fₚ(p, q) + λ * ∂∂fₚ(s, q);
}
diff --git a/p-spin.hpp b/p-spin.hpp
index c293d65..484bc17 100644
--- a/p-spin.hpp
+++ b/p-spin.hpp
@@ -1,6 +1,7 @@
#pragma once
+
#include "types.hpp"
Real f(Real λ, unsigned p, unsigned s, Real q);
-Real df(Real λ, unsigned p, unsigned s, Real q);
-Real ddf(Real λ, unsigned p, unsigned s, Real q);
+Real ∂f(Real λ, unsigned p, unsigned s, Real q);
+Real ∂∂f(Real λ, unsigned p, unsigned s, Real q);