Project: s41467-024-49846-1 | Function: heartsvg_fast (r)

system: You are an expert R programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow R best practices and maintain consistent code style.
Return **only** the complete R function code.

user: Complete this R function:

**DESCRIPTION:** Core function implementing the HEARTSVG algorithm for identifying spatially variable genes. Uses semi-pooling process to transform 2D spatial expression to 1D marginal series, then applies Portmanteau test to detect serial autocorrelations, and combines p-values using Stouffer's method.

**KEY TERMS:** {
  "z1.group/z2.group": "semi-pooling groups for row/column directions",
  "Box.test": "Portmanteau test for serial autocorrelation",
  "poolr::stouffer": "Stouffer's method for combining p-values",
  "scale.count": "normalization and outlier handling"
}

**CONTEXT CODE:** heartsvg_fast <- function(data, scale = TRUE, qh = 0.985, noise = TRUE, padj.m = "holm") {
  stop("Function implementation has been masked")
}


Complete the function implementation replacing "stop("Not implemented")".