Re: Matrices implementations
- From: "Mauro DiNuzzo" <picorna@xxxxxxxxx>
- Date: Tue, 6 Jun 2006 14:31:02 +0200
I think you are perfectly right about the need for C/C++ algorithms.
But this is contrary of my personal thoughts. That is, if I want Prolog to
be just a toplevel, I do not see fantistic advantages than using, lets say,
bash (or dos). So, it is in my expectation that Prolog systems could advance
in performance to reduce at the minumum the need of switching to C/C++. This
is, of course, just for relatively small projects.
Consider, as an example, a bioinformatic project to analyze sequences. Sure
we should avoid Prolog based algorithm to process the entire human genome!
But I think Prolog will be useful to spare time in writing programs which
deal with the "substance" of the problem...
Without opening a new thread, I want to introduce an example exercise, that
is "extract all substrings from a string, except the empty string". This in
Prolog can be done with such a predicate:
extract_substring(String, SubString) :-
atom_concat(S, _, String),
atom_concat(_, SubString, String),
SubString \= ''.
Now, I ask: Write down the same algorithm in C.
See you soon.
Cheers - /\/\
"A..L." <alewando@xxxxxxxxxxxx> ha scritto nel messaggio
news:9kb982dipj6v0nhdqn5258o90lrcpn0q7o@xxxxxxxxxx
On Mon, 5 Jun 2006 16:56:24 +0200, "Mauro DiNuzzo"which
<picorna@xxxxxxxxx> wrote:
Well, I have implemented it by myself. However...
For "robust" I intend hardly tested under every point of view, especially
two (errors and performance):
a) Almost total absence of bugs;
b) Quite fast algorithms.
For "handling" I intend the following:
a) Represent matrices in a Prolog data structure (I think there are many
ways for this);
b) Manipulating matrix structures by means of Prolog predicates and/or
operators;
c) Perform some specific operations over matrices.
In particular, I implemented my own "square matrices" Prolog module in
identitysquare-Matrices are represented like a list of a list (e.g. 2-order
elements,is [[1,0],[0,1]]) and it is possible to perform some basic operations on
them, such as (i) transposing a matrix, (ii) extracting diagonal
etc...(iii) calculate the inverse of a matrix, (iv) calculate the norm of a
matrix, (v) perform the product of a matrix and a vector-column, (vi)
isBasically, I need square matrices support for an applications that deals
with bioinformatics, but I was unable to find a tested one. Of course, it
thetime-expensive to implement a complete library of predicates (e.g. for
calculation of eigenvalues/eigenvectors)
Well, "maipulating" matrices in Prolog is OK, but I wild never try
to implement numerical algorithms such as eigenvalues or inverse
calculation. Algorithms that are robust are not trivial, especially
if you want to solve problems that are larger than typical academic
examples. The only reasonable way for me is to implement predicates
for "handling", i.e. not much more than accessing values using
indexec, but delagate numerical computations to existing packages
written in, excuse me, C++ ot C... For the same reason we buy LP
solvers from ILOG or Dash but don't do this in-house.
A.L.
.
- Follow-Ups:
- References:
- Matrices implementations
- From: Mauro DiNuzzo
- Re: Matrices implementations
- From: A . . L .
- Re: Matrices implementations
- From: Mauro DiNuzzo
- Re: Matrices implementations
- From: A . . L .
- Matrices implementations
- Prev by Date: Re: Prolog + visual studio.net(2003)
- Next by Date: Re: Matrices implementations
- Previous by thread: Re: Matrices implementations
- Next by thread: Re: Matrices implementations -- OT implementation in C of extract_substring
- Index(es):
Relevant Pages
|