comp.lang.ada
 help / color / mirror / Atom feed
* problem with Real_Matrix*Real_Matrix
@ 2012-09-17 13:37 reinkor
  2012-09-17 17:01 ` Niklas Holsti
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: reinkor @ 2012-09-17 13:37 UTC (permalink / raw)


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

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;





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-09-21  1:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 13:37 problem with Real_Matrix*Real_Matrix reinkor
2012-09-17 17:01 ` Niklas Holsti
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox