comp.lang.ada
 help / color / mirror / Atom feed
From: reinkor <reinkor@gmail.com>
Subject: problem with Real_Matrix*Real_Matrix
Date: Mon, 17 Sep 2012 06:37:15 -0700 (PDT)
Date: 2012-09-17T06:37:15-07:00	[thread overview]
Message-ID: <cf82061e-ebae-46fc-b8d3-26c6dc9f84d9@googlegroups.com> (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;





             reply	other threads:[~2012-09-17 13:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 13:37 reinkor [this message]
2012-09-17 17:01 ` problem with Real_Matrix*Real_Matrix 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
replies disabled

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