From 99b3375222bb50459604dc397a4e98be598818a6 Mon Sep 17 00:00:00 2001 From: lcnbr Date: Mon, 29 Jul 2024 14:48:43 +0200 Subject: [PATCH] fix(build): :bug: update rust in flake and fix cfg condition bug by adding higher_loops feature --- Cargo.lock | 13 +++++++------ Cargo.toml | 1 + flake.lock | 24 ++++++++++++------------ src/numerator.rs | 20 +++++++++++++++++++- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9a9c8ce..e849155d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,9 +351,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" [[package]] name = "cfg-if" @@ -1330,9 +1330,9 @@ dependencies = [ [[package]] name = "matrixmultiply" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" +checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" dependencies = [ "autocfg", "rawpointer", @@ -2187,11 +2187,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index fb1acf08..4ec13522 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,6 +118,7 @@ bench = false [features] extension-module = ["pyo3/extension-module"] default = ["python_api"] +higher_loops = [] python_api = ["pyo3", "extension-module"] binary = [] diff --git a/flake.lock b/flake.lock index c9b0bcd2..4a282d1e 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1720572893, - "narHash": "sha256-EQfU1yMnebn7LoJNjjsQimyuWwz+2YzazqUZu8aX/r4=", + "lastModified": 1722017365, + "narHash": "sha256-9wYR5NZIgI+qzMDlJrUzevR31fvFQRgfjlYp50Xp3Ts=", "owner": "rustsec", "repo": "advisory-db", - "rev": "97a2dc75838f19a5fd63dc3f8e3f57e0c4c8cfe6", + "rev": "9d024c07ee8c18609b43436bc865abf46636e250", "type": "github" }, "original": { @@ -23,11 +23,11 @@ ] }, "locked": { - "lastModified": 1720546058, - "narHash": "sha256-iU2yVaPIZm5vMGdlT0+57vdB/aPq/V5oZFBRwYw+HBM=", + "lastModified": 1721842668, + "narHash": "sha256-k3oiD2z2AAwBFLa4+xfU+7G5fisRXfkvrMTCJrjZzXo=", "owner": "ipetkov", "repo": "crane", - "rev": "2d83156f23c43598cf44e152c33a59d3892f8b29", + "rev": "529c1a0b1f29f0d78fa3086b8f6a134c71ef3aaf", "type": "github" }, "original": { @@ -44,11 +44,11 @@ "rust-analyzer-src": [] }, "locked": { - "lastModified": 1720592968, - "narHash": "sha256-k46iKgWDPXeUeO/ev0kSmjDuEIFw3pzbMqx4FUK9+yk=", + "lastModified": 1722234589, + "narHash": "sha256-0fIwThrjCNsxfeOFxN1/hUmmIp2hdJBwp2nooS6RuuQ=", "owner": "nix-community", "repo": "fenix", - "rev": "1a3edfb3317af90822b892a01708c60d0d30e1d8", + "rev": "2f9f7a678a91753349479ea10c3a5d622b711fb2", "type": "github" }, "original": { @@ -77,11 +77,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720571246, - "narHash": "sha256-nkUXwunTck+hNMt2wZuYRN+jf2ySRjKTzI0fo5TDH78=", + "lastModified": 1722141560, + "narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "16e401f01842c5bb2499e78c1fe227f939c0c474", + "rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", "type": "github" }, "original": { diff --git a/src/numerator.rs b/src/numerator.rs index dddecf0d..9530f840 100644 --- a/src/numerator.rs +++ b/src/numerator.rs @@ -11,7 +11,7 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize}; use spenso::{ complex::Complex, network::TensorNetwork, - parametric::ParamTensor, + parametric::{ParamTensor, PatternReplacement}, structure::{Lorentz, NamedStructure, PhysReps, RepName, Shadowable, TensorStructure}, symbolic::SymbolicTensor, }; @@ -127,9 +127,27 @@ impl Numerator { replacements.extend(model.dependent_coupling_replacements()); replacements.extend(model.internal_parameter_replacements()); + let reps = replacements + .iter() + .map(|(lhs, rhs)| Replacement::new(lhs, rhs)) + .collect_vec(); + + if let Some(net) = &mut self.network { + net.replace_all_multiple_repeat_mut(&reps); + } + let mut split_reps = vec![]; split_reps.extend(model.valued_coupling_re_im_split(fn_map)); split_reps.extend(model.external_parameter_re_im_split(fn_map)); + + let reps = split_reps + .iter() + .map(|(lhs, rhs)| Replacement::new(lhs, rhs)) + .collect_vec(); + + if let Some(net) = &mut self.network { + net.replace_all_multiple_repeat_mut(&reps); + } } pub fn compile(&mut self, _graph: &Graph) {