Skip to main content

SimdPageRank

Struct SimdPageRank 

Source
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

Source

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.

Source

pub fn convergence_l1( new_rank: &ArrayView1<'_, f64>, old_rank: &ArrayView1<'_, f64>, ) -> f64

Compute L1 norm of the difference between two rank vectors (convergence check).

Returns sum(|new_rank[i] - old_rank[i]|) using SIMD acceleration.

§Arguments
  • new_rank - New rank vector
  • old_rank - Previous rank vector
§Returns

The L1 norm of the difference.

Source

pub fn has_converged( new_rank: &ArrayView1<'_, f64>, old_rank: &ArrayView1<'_, f64>, tolerance: f64, ) -> bool

Check if PageRank has converged by comparing L1 norm against tolerance.

§Arguments
  • new_rank - New rank vector
  • old_rank - Previous rank vector
  • tolerance - Convergence threshold
§Returns

true if the L1 norm of the difference is below tolerance.

Source

pub fn scale_rank(rank: &ArrayView1<'_, f64>, scalar: f64) -> Array1<f64>

SIMD-accelerated vector-scalar multiply for rank distribution.

Computes result[i] = rank[i] * scalar for distributing a node’s rank equally among its neighbors.

§Arguments
  • rank - The rank vector
  • scalar - The scalar multiplier (e.g., damping / degree)
§Returns

The scaled vector.

Source

pub fn normalize_rank(rank: &Array1<f64>) -> Result<Array1<f64>>

Normalize a rank vector so it sums to 1.0.

§Arguments
  • rank - The rank vector to normalize
§Returns

The normalized rank vector, or an error if the sum is zero.

Source

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 vector
  • is_dangling - Boolean mask: true for dangling nodes
  • damping - Damping factor
§Returns

The uniform teleportation contribution per node.

Source

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 threshold
  • max_iterations - Maximum number of iterations
§Returns

A tuple of (rank vector, iterations used).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V