MCPcopy Index your code
hub / github.com/arrayfire/arrayfire-rust / svd

Function svd

src/lapack/mod.rs:71–89  ·  view source on GitHub ↗

Perform Singular Value Decomposition This function factorizes a matrix A into two unitary matrices U and Vt, and a diagonal matrix S such that A = U∗S∗Vt If A has M rows and N columns, U is of the size M x M , V is of size N x N, and S is of size M x N # Parameters - `in` is the input matrix # Return Values A triplet of Arrays. The first Array is the output array containing U The second A

(input: &Array<T>)

Source from the content-addressed store, hash-verified

69///
70/// The third Array is the output array containing V ^ H
71pub fn svd<T>(input: &Array<T>) -> (Array<T>, Array<T::BaseType>, Array<T>)
72where
73 T: HasAfEnum + FloatingPoint,
74 T::BaseType: HasAfEnum,
75{
76 unsafe {
77 let mut u: af_array = std::ptr::null_mut();
78 let mut s: af_array = std::ptr::null_mut();
79 let mut vt: af_array = std::ptr::null_mut();
80 let err_val = af_svd(
81 &mut u as *mut af_array,
82 &mut s as *mut af_array,
83 &mut vt as *mut af_array,
84 input.get(),
85 );
86 HANDLE_ERROR(AfError::from(err_val));
87 (u.into(), s.into(), vt.into())
88 }
89}
90
91/// Perform Singular Value Decomposition inplace
92///

Callers

nothing calls this directly

Calls 3

HANDLE_ERRORFunction · 0.85
intoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected