help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] "gsl_spmatrix_float_alloc_nzmax" undefined reference


From: 2592680259
Subject: [Help-gsl] "gsl_spmatrix_float_alloc_nzmax" undefined reference
Date: Mon, 14 Oct 2019 18:48:22 +0800

I was using "g++ test_gsl.cpp -I/usr/local/include -lgsl -lgslcblas -o 
test_gsl.o", but got error message:


undefined reference to `gsl_spmatrix_float_alloc_nzmax'
undefined reference to `gsl_spmatrix_float_d2sp'


those two functions are declared in "gsl/gsl_spmatrix_float.h".


The MWE for "test_gsl.cpp" is listed below


#include <iostream>
#include <cmath>
#include <string>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_matrix_float.h>
#include <gsl/gsl_spmatrix.h>
#include <gsl/gsl_spmatrix_float.h>


using namespace std;


const int N = 32 * 40 * 2;
const int N_nz = 25530;


int main(int argc, char **argv)
{
    gsl_matrix *test = gsl_matrix_alloc(N, N);
    gsl_matrix_float *test_float = gsl_matrix_float_alloc(N, N);


    gsl_spmatrix *test_sp = gsl_spmatrix_alloc_nzmax(N, N, N_nz, 
GSL_SPMATRIX_COO);
    gsl_spmatrix_d2sp(test_sp, test);


    gsl_spmatrix_float *test_float_sp = gsl_spmatrix_float_alloc_nzmax(N, N, 
N_nz, GSL_SPMATRIX_COO);
    gsl_spmatrix_float_d2sp(test_float_sp, test_float);


    gsl_matrix_free(test);
    gsl_matrix_float_free(test_float);
    gsl_spmatrix_free(test_sp);
    gsl_spmatrix_float_free(test_float_sp);




    return 0;
}

reply via email to

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