[Aldor-l] Re: Aldor program: Assistance requested.

Ralf Hemmecke ralf at hemmecke.de
Mon Aug 8 12:39:20 EDT 2005


Hello Constantine,

let me post your question to aldor-l since there might be others who 
could help better than me.

The program is attached (matex.as).

It compiles on my Debian Linux machine without a problem.

aldor -grun -lalgebra -laldor matex.as
(Note that "aldor -grun -laldor -lalgebra matex.as" does NOT work.)

On my machine the output starts with

vector [1.20000004,2.08999991e+1,1.47000002e+1]
vector [-1.10000002,4.80000019,-3.70000004]
vector [1.00029993e+3,-2.5,7.5]

and

vector [1.19999999999999996,2.08999999999999985e+1,1.46999999999999992e+1]
vector [-1.10000000000000008,4.79999999999999982,-3.70000000000000017]
vector [1.00029999999999996e+3,-2.5,7.5]

in case of DoubleFloat.

So we see some rounding error which I find quite annoying, but it comes 
from the output routine not the internal representation.

The reason why you get such big numbers is totally unclear to me. Looks 
like a bug somewhere.

What are the parameters of your machine? Which Aldor version do you run 
which library?

Type
aldor -gloop -lalgebra -laldor
#include "algebra"
#include "aldorinterp"
version$AldorLibraryInformation
version$AlgebraLibraryInformation

What do you get?

Ralf

C. Frangos wrote:
> Hi Ralf,
> 
> Yes, it compiles without error messages if I put the -lalgebra first  as 
> suggested - thanks.
> 
> However, there seems to be an error with the way the floating point numbers 
> inside the vectors and matrices are represented or printed. I saved the 
> results to a file and have pasted the very first section below.
> 
> Any assistance with this will be appreciated - thanks again for all your 
> time. 
> 
> With my best regards,
> 
> C. Frangos.
> 
> 
> 
> #include "algebra"
> #include "aldorio"
> 
> macro {
> 	V == Vector R;
> 	M == DenseMatrix R;
> 	print x == stdout << x << newline << newline;
> }
> matrixTest(R: Join(FloatType, ExpressionType)): () == {
> 	import from R, V, M;
> --	import from Float, MachineInteger;
> 	import from MachineInteger;
> 
> 	u: V := [   1.2, 20.9, 14.7];
> 	v: V := [  -1.1,  4.8, -3.7];
> 	w: V := [1000.3, -2.5,  7.5];
> 	print "The vectors";
> 	print u;
> 	print v;
> 	print w;
> 	
> 	print "Two matrices";
> 	m23 := [u,v];
> 	m33 := [u,v,w];
> 	
> 	print m23;
> 	print numberOfRows m23;
> 	print numberOfColumns m23;
> 
> 	print transpose m23;
> 	print m33;
> 
> 	print(m23 * transpose m23);
> 	m := transpose m23 * m23;
> 
> 
> -- The part of the program above produces the following results:
> 
> 
> The vectors
> 
> vector 
> [1.20000004,340282366920938463463374607431768211456e+1,340282366920938463463374607431768211456e+1]
> 
> vector [-1.10000002,4.80000019,-3.70000004]
> 
> vector [340282366920938463463374607431768211456e+3,-2.5,7.5]
> 
> Two matrices
> 
> matrix 
> [[1.20000004,-1.10000002],[340282366920938463463374607431768211456e+1,4.80000019],[340282366920938463463374607431768211456e+1,-3.70000004]]
> 
> 3
> 
> 2
> 
> matrix 
> [[1.20000004,340282366920938463463374607431768211456e+1,340282366920938463463374607431768211456e+1],[-1.10000002,4.80000019,-3.70000004]]
> 
> matrix 
> [[1.20000004,-1.10000002,340282366920938463463374607431768211456e+3],[340282366920938463463374607431768211456e+1,4.80000019,-2.5],[340282366920938463463374607431768211456e+1,-3.70000004,7.5]]
> 
> matrix 
> [[2.65000009,340282366920938463463374607431768211456e+1,340282366920938463463374607431768211456e+1],[340282366920938463463374607431768211456e+1,340282366920938463463374607431768211456e+2,340282366920938463463374607431768211456e+2],[340282366920938463463374607431768211456e+1,340282366920938463463374607431768211456e+2,340282366920938463463374607431768211456e+2]]
> 
> 
> 
> On Monday 08 August 2005 11:27, C. Frangos wrote:
> 
>>>Thanks for the detailed instructions and please excuse the delay in
>>>responding due to work overload.
>>>
>>>As you suggested I commented out the line with Float in matex.as :
>>>
>>>--	import from Float, MachineInteger;
>>>	import from MachineInteger;
>>>
>>>I am using the following command to compile matex.as:
>>>
>>>aldor -Fx -laldor -lalgebra matex.as
>>
>>This command is the problem. I actually have no real explanation of it
>>but that is why in the mail where I sent you matex.as gave also the
>>command to compile it.
>>
>>aldor -grun -lalgebra -laldor matex.as
>>
>>You can, of course, replace -grun by -fx, but (also for future
>>development) always put the higher library first.
>>
>>An explanation why the order of the libraries on the command line is not
>>arbitrary, could be the following.
>>
>>Aldor has the concept of extending a domain (so called post-facto
>>extensions, Aldor User Guide, p. 120). And there are quite a number of
>>domains originally defined in libaldor which are extended in libalgebra.
>>MachineInteger is just one example.
>>
>>I hope that helps.
>>
>>Don't hesitate to ask more questions if you cannot go on.
>>
>>Best regards
>>Ralf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matex.as
Type: application/x-applix-spreadsheet
Size: 1864 bytes
Desc: not available
URL: <http://mail.aldor.org/pipermail/aldor-l_aldor.org/attachments/20050808/5ff503f0/attachment-0001.bin>


More information about the Aldor-l mailing list