Hi Guillermo, Guillermo has also emailed me about this, about what I strongly suspect is a real bug in current meigen. I have just asked him, or hereby anyone else, to open a GitHub issue on P:LA with correct values for e.g. the left and right eigenvectors for the simple 2x2 matrix used in most of the tests (my $x = pdl([0.43,0.03],[0.75,0.72]);). I have to ask this because my linear algebra knowledge is still weak. If you do so, please share on here the URL so that others know you have done so.
The underlying cause here is that the tests, recently added for the m* functions, which previously did not exist at all, currently only check the first return value. I can make it check others, but I am asking for help with what the values should be. Please see https://github.com/PDLPorters/pdl-linearalgebra/blob/master/t/common.pl for the current inputs, to make my life easy. If you simply tell me what the MATLAB/Octave equivalent expressions are, that is nearly as useful for me as I am then able to copy-paste. However, everyone PLEASE do not provide any values smaller than 1e-16; this is the limit of precision of double-precision floating point. The quantities shown below include 1e-132, which is therefore not going to provide useful values. Best regards, Ed From: Guillermo P. Ortiz<mailto:gor...@exa.unne.edu.ar> Sent: 06 May 2022 22:02 To: Zakariyya Mughal<mailto:zaki.mug...@gmail.com>; pdl-de...@lists.sourceforge.net<mailto:pdl-de...@lists.sourceforge.net>; pdl-general@lists.sourceforge.net<mailto:pdl-general@lists.sourceforge.net> Subject: Re: [Pdl-devel] replace very small numbers Thanks Zaki, Following you, if $a is a ndarray with some very small numbers smaller than $tol, then: my $b=$a->where(abs($a) < $tol); $b.=0; the $a has now zero instead of the very small numbers, but is it possible a better solution ? Let me put a clear context for such situations using PDL::LA::meigen() use PDL::LinearAlgebra; my $a=pdl([1.0,1e-132],[1e-132,1.0]) my ($ev,$le,$re)=meigen($a,1,1); say $re [ [ 0.707106781186547 -0.707106781186547] [ 0.707106781186547 0.707106781186547] ] (It is a non expected result) but, like 1e-132 is very small for a tolerance $tol =1e-10 my $b=$a->where(abs($a) < $tol); $b.=0; say $a [ [1 0] [0 1] ] my ($ev,$le,$re)=meigen($a,1,1); say $re [ [1 0] [0 1] ] Here, we can see also that meigen() is not working like one might expect, I mean that for $a near to the identity case we are expecting also $re near to the identity case. The suggested solution taken by Zaki idea work, but I am afraid for a bug in meigen(). Regards Regards El jue, 5 may 2022 a las 12:21, Zakariyya Mughal (<zaki.mug...@gmail.com<mailto:zaki.mug...@gmail.com>>) escribió: On 2022-05-05 at 10:57:53 -0300, Guillermo P. Ortiz wrote: > Hello, > somebody know if there are a quick way > to set all very small number to zero into a ndarray? Hello, If I understand correctly, I believe that you can achieve this using the `where` function <https://metacpan.org/pod/PDL::Primitive#where> to create a mask. Cheers, - Zaki Mughal > > Regards > > > -- > > > Dr. Guillermo P. Ortiz > Electromagnetismo Aplicado > Dto. Física, Facultad de Ciencias Exactas > Universidad Nacional del Nordeste > Avda Libertad 5460, W3404AAS Corrientes, > Argentina. > (+54) 379-4424678 interno 4613 > gortiz* at *unne edu ar > _______________________________________________ > pdl-devel mailing list > pdl-de...@lists.sourceforge.net<mailto:pdl-de...@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/pdl-devel _______________________________________________ pdl-devel mailing list pdl-de...@lists.sourceforge.net<mailto:pdl-de...@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/pdl-devel
_______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general