tfe_svd_f64

Function tfe_svd_f64 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn tfe_svd_f64( _tensor: *const TfeTensorF64, _left: *const usize, _left_len: usize, _right: *const usize, _right_len: usize, _max_rank: usize, _cutoff: f64, _u_out: *mut *mut TfeTensorF64, _s_out: *mut *mut TfeTensorF64, _vt_out: *mut *mut TfeTensorF64, _status: *mut tfe_status_t, )
Expand description

Compute the SVD of a tensor.

Decomposes the tensor into U * diag(S) * Vt after matricizing according to left/right dimension indices. Returns the three factors via output pointers. The caller must release each.

Set max_rank to 0 for no rank limit. Set cutoff to a negative value for no cutoff.

§Safety

  • tensor must be a valid, non-null tensor pointer.
  • left must point to left_len valid usize values.
  • right must point to right_len valid usize values.
  • u_out, s_out, vt_out must be valid, non-null pointers to *mut TfeTensorF64.
  • status must be a valid, non-null pointer.

§Examples (C)

size_t left[] = {0};
size_t right[] = {1};
tfe_tensor_f64 *u, *s, *vt;
tfe_status_t status;
tfe_svd_f64(a, left, 1, right, 1, 0, -1.0, &u, &s, &vt, &status);
assert(status == TFE_SUCCESS);
tfe_tensor_f64_release(u);
tfe_tensor_f64_release(s);
tfe_tensor_f64_release(vt);