Questions tagged [eigen]

Eigen is a C++ template library for linear algebra: matrices, vectors, and related algorithms.

Filter by
Sorted by
Tagged with
-4 votes
1 answer
92 views

matrix multiplication in C++ [closed]

I have the following function that takes too long to execute. I need to made this at least 2x times faster. ...
4 votes
1 answer
83 views

Implementation of Iterative Closest Point in C++

Here, is my implementation of Iterative Closest Point algorithm in C++. The code is written using the Eigen library. I have tried to implement an efficient coding methodology best to my knowledge ...
2 votes
2 answers
132 views

Coordinate Descent Non-negative Least Squares optimization

In my fast implementation of Non-negative Matrix Factorization (Rcpp Machine Learning Library, RcppML), about 40% of the runtime is spent solving Non-negative Least Squares (NNLS) systems (the rest of ...
  • 143
2 votes
1 answer
179 views

Fractional indexing and interpolation to reconstruct an image

I have a c++ project written as a Matlab Mex program that is constructing an image composed of IxJ pixels. Each pixel value is calculated by finding the contributions to that pixel from all the ...
  • 121
1 vote
0 answers
95 views

Calling Eigen library to do the linear operation of the matrix

I am a rookie of coding and I have written a c++ procedure which calls the Eigen library to do the linear operation of the matrix. Please help me to improve the efficiency of the loop. ...
3 votes
1 answer
2k views

Transforming from spherical coordinates to Cartesian coordinates using Eigen

I need to transform the coordinates from spherical to Cartesian space using the Eigen C++ Library. The following code serves the purpose: ...
  • 133
6 votes
1 answer
233 views

Multivariate normal density using Woodbury matrix inversion lemma

I'm trying to speed up by multivariate normal density function by taking advantage of the fact that the covariance matrix is of the form A + U C U'. The inverse of such a matrix can be calculated ...
  • 177
0 votes
2 answers
169 views

Writting “A Simple Least-Squares Approach” by Longstaff and Schwartz into a C++ class

Background: I have posted a similar question here. I followed the suggestions of @ Ben Steffan and made the appropriate changes despite number 6 that I did not understand and number 7. Question: ...
  • 159
3 votes
1 answer
622 views

Writting "A Simple Least-Squares Approach" by Longstaff and Schwartz; pricing American option contracts

Background: I have made a post about this on another account here. I am writing the least squares algorithm into a class in C++ and I want to make sure that what I am doing is the most efficient and ...
  • 159
2 votes
0 answers
392 views

Forward Monte Carlo Algorithm in C++

Background Information: Here is an outline of the algorithm known as Forward Monte Carlo for pricing American options which is from the paper, "A Forward Monte Carlo Method for American Options ...
  • 219
5 votes
1 answer
1k views

Optimizing a function in Eigen

I'm a beginner in C++ and I would appreciate advices to optimize the following function I wrote with Eigen (in fact, to be used with RcppEigen). So far, I observe a 3.5x speed-up compared to the ...
  • 159
4 votes
0 answers
1k views

Logistic regression with eigen

I am a new to Eigen, and I implemented a logistic regression model with it. It works but I don't know whether it is implemented in an efficient way. ...
  • 41
4 votes
1 answer
354 views

Simple neural-network simulation in C++ (Round 3)

As I mentioned at the end of my Round 2 answer, I've needed to expand my code in order to produce faithfully the data needed for Figure 1 of this paper. Unfortunately, the updates have made my script ...
  • 329
4 votes
1 answer
253 views

Simple neural-network simulation in C++ (Round 2)

Intro Yesterday I posted this question. Since then, I've updated my code to incorporate these suggestions. I've also removed the dependence on C++11. Finally, I've made the following changes that ...
  • 329
5 votes
1 answer
2k views

Simple neural-network simulation in C++

The C++ code below simulates the timecourse of the membrane potential (V) of a population of 128 leaky integrate-and-fire ...
  • 329
5 votes
2 answers
208 views

Computing the RPY tensor with C++/Eigen (linear algebra)

I'm mostly used to writing scientific code in MATLAB / Python / Julia and my experience with C++ is very limited. I've implemented a fairly simple computation of the Rotne-Prager-Yamakawa tensor in ...
7 votes
1 answer
2k views

Normalize Sparse Matrix along rows in C++ Eigen

I wrote a function to normalize sparse matrix along rows using C++ Eigen; however, I feel that it can be improved, and that I am not using some built in functions of Eigen. ...
  • 173
6 votes
3 answers
1k views

Are there any memory issues with this Eigen QR wrapper?

I am writing a wrapper to Eigen QR for my personal use and I am wondering if there are any memory leaks or undocumented behavior in my implementation, especially in the function ...
3 votes
2 answers
5k views

Implementation of Mahalanobis distances using Eigen

I'm trying to learn C++ with Eigen. Here's my attempt at computing Mahalanobis distances of a set of points x with respect to a sub-matrix ...