You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Absolutely, go ahead!
The only requirement we have is that you need to add unittests for it and it has to be sufficiently fast. Look at the signature of lu and qr function for reference here.
A very naive, inefficient and perhaps buggy solution would be (just for your reference)
template<typename T, size_t M, size_t N>
inlinevoidsvd(const Tensor<T,M,N> &a, Tensor<T,M,M> &u, Tensor<T,N,M> &s, Tensor<T,N,N> &v, const T tol=1e-10) {
// reserve space in advancesize_t maxiter = 100*std::max(M,N);
size_t counter = 0;
u.eye2();
s = transpose(a);
v.eye2();
Tensor<T,M,M> q;
T err = std::numeric_limits<T>::max();
while (err > tol && counter < maxiter) {
qr(transpose(s),q,s); u = u % q;
qr(transpose(s),q,s); v = v % q;
T F = sum(diag(s));
if (std::abs(F) < tol) F = 1;
err = E/F;
counter++;
}
return;
}
At the moment Fastor provides the fastest LU decomposition, inversion and solve routines for small tensors but lacks a fast SVD routine
The text was updated successfully, but these errors were encountered: