Skip to content

Commit c85cebe

Browse files
committed
remove bigint
1 parent e773a9d commit c85cebe

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

benchmarks/09_stress_test_2.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ U_cases = [
161161
),
162162
]
163163

164+
function safe_eq(x, y)
165+
try
166+
val = (x == y)
167+
return val isa Bool ? val : false
168+
catch
169+
return false
170+
end
171+
end
172+
164173
for (name, expr, expected) in U_cases
165174
got, bm = bench_integrate(expr, μU; samples = samples)
166175
diff0 = sym_is_zero(got - expected)
@@ -170,7 +179,7 @@ for (name, expr, expected) in U_cases
170179
g = eval_at(got, d, dv)
171180
e = eval_at(expected, d, dv)
172181
numeric_checks[string(dv)] =
173-
Dict("got" => safe_string(g), "expected" => safe_string(e), "ok" => (g == e))
182+
Dict("got" => safe_string(g), "expected" => safe_string(e), "ok" => safe_eq(g, e))
174183
end
175184

176185
println("[U(d)] $name")
@@ -247,7 +256,7 @@ for (name, expr, k) in O_cases
247256
numeric_checks[string(dv)] = Dict(
248257
"got" => safe_string(g),
249258
"expected" => safe_string(e),
250-
"ok" => (g == e),
259+
"ok" => safe_eq(g, e),
251260
)
252261
end
253262
end

src/integration_core.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ function process_term(term, matcher::AbstractIndexMatcher, dim, measure_type = :
484484
end
485485

486486
is_gaussian = (measure_type === :GUE || measure_type === :GOE || measure_type === :GSE)
487-
coeff = is_gaussian ? 1 // 1 : BigInt(1) // BigInt(1)
487+
coeff = 1 // 1
488488
u_indices = Vector{Tuple{Int,Int}}()
489489
u_bar_indices = Vector{Tuple{Int,Int}}()
490490

@@ -674,7 +674,7 @@ function integrate_indices(
674674
end
675675
end
676676

677-
total = dim isa Integer ? 0 // 1 : BigInt(0) // BigInt(1)
677+
total = 0 // 1
678678
for (ct, count) in cycle_counts
679679
wg_val = weingarten(ct, dim)
680680
total += count * wg_val
@@ -791,7 +791,7 @@ function integrate_indices_orthogonal(indices::Vector{Tuple{Int,Int}}, dim)
791791
sigma_counts[c_sigma] = get(sigma_counts, c_sigma, 0) + 1
792792
end
793793

794-
total = dim isa Integer ? 0 // 1 : BigInt(0) // BigInt(1)
794+
total = 0 // 1
795795
for (c_pi, count_pi) in pi_counts
796796
for (c_sigma, count_sigma) in sigma_counts
797797
val = weingarten_orthogonal_val(c_pi, c_sigma, dim)
@@ -881,7 +881,7 @@ function integrate_indices_symplectic(indices::Vector{Tuple{Int,Int}}, dim)
881881
# Check if dim is clearly integer for simplified J evaluation
882882
dim_int = dim isa Integer ? dim : nothing
883883

884-
total = dim isa Integer ? 0 // 1 : BigInt(0) // BigInt(1)
884+
total = 0 // 1
885885

886886
# Optimization: Filter partitions that yield non-zero J-contraction first?
887887
# J_{uv} is non-zero only if |u - v| = d/2 (appropriately signed).
@@ -912,7 +912,7 @@ function integrate_indices_symplectic(indices::Vector{Tuple{Int,Int}}, dim)
912912
end
913913

914914
# Results are already grouped by pi in pi_contractions/sigma_contractions
915-
total = dim isa Integer ? 0 // 1 : BigInt(0) // BigInt(1)
915+
total = 0 // 1
916916

917917
for (pi, val_pi) in pi_contractions
918918
for (sigma, val_sigma) in sigma_contractions

0 commit comments

Comments
 (0)