Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:06:39+00:00 2026-06-12T16:06:39+00:00

I use Eigen for most of my code but I would like to use

  • 0

I use Eigen for most of my code but I would like to use Miser or Vegas monte-carlo integration from GSL. I need to convert Eigen’s vectors to c arrays of doubles
what would be the best way to do it?

Matrix<double,3,1> --> c_array []
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:06:41+00:00Added an answer on June 12, 2026 at 4:06 pm

    I have worked with Eigen before…

    Usually, for simple access to the internal array data, like mentioned by user janneb in this thread, you just want to invoke data():

    Vector3d v;
    // Operations to add values to the vector.
    double *c_ptr = v.data();
    

    If you wish to iterate the individual values to perform some operation, you want to iterate every line (.row(index)) and column (.col(index)), depending on the matrix order that you want to lay down in the destination vector.

    In your specific example, you need only iterate the rows:

    Matrix<double,3,1> --> c_array []
    

    You would want to call .col(0). Should similar needs arise, the specific documentation is always helpful!

    So you would end up with something like (assuming you wish to use a three-line single-column matrix):

    Vector3d v;
    // Operations to add values to the vector.
    for (int i=0; i<v.rows(); ++i)
      c_array[i] = v(i,0);
    

    Hope that helped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use the Eigen matrix library as the linear algebra engine
I decided to use Eigen library in my project. But it is not clear
I'm making use of Eigen library which promises vectorization of matrix operations. I don't
in my project I'm making use of Eigen C++ library for linear algebra and
I am attempting to pass an Eigen::Vector4d into an function like this: Matrix3d quat2DCM(Vector4d
When I create a matrix using Eigen, like this: Eigen::MatrixXd M(3,3); M<< 1.0, 4.0,
Consider the following code (C++11), which uses the Eigen 3 library (http://eigen.tuxfamily.org): #include <iostream>
I don't know very much about template programming, and I currently use gsl. I'm
Use case: I find a piece of code that I do not understand at
use this code, in the Preferences activity, to know when the reset preference has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.