Prev: Dhrystone
Next: Learning Ada
From: Ada novice on
On Jul 31, 11:02 pm, Simon Wright <si...(a)pushface.org> wrote:

> Was this perhaps with the ada-numerics* files? there may be some -gnatpg
> problem with inconsistent line terminators, I guess GPS is clever enough
> to know that it's going to be anuisance and fix it.

Once I had a similar problem with another adb or ads file which I got
from the web a few weeks back. The problem was then with GPS and not
with AdaGIDE. As GPS was complaining, what I did afterwards was to
save the "raw text" into
AdaGIDE and I didn't got any complain when compiling the file into
GPS. Is that because a raw text can be using a different end of line
marker? The file encoding that's being used in an editor may be
different and not pure ASCII. In any case, one can always play around
and save the raw files in Notepad on Windows or in another editor like
WinEdt also.

> > I didn't add -gnatpg for the compiler switch. I had these: -gnatqQ -
> > gnat05 and I can compile fine and output the results. Is the -gnatpg a
> > necessity?
> Yes *but only in the src/ directory*, which is why it's in
> ada_math_build.gpr & not in test_extensions.gpr.
> This is part of a clean compile...
> gcc -c -g -fPIC -gnatpg -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/src/ada-numerics-generic_complex_arrays-extensions.adb
> gcc -c -g -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/test/test_extensions.adb
> and the first line, for the library, has the additional flags -fPIC
> (because, on this architecture, you need position-independent code for a
> shared library) and -gnatpg (from ada_math_build.gpr, as discussed).

Thanks for the explanation.

> > Thanks very much for helping me with the compilation. Now it's good
> > that some more testing is done on different cases. Do you plan to add
> > the output for eigenvectors also?
> Seemed like a plan! Also real non-symmetric, I think.
> I found the LAPACK test suite described here -http://www.netlib.org/lapack/lawns/lawn41.ps- could be useful though it
> could also be a pain to translate.

A long-term goal might perhaps be to be able to solve the generalized
eigenvalue problem. See for example here:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/eig.html

Now, the code has a function like (from the link above)

eig(A) returns a vector of the eigenvalues of matrix A.

In engineering, for example in vibration analysis, one is more
interested in the generalized eigenvalue problem (from the above link)

eig(A,B) returns a vector containing the generalized eigenvalues, if A
and B are square matrices.

In vibration analysis, matrices representing the mass, stiffness and
damping of a structure are readily formed from a model of the real-
life structure. When the generalized eigenvalue problem is solved,
then the eigenvalues give the resonances of the structure i.e.
frequencies at which large vibration occur. Normally only the first
few eigenvalues are of interest as they represent those resonant
frequencies that can give the most damage to the structure. The
corresponding eigenvectors represent then the relative displacements
between different locations of the structure at a given resonant
frequency and give a general idea how the structure is deformed at a
given resonant frequency (or eigenvalue). The eigenvectors don't give
the actual displacements but only an indication of how the different
parts of the structure will deform in relation to each other. Actual
magnitude of displacements can only be obtained under actual testing
when a force is applied to the structure. Of course the mass,
stiffness
and damping matrix are real matrices (but not necessarily symmetric).

Some information on the algorithm is found here in the IMSL C user
guide:

http://www.vni.com/products/imsl/documentation/CNL700_Docs/html/cmath...

in Chapter 2: Eigensystem analysis (on the left of the page and expand
the chapter to get the different sections) at the bottom of the
section "Usage notes", and in the sections eig_symgen, geneig.
There's
the section: genig (complex) where both A and B are complex but I
don't have a
clue where this can be used in engineering. It may be more of
relevance to mathematicians though.
But these are very complex algorithms. Your link to lawn41.ps also has
some information.
And as you said, this can be a pain to translate.

YC
From: Ada novice on
On Jul 31, 11:02 pm, Simon Wright <si...(a)pushface.org> wrote:

> Was this perhaps with the ada-numerics* files? there may be some -gnatpg
> problem with inconsistent line terminators, I guess GPS is clever enough
> to know that it's going to be anuisance and fix it.

Once I had a similar problem with another adb or ads file which I got
from the web a few weeks back. The problem was then with GPS and not
with AdaGIDE. As GPS was complaining, what I did afterwards was to
save the "raw text" into
AdaGIDE and I didn't get any complain when compiling the file into
GPS after that. Is that because a raw text can be using a different
end of line
marker? The file encoding that's being used in an editor may be
different and not pure ASCII. In any case, one can always play around
and save the raw files in Notepad on Windows or in another editor like
WinEdt also.

> > I didn't add -gnatpg for the compiler switch. I had these: -gnatqQ -
> > gnat05 and I can compile fine and output the results. Is the -gnatpg a
> > necessity?
> Yes *but only in the src/ directory*, which is why it's in
> ada_math_build.gpr & not in test_extensions.gpr.
> This is part of a clean compile...
> gcc -c -g -fPIC -gnatpg -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/src/ada-numerics-generic_complex_arrays-extensions.adb
> gcc -c -g -gnatqQ -gnat05 -I- -gnatA /Users/simon/gnat-math-extn/test/test_extensions.adb
> and the first line, for the library, has the additional flags -fPIC
> (because, on this architecture, you need position-independent code for a
> shared library) and -gnatpg (from ada_math_build.gpr, as discussed).

Thanks for the explanation.

> > Thanks very much for helping me with the compilation. Now it's good
> > that some more testing is done on different cases. Do you plan to add
> > the output for eigenvectors also?
> Seemed like a plan! Also real non-symmetric, I think.
> I found the LAPACK test suite described here -http://www.netlib.org/lapack/lawns/lawn41.ps- could be useful though it
> could also be a pain to translate.

A long-term goal might perhaps be to be able to solve the generalized
eigenvalue problem. See for example here:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/eig.html

Now, the code has a function like (from the link above)

eig(A) returns a vector of the eigenvalues of matrix A.

In engineering, for example in vibration analysis, one is more
interested in the generalized eigenvalue problem (from the above link)

eig(A,B) returns a vector containing the generalized eigenvalues, if A
and B are square matrices.

In vibration analysis, matrices representing the mass, stiffness and
damping of a structure are readily formed from a model of the real-
life structure. When the generalized eigenvalue problem is solved,
then the eigenvalues give the resonances of the structure i.e.
frequencies at which large vibration occur. Normally only the first
few eigenvalues are of interest as they represent those resonant
frequencies that can give the most damage to the structure. The
corresponding eigenvectors represent then the relative displacements
between different locations of the structure at a given resonant
frequency and give a general idea how the structure is deformed at a
given resonant frequency (or eigenvalue). The eigenvectors don't give
the actual displacements but only an indication of how the different
parts of the structure will deform in relation to each other. Actual
magnitude of displacements can only be obtained under actual testing
when a force is applied to the structure. Of course the mass,
stiffness
and damping matrix are real matrices (but not necessarily symmetric).

Some information on the algorithm is found here in the IMSL C user
guide:

http://www.vni.com/products/imsl/documentation/CNL700_Docs/html/cmath...

in Chapter 2: Eigensystem analysis (on the left of the page and expand
the chapter to get the different sections) at the bottom of the
section "Usage notes", and in the sections eig_symgen, geneig.
There's
the section: genig (complex) where both A and B are complex but I
don't have a
clue where this can be used in engineering. It may be more of
relevance to mathematicians though.
But these are very complex algorithms. Your link to lawn41.ps also has
some information.
And as you said, this can be a pain to translate.

YC
From: John B. Matthews on
In article <m262zzs0nz.fsf(a)pushface.org>,
Simon Wright <simon(a)pushface.org> wrote:

> I've taken the plunge and started a SourceForge project for this.
> It's at http://sourceforge.net/projects/gnat-math-extn/ -- under "Ada
> 2005 Math Extensions", click on [Develop] then on [Code].
>
> I've chosen to use Mercurial (Hg) as the VCS, mainly to get a
> real-world feel for using a DVCS (Distributed Version Control
> System). To downoad the code, you'll need to install Hg -
> http://mercurial.selenic.com/ - because I haven't actually made a
> code release yet!
>
> If anyone feels moved to join in, just say (of course you need a SF
> account to update the SF repository, but with Hg it should be
> possible to work via patchsets .. )

I just wanted to report success and offer a small patch: it seems to
makes a considerable difference in the executable size:

$ hg diff
diff -r aac8ba7708e2 test/test_extensions.gpr
--- a/test/test_extensions.gpr Sat Jul 31 17:09:42 2010 +0100
+++ b/test/test_extensions.gpr Sun Aug 01 06:33:33 2010 -0400
@@ -37,4 +37,8 @@
for Default_Switches ("ada") use ("-E");
end Binder;

+ package Linker is
+ for Default_Switches ("ada") use ("-dead_strip");
+ end Linker;
+
end Test_Extensions;

With GNAT 4.3.4 (FSF), I had to build with Library_Kind "static" before
I could build with "dynamic". For some reason, the dylib appears in
.../src/.build/ instead of ../lib/. I think that's a bug in the older
version that I've also seen building GtkAda.

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
From: Simon Wright on
Ada novice <posts(a)gmx.us> writes:

4 times, with slightly different contents! is your newsreader posting
the message when you asked it to save a draft, perhaps?

> On Jul 31, 11:02 pm, Simon Wright <si...(a)pushface.org> wrote:

>> Seemed like a plan! Also real non-symmetric, I think. I found the
>> LAPACK test suite described here
>> -http://www.netlib.org/lapack/lawns/lawn41.ps- could be useful though
>> it could also be a pain to translate.
>
> A long-term goal might perhaps be to be able to solve the generalized
> eigenvalue problem. See for example here:
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/eig.html
>
> Now, the code has a function like (from the link above)
>
> eig(A) returns a vector of the eigenvalues of matrix A.
>
> In engineering, for example in vibration analysis, one is more
> interested in the generalized eigenvalue problem (from the above link)
>
> eig(A,B) returns a vector containing the generalized eigenvalues, if A
> and B are square matrices.
>
> In vibration analysis, matrices representing the mass, stiffness and
> damping of a structure are readily formed from a model of the real-
> life structure. When the generalized eigenvalue problem is solved,
> then the eigenvalues give the resonances of the structure i.e.
> frequencies at which large vibration occur. Normally only the first
> few eigenvalues are of interest as they represent those resonant
> frequencies that can give the most damage to the structure. The
> corresponding eigenvectors represent then the relative displacements
> between different locations of the structure at a given resonant
> frequency and give a general idea how the structure is deformed at a
> given resonant frequency (or eigenvalue). The eigenvectors don't give
> the actual displacements but only an indication of how the different
> parts of the structure will deform in relation to each other. Actual
> magnitude of displacements can only be obtained under actual testing
> when a force is applied to the structure. Of course the mass,
> stiffness and damping matrix are real matrices (but not necessarily
> symmetric).
>
> Some information on the algorithm is found here in the IMSL C user
> guide:
>
> http://www.vni.com/products/imsl/documentation/CNL700_Docs/html/cmath...
>
> in Chapter 2: Eigensystem analysis (on the left of the page and expand
> the chapter to get the different sections) at the bottom of the
> section "Usage notes", and in the sections eig_symgen, geneig.
> There's the section: genig (complex) where both A and B are complex
> but I don't have a clue where this can be used in engineering. It may
> be more of relevance to mathematicians though. But these are very
> complex algorithms. Your link to lawn41.ps also has some information.
> And as you said, this can be a pain to translate.

If you thnk it would be useful .. it's a good thing that LAPACK already
includes the generalized eigenvalue algorithms (xGGEV), then! Binding to
an existing proven coding of an algorithm I can do, creating a new one
.... hmm.
From: Ada novice on
On Aug 1, 6:14 pm, Simon Wright <si...(a)pushface.org> wrote:
> Ada novice <po...(a)gmx.us> writes:
>
> 4 times, with slightly different contents! is your newsreader posting
> the message when you asked it to save a draft, perhaps?
>

Actually, I posted and then make some modifications to explain better.
And this in 4 tiles as you said. But I deleted each post to put the
new one instead. And only my "final" post appear here. So do you mean
that you were informed (through email perhaps?) 4 times about me
posting? Of course this was never my intention. I shall avoid in the
future to delete a post and re-write it.


> If you thnk it would be useful .. it's a good thing that LAPACK already
> includes the generalized eigenvalue algorithms (xGGEV), then! Binding to
> an existing proven coding of an algorithm I can do, creating a new one
> ... hmm.

Actually, the generalised eigenvalue problem is indeed very useful in
various branches of engineering and yes it would be very kind of you
to provide such a binding. Maybe later you can inform the Numerics
group of the Ada committee of your efforts so that more people will be
made aware of the bindings.

And thanks again for letting me know about my 4 posts.
YC

First  |  Prev  |  Next  |  Last
Pages: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Prev: Dhrystone
Next: Learning Ada