igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] igraph_matrix_copy_to()


From: Tamas Nepusz
Subject: Re: [igraph] igraph_matrix_copy_to()
Date: Mon, 28 Jun 2010 19:22:26 +0100

Hi Fernando,

igraph matrices store real numbers, not integers, therefore long is not a 
suitable data type for igraph_matrix_copy_to. Use an array of igraph_real_t 
instead:

igraph_real_t distances[numberofnodes][numberofnodes];

-- 
Tamas

On 2010.06.28., at 18:44, Fernando Martinez wrote:

> Dear All,
> 
> I'm having problems when using the function igraph_matrix_copy_to()
> 
> As I understand it, this function allows to copy an igraph matrix into a 
> normal C matrix. However, I get an error when compiling.
> 
> My code is the following:
> 
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> 
> 
> 
> #include <igraph.h>
> 
> int main()
> {
> 
> 
>       igraph_matrix_t matriz;
>       igraph_vector_t vec;
>       igraph_vs_t from;
>       igraph_neimode_t mode = IGRAPH_ALL;
> 
>       long numberofnodes=512;
> 
>       long distances[numberofnodes][numberofnodes];
> 
>       igraph_vs_all(&from);
> 
>       igraph_shortest_paths(&graph, &matriz, from, mode);
> 
>       igraph_matrix_copy_to(&matriz, distances);
> 
>       return(0);
> 
> }
> 
> 
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> 
> I compile in Unbuntu 9.04
> 
> g++ -I/igraph -L/lib w1024.cpp -ligraph -lgsl -lgslcblas -o w1024
> 
> and gives error for the line of "igraph_matrix_copy_to(&matriz, distances);":
> 
> error: cannot convert `long int (*)[((long unsigned int)((long 
> int)numberofnodes))]' to `igraph_real_t*' for argument `2' to `int 
> igraph_matrix_copy_to(const igraph_matrix_t*, igraph_real_t*)'
> 
> Any ideas on how to pass the data from the igraph matrix to a C matrix?
> 
> 
> Cheers,
> Fernando
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help




reply via email to

[Prev in Thread] Current Thread [Next in Thread]