Skip to content

Commit

Permalink
Fixes gsl example compilation issue.
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Nicogene authored and drdanz committed Nov 2, 2017
1 parent 8efdca9 commit 1a4a63f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion example/matrix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ project(Matrix)

find_package(YARP REQUIRED)

find_package(GSL REQUIRED)

include_directories(${CMAKE_SOURCE_DIR})

add_executable(basic_ops basic_ops.cpp)
target_link_libraries(basic_ops ${YARP_LIBRARIES})

add_executable(gsl_example gsl_example.cpp)
target_link_libraries(gsl_example ${YARP_LIBRARIES})
target_link_libraries(gsl_example ${YARP_LIBRARIES} YARP::YARP_gsl GSL::gsl GSL::gslcblas)

12 changes: 7 additions & 5 deletions example/matrix/gsl_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

#include <yarp/sig/Matrix.h>
#include <yarp/sig/Vector.h>
#include <yarp/gsl/Gsl.h>

using namespace yarp::sig;
using namespace yarp::gsl;

int main(int argc, const char **argv)
{
Expand All @@ -29,8 +31,8 @@ int main(int argc, const char **argv)
v2=1;

double r;
gsl_blas_ddot((gsl_vector *)(v1.getGslVector()),
(gsl_vector *)(v2.getGslVector()), &r);
gsl_blas_ddot((gsl_vector *)GslVector(v1).getGslVector(),
(gsl_vector *)GslVector(v2).getGslVector(), &r);

printf("Res vector: %lf\n", r);

Expand All @@ -51,10 +53,10 @@ int main(int argc, const char **argv)

gsl_blas_dgemm(CblasNoTrans, CblasNoTrans,
1.0,
(const gsl_matrix *) m1.getGslMatrix(),
(const gsl_matrix *) m2.getGslMatrix(),
(const gsl_matrix *) GslMatrix(m1).getGslMatrix(),
(const gsl_matrix *) GslMatrix(m2).getGslMatrix(),
0.0,
(gsl_matrix *) m3.getGslMatrix());
(gsl_matrix *)GslMatrix(m3).getGslMatrix());

printf("Result: (%s)", m3.toString().c_str());

Expand Down

0 comments on commit 1a4a63f

Please sign in to comment.