some tests of matrix log
This commit is contained in:
30
t.cc
30
t.cc
@@ -4707,7 +4707,7 @@ cout <<x;
|
||||
cout <<"Error = "<< (a*x-b).norm()<<endl;
|
||||
}
|
||||
|
||||
if(1)
|
||||
if(0)
|
||||
{
|
||||
NRMat<double> a;
|
||||
NRMat<double> b;
|
||||
@@ -4718,5 +4718,33 @@ cout <<x;
|
||||
cout <<"Error = "<< (a*x-b).norm()<<endl;
|
||||
}
|
||||
|
||||
if(0)
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
NRMat<double> a(n,n);
|
||||
a.randomize(.5);
|
||||
NRMat<double> ae = exp(a);
|
||||
NRMat<double> aa = log(ae);
|
||||
cout <<a;
|
||||
cout <<aa;
|
||||
cout <<"Error = "<<(a-aa).norm()<<endl;
|
||||
}
|
||||
|
||||
|
||||
if(1)
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
NRMat<double> a(n,n);
|
||||
a.randomize(.5);
|
||||
NRMat<double> ax = a.transpose()*a;
|
||||
NRMat<double> al = log(ax);
|
||||
NRMat<double> aa = exp(al);
|
||||
cout <<ax;
|
||||
cout <<aa;
|
||||
cout <<"Error = "<<(ax-aa).norm()<<endl;
|
||||
}
|
||||
|
||||
|
||||
}//main
|
||||
|
||||
Reference in New Issue
Block a user