From 731b2a128dc073ec95deeaa86a960a06363b69b9 Mon Sep 17 00:00:00 2001 From: Jiri Pittner Date: Sat, 18 Nov 2023 18:48:20 +0100 Subject: [PATCH] SVD for Mat3 --- t.cc | 27 ++++++++-- vecmat3.cc | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++--- vecmat3.h | 13 +++++ 3 files changed, 181 insertions(+), 9 deletions(-) diff --git a/t.cc b/t.cc index 7d22e69..6a26ada 100644 --- a/t.cc +++ b/t.cc @@ -2786,6 +2786,12 @@ cout <<"resorted graph = "< a; a.randomize(10.); cout< work(ata); Vec3 w; Mat3 v; work.eivec_sym(w,v,true); -cout < aat = a*a.transpose(); Mat3 work2(aat); Vec3 w2; Mat3 v2; work2.eivec_sym(w2,v2,true); -cout < u3,v3; +Vec3 w3; +a.svd(u3,w3,v3); +cout <<"Mat3 SVD\n"; +cout < aa(a); -cout < uu(3,3),vv(3,3); NRVec ss(3); singular_decomposition(aa,&uu,ss,&vv,0); +cout <<"REGULAR SVD\n"; cout < ainv= a.inverse(); +Mat3 ainv2= a.svdinverse(); +cout <