Dear all,

Thank you for your replies!

Regarding Julia - it seems to be interesting, but - it is too fresh, and from what I understood, it is not compiled. I think D language would be more interesting for me and suitable for my needs (scientific computing).

Yes, numpy/scipy is OK, but since I have now some time I would like to learn one compiled language which is more close to the hardware,

"I have done some linear algebra in D. If you are comfortable
calling C functions, you can easily call into existing solutions,
because it is trivial to call into C from D."

This is very interesting since as you know lots of code is written in c. GSL is a good example. The only problem is how to use it. The thing is that i don't know c, but the question is whether I really need to be skilled in c to be able to call c functions. My gut feeling is that no, I don't need to be skilled. I have installed gsl on my computer. But what I need is a good example of a code/codes on how to call this library from d programming language. E.g. I have tried to use gsl. I have written a code in c (simple.c):

-------
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

double fun(double x)
//main (void)
{
//  x = 5.0;
  double y = gsl_sf_bessel_J0 (x);
//  printf ("J0(%g) = %.18e\n", x, y);
  return y;
}
----------------
Also, I have written a di file (simple.di):
----------------
extern (C):
double fun(double);
----------------
And finally, d code (simple.d):
------------------
import std.stdio, std.string, std.array;
import std.conv;

import std.stdio;
import simple;

void main(){
    writeln( fun(10.0) );
}
------------------------------------

Unfortunately, when I compile it it says:

dmd simple.d simple.o
simple.d(8): Error: undefined identifier fun

Could one provide a working clear example how to use gsl in D?

I have tried SciD and it apparently works, though I did not test it so far. I think a tutorial on how to use D in scientific programming would be very appreciated and could attract more people to D.

PS Thank all of you for helping.












I use Gretl
http://gretl.sourceforge.net/ because it offers a convenient
interface to commonly used BLAS and LAPACK functionality. GSL is
another good choice https://www.gnu.org/software/gsl/. This has
worked well for me because I am using D as a drop-in replacement
for C."





On Thursday, 17 October 2013 at 20:31:38 UTC, Yura wrote:
Dear D programmers,

I am very new to D programming language. I just started to learn it as an alternative to python since the latter sometimes is too slow. My question is whether there some simple ways to solve linear algebra problems in D programming language? E.g. matrix multiplication, diagonalization, SVD decomposition? If there is something, I would definitely stick to D programming language in my projects.

PS I am not a proffesinal programmer and I am sorry if this question has already been discussed.

Thaks in advance!

Reply via email to