pub struct SimdPageRank;Expand description
SIMD-accelerated operations for PageRank power iteration.
These functions accelerate the inner loops of PageRank computation: distributing rank contributions, computing convergence (L1 norm of the difference vector), and normalizing the rank vector.
Implementations§
Source§impl SimdPageRank
impl SimdPageRank
Sourcepub fn power_iteration_step(
transition_matrix: &Array2<f64>,
old_rank: &Array1<f64>,
damping: f64,
) -> Result<Array1<f64>>
pub fn power_iteration_step( transition_matrix: &Array2<f64>, old_rank: &Array1<f64>, damping: f64, ) -> Result<Array1<f64>>
Perform one PageRank power iteration step using SIMD.
Computes new_rank = (1 - damping) / n + damping * M * old_rank
where M is the column-stochastic transition matrix.
§Arguments
transition_matrix- Row-stochastic transition matrix (n x n)old_rank- Current rank vector (length n)damping- Damping factor (typically 0.85)
§Returns
The new rank vector after one iteration.
Sourcepub fn convergence_l1(
new_rank: &ArrayView1<'_, f64>,
old_rank: &ArrayView1<'_, f64>,
) -> f64
pub fn convergence_l1( new_rank: &ArrayView1<'_, f64>, old_rank: &ArrayView1<'_, f64>, ) -> f64
Sourcepub fn has_converged(
new_rank: &ArrayView1<'_, f64>,
old_rank: &ArrayView1<'_, f64>,
tolerance: f64,
) -> bool
pub fn has_converged( new_rank: &ArrayView1<'_, f64>, old_rank: &ArrayView1<'_, f64>, tolerance: f64, ) -> bool
Sourcepub fn scale_rank(rank: &ArrayView1<'_, f64>, scalar: f64) -> Array1<f64>
pub fn scale_rank(rank: &ArrayView1<'_, f64>, scalar: f64) -> Array1<f64>
Sourcepub fn dangling_node_contribution(
rank: &ArrayView1<'_, f64>,
is_dangling: &[bool],
damping: f64,
) -> f64
pub fn dangling_node_contribution( rank: &ArrayView1<'_, f64>, is_dangling: &[bool], damping: f64, ) -> f64
Compute damping-adjusted teleportation vector.
For dangling nodes (nodes with no outgoing edges), their rank is
distributed uniformly. This function computes the dangling node
contribution: (damping / n) * sum(rank[i] for dangling node i).
§Arguments
rank- Current rank vectoris_dangling- Boolean mask:truefor dangling nodesdamping- Damping factor
§Returns
The uniform teleportation contribution per node.
Sourcepub fn compute_pagerank(
transition_matrix: &Array2<f64>,
damping: f64,
tolerance: f64,
max_iterations: usize,
) -> Result<(Array1<f64>, usize)>
pub fn compute_pagerank( transition_matrix: &Array2<f64>, damping: f64, tolerance: f64, max_iterations: usize, ) -> Result<(Array1<f64>, usize)>
Full SIMD-accelerated PageRank computation.
Runs the PageRank power iteration until convergence or max iterations.
§Arguments
transition_matrix- Row-stochastic transition matrix (n x n)damping- Damping factor (typically 0.85)tolerance- Convergence thresholdmax_iterations- Maximum number of iterations
§Returns
A tuple of (rank vector, iterations used).
Auto Trait Implementations§
impl Freeze for SimdPageRank
impl RefUnwindSafe for SimdPageRank
impl Send for SimdPageRank
impl Sync for SimdPageRank
impl Unpin for SimdPageRank
impl UnsafeUnpin for SimdPageRank
impl UnwindSafe for SimdPageRank
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more