pub struct LinearAlgebraLibrary {
pub matrix_storage: MatrixStorage,
pub computation_engine: ComputationEngine,
pub optimization_engine: OptimizationEngine,
pub privacy_engine: PrivacyEngine,
pub performance_monitor: LAPerformanceMonitor,
}Expand description
Linear Algebra Library Manager
Fields§
§matrix_storage: MatrixStorage§computation_engine: ComputationEngine§optimization_engine: OptimizationEngine§privacy_engine: PrivacyEngine§performance_monitor: LAPerformanceMonitorImplementations§
Source§impl LinearAlgebraLibrary
impl LinearAlgebraLibrary
Sourcepub fn initialize(&mut self) -> Result<(), LinearAlgebraError>
pub fn initialize(&mut self) -> Result<(), LinearAlgebraError>
Initialize the library
Sourcepub fn create_matrix(
&mut self,
matrix_id: String,
rows: usize,
cols: usize,
data_type: DataType,
data: Vec<f64>,
) -> Result<Matrix, LinearAlgebraError>
pub fn create_matrix( &mut self, matrix_id: String, rows: usize, cols: usize, data_type: DataType, data: Vec<f64>, ) -> Result<Matrix, LinearAlgebraError>
Create a new matrix
Sourcepub fn matrix_multiply(
&mut self,
left_id: &str,
right_id: &str,
result_id: &str,
alpha: f64,
beta: f64,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn matrix_multiply( &mut self, left_id: &str, right_id: &str, result_id: &str, alpha: f64, beta: f64, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Matrix multiplication with hardware acceleration
Sourcepub fn matrix_add(
&mut self,
left_id: &str,
right_id: &str,
result_id: &str,
alpha: f64,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn matrix_add( &mut self, left_id: &str, right_id: &str, result_id: &str, alpha: f64, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Matrix addition
Sourcepub fn matrix_transpose(
&mut self,
input_id: &str,
result_id: &str,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn matrix_transpose( &mut self, input_id: &str, result_id: &str, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Matrix transpose
Sourcepub fn matrix_inverse(
&mut self,
input_id: &str,
result_id: &str,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn matrix_inverse( &mut self, input_id: &str, result_id: &str, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Matrix inverse
Sourcepub fn solve_linear_system(
&mut self,
matrix_id: &str,
rhs_id: &str,
solution_id: &str,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn solve_linear_system( &mut self, matrix_id: &str, rhs_id: &str, solution_id: &str, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Solve linear system Ax = b
Sourcepub fn private_matrix_multiply(
&mut self,
left_id: &str,
right_id: &str,
result_id: &str,
) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
pub fn private_matrix_multiply( &mut self, left_id: &str, right_id: &str, result_id: &str, ) -> Result<LinearAlgebraResult<Matrix>, LinearAlgebraError>
Privacy-preserving matrix multiplication
Multiply two matrices and produce a zero-knowledge proof that the published
result really is A·B, WITHOUT revealing A or B.
The proof is over a real R1CS circuit (see ZkProofSystem::prove_matrix_multiply):
the A/B entries are private witnesses, the result entries are public inputs,
and the circuit enforces Σ_k A[i][k]·B[k][j] = C[i][j]. privacy_preserved is
set only when that Groth16 proof actually verifies — it is now a genuine
cryptographic attestation, not a structural check.
The ZK circuit operates over a FIXED-POINT encoding: each entry is scaled by 1e6 and rounded to a field integer, so real-valued matrices are supported to ~1e-6 precision (integer matrices are encoded exactly). The proof attests the exact scaled-integer identity; the returned matrix is that result rescaled.
Sourcepub fn analyze_matrix(
&mut self,
matrix_id: &str,
) -> Result<MatrixAnalysis, LinearAlgebraError>
pub fn analyze_matrix( &mut self, matrix_id: &str, ) -> Result<MatrixAnalysis, LinearAlgebraError>
Analyze a matrix: detect structural patterns and return optimization hints. Uses the MatrixAnalyzer to detect diagonal, triangular, symmetric, sparse, banded, block-diagonal, Toeplitz, orthogonal, circulant, Hankel, and positive-definite patterns.
Sourcepub fn get_performance_stats(&self) -> SystemMetrics
pub fn get_performance_stats(&self) -> SystemMetrics
Get performance statistics
Sourcepub fn performance_summary(&self) -> String
pub fn performance_summary(&self) -> String
Get a human-readable performance summary
Sourcepub fn cache_hit_rate(&self) -> f64
pub fn cache_hit_rate(&self) -> f64
Get the cache hit rate (0.0 to 1.0)
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get the current cache size in bytes
Sourcepub fn list_matrices(&self) -> Vec<String>
pub fn list_matrices(&self) -> Vec<String>
List all matrices
Sourcepub fn get_matrix_info(&self, matrix_id: &str) -> Option<MatrixMetadata>
pub fn get_matrix_info(&self, matrix_id: &str) -> Option<MatrixMetadata>
Get matrix information
Auto Trait Implementations§
impl Freeze for LinearAlgebraLibrary
impl RefUnwindSafe for LinearAlgebraLibrary
impl Send for LinearAlgebraLibrary
impl Sync for LinearAlgebraLibrary
impl Unpin for LinearAlgebraLibrary
impl UnsafeUnpin for LinearAlgebraLibrary
impl UnwindSafe for LinearAlgebraLibrary
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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