From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: problem with Real_Matrix*Real_Matrix
Date: Mon, 17 Sep 2012 20:01:02 +0300
Date: 2012-09-17T20:01:02+03:00 [thread overview]
Message-ID: <abp3acF6d5tU1@mid.individual.net> (raw)
In-Reply-To: <cf82061e-ebae-46fc-b8d3-26c6dc9f84d9@googlegroups.com>
On 12-09-17 16:37 , reinkor wrote:
> Dear All,
>
> I am confused about my result from the multiplication r*M where
> r is Real_Vector and M is Real_Matrix. Enclosed is my test program
> including comments. Could someone look at it and maybe help me out
> of my bubble?
>
>
> I use gcc-ada-4.7-2.1.1.x86_64 under OpenSuse 12.2
I get the expected result:
** r*M :
3010.0 4020.0
on my Mac, with GNAT 4.5.0 20100221 (experimental) [trunk revision 156937].
I suspect your Ada installation is broken, but I don't have any advice
on how to fix it, sorry.
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
>
> reinert
>
>
> with Text_IO;
> use Text_IO;
> with ada.numerics.Generic_Real_Arrays;
>
> with Ada.Strings.Fixed;
> use Ada.Strings,Ada.Strings.Fixed;
>
>
> procedure test3 is
>
> type Real is new Float;
>
> package Real_Io is new Text_IO.Float_Io (Real);
> use Real_Io;
>
> package Int_Io is new Text_IO.Integer_Io (Integer);
> use Int_Io;
>
> package GRA is new Ada.Numerics.Generic_Real_Arrays(Real);
> use GRA;
>
> procedure Put (X : Real_Vector) is
> begin
> for I in X'Range (1) loop
> Put (X (I),6,1,0);
> end loop;
> end Put;
>
> M : Real_Matrix := ((1.0, 2.0),
> (3.0, 4.0));
>
> r : Real_Vector := (10.0,1000.0);
>
> begin
>
> Put("** r*M : ");New_Line;
> Put(r*M);
>
> -- Extect: r*M = (10*1 + 1000*3, 10*2 + 1000*4) = (3010,4020)
> -- i.e. should r*M consists of the inner product between r and
> -- the columns of M ? But my program gives:
> --
> -- ** r*M :
> -- 40.0 6000.0
> --
>
> end test3;
>
>
next prev parent reply other threads:[~2012-09-21 1:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 13:37 problem with Real_Matrix*Real_Matrix reinkor
2012-09-17 17:01 ` Niklas Holsti [this message]
2012-09-18 10:18 ` Anatoly Chernyshev
2012-09-18 10:50 ` Simon Wright
2012-09-18 17:10 ` Anatoly Chernyshev
2012-09-18 18:16 ` Egil Høvik
2012-09-18 18:39 ` Anatoly Chernyshev
2012-09-18 19:23 ` Simon Wright
2012-09-18 20:33 ` AdaMagica
2012-09-19 6:11 ` reinkor
2012-09-19 8:17 ` Simon Wright
2012-09-19 8:55 ` Ken Thomas
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox