Skip to main content

Questions tagged [c++]

For questions about writing C++ computational code or utilizing libraries written with C++.

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11 votes
0 answers
355 views

Numerical integration using interval arithmetic, nowadays

Is there now a package for rigorous numerical integration that uses interval arithmetic and has access to a well-developed library of special functions? By "well-developed", I mean something that, at ...
H A Helfgott's user avatar
8 votes
0 answers
5k views

Good C++ optimization library for BFGS

To implement maximum likelihood estimators, I am looking for a good C++ optimization library that plays nicely with Eigen's matrix objects. Eigen has some capability of interfacing of its own but if ...
Hirek's user avatar
  • 183
5 votes
0 answers
247 views

Adaptive mesh data structure for Fast Marching Method to overcome RAM limit

On an uniform mesh of positions in space $\ (x_i,y_j,z_k)$: $$\ x_i = x_0 + i\Delta x,\quad i=0,\ldots,n_x$$ $$\ y_j = y_0 + j\Delta y,\quad j=0,\ldots,n_y$$ $$\ z_k = z_0 + k\Delta z,\quad k=0,\...
Andy's user avatar
  • 183
4 votes
0 answers
89 views

Global reconstruction defined elementwise in a-posteriori error estimator

This question is a follow-up of this previous one. In "Error Control for Discontinuous Galerkin Methods for First Order Hyperbolic Problems" by Georgoulis et al., an error estimator is ...
FEGirl's user avatar
  • 435
4 votes
0 answers
226 views

High quality constrained optimization C++ library with matrix free second order solver?

I'm working with large scale constrained optimization problem. Some of my constraints can be non linear. Currently i'm using IPOPT. Quality is good by my Hessian computation too slow. It seems that i ...
Daiver's user avatar
  • 225
3 votes
0 answers
195 views

How can I improve this matrix product calculation in OpenCL?

I am trying to compute a matrix-matrix product of N stacked complex double N x N matrices. For simplicity, I assume N = 512. I have written code in C++ parallelized with OMP and using OpenBLAS for the ...
sqrt6's user avatar
  • 31
3 votes
0 answers
166 views

Derivative of Whittaker-Shannon interpolant

Last time we looked at how to improve the accuracy of Whittaker-Shannon interpolation, where user njuffa demonstrated that judicious use of sin_pi could greatly ...
user14717's user avatar
  • 2,165
3 votes
0 answers
127 views

Structural Analysis Library

Can anyone recommend a structural analysis library that satisfies the following requirements: C++ API Simulate both beam elements and shell (slab) elements Both static and dynamic analysis Free and/...
Cory Kramer's user avatar
3 votes
0 answers
55 views

Coupled Diff Equation from Bose Einstein distribution

I am a student doing physics hons and have had very little experience in programming. This semester we are supposed to do a computational project in thermodynamics. I have to solve these two coupled ...
Sid's user avatar
  • 31
3 votes
0 answers
107 views

Bracket Algebra, Straightening Algorithm

My apologies if the question is simple. I need to write a code for straightening algorithm. Which includes defining bracket algebra. I tried to write it in CoCoA-5, but it wasn't possible because ...
Sepehr Jafari's user avatar
3 votes
0 answers
1k views

total memory usage of MPI shared memory

I am trying to use the MPI share memory feature. I have several SMP nodes, and each of them has four cores. I need an array of size N for each node that should be accessed by all four cores in each ...
user4147776's user avatar
2 votes
0 answers
89 views

Efficiently retrieiving indices from lattice with periodic boundary conditions

This is something I've never thought too much about because it seemed like an unnecessary micro-optimization, but I've come across a situation where this computation is actually the primary bottleneck ...
Henry Shackleton's user avatar
2 votes
0 answers
65 views

N-body correct scaling

I realized an usual way to scale an N-body problem for an N-body simulation is by choosing units such that gravitational constant $G = 1$, but I'm probably doing it the wrong way. Suppose I simply ...
Martrin's user avatar
  • 31
2 votes
0 answers
455 views

Computing Singular Value Decomposition of small ($4\times 4$) matrices

I need to compute the Singular Value Decomposition (SVD) of many $4 \times 4$ matrices. I'm looking for SVD algorithms specialized for small matrices. I've read that the ...
mana's user avatar
  • 131
2 votes
0 answers
61 views

CUDA and implicit array expansion

I am retrying this question since I didn’t do so properly last time: I have implement a simply c++ CUDA example that takes A [m x 1] and B [1 x N] and adds them element wise with what I am used to ...
S moran's user avatar
  • 141
2 votes
0 answers
230 views

Whi are chi-squared distributions in (C++) boost::random and C++ STL faster than in boost::math?

I am trying to generate random chi-squared numbers in C++, according to some degree of freedom (which can be a float). Several libraries can be used for that purpose, among which the C++11 Standard ...
Clej's user avatar
  • 153
2 votes
0 answers
45 views

Algorithm to join hexahedra and obtain outline volume

I would like to join several hexahedra and obtain an outline volume. First, I started with 2D implementation. In 2D, there are non-intersecting quadrangles which always touch each other as shown in ...
Shibli's user avatar
  • 293
2 votes
0 answers
92 views

Looking for a version of DSDP that is less prone to integer overflows than the original

I am working on a problem that involves semidefinite programming (constrained optimization of fairly large positive definite matrices). The software is written in C++ and calls DSDP 5.8 to solve the ...
András Aszódi's user avatar
2 votes
0 answers
161 views

What could be causing multi-dimensional numerical integration inconsistency?

I'm trying to numerically integrate a multi-dimensional expression. The integrand is complicated; for example this is the integrand for $N=4$: $$\begin{aligned}&x_1^6x_2^5x_3^3x_4^2(x_1-x_1x_2)(...
Allure's user avatar
  • 121
2 votes
0 answers
844 views

Using C/C++ for Markov chain Monte Carlo (MCMC) methods

I'm working on optimizing the parameters of a mathematical model to fit experimental data, using an existing formula for the likelihood of observing the data given a set of parameter values. At the ...
Keith Fraser's user avatar
2 votes
0 answers
219 views

lightweight implementation of semiempirical quantum chemistry (e.g. MNDO,AM-1,PM3)

I'm searching for semi-empirical quantum chemistry solver which would be easy to integrate into my own software. I found a few implementations which can be in principle used e.g. MOPAC, ORCA, SQM some ...
Prokop Hapala's user avatar
2 votes
0 answers
137 views

Lapack++ for QR algorithm

I have recently started using Lapack++ which I found convenient for my programming purpose, in general. Now, I need to solve a matrix using QR algorithm. I've searched the user manual and I found a ...
Sanal Parameswaran's user avatar
1 vote
0 answers
68 views

How can I optimize the solution of linear systems in my Finite Element Method code for solving nonlinear computational mechanics problems?

Currently, I use Eigen3 for linear algebra operations on sparse matrices and either UMFPACK or CHOLMOD from SuiteSparse to solve sparse linear systems. However, as my model grows larger and the need ...
Ponyboy Curtis's user avatar
1 vote
0 answers
99 views

Resource to learn assembly code

I'm a PhD student in mechanical engineering and I have to perform a lot of simulations for my project. In my lab we use several well-known libraries, from FEM to machine learning. As we're doing ...
FEGirl's user avatar
  • 435
1 vote
0 answers
148 views

Does cblas_dgemm mutate my input matrices?

I have written a matrix class Matrix<T> for which I have implemented a wrapper function for cblas_dgemm. ...
Urwald's user avatar
  • 111
1 vote
0 answers
1k views

Symmetric Matrix in Eigen C++

I am aware of a symmetric matrix type in uBLAS as ublas::symmetric_matrix matrix. Is there an equivalent for this in Eigen library that can be used to construct one or do we need to explicitly check ...
user1408865's user avatar
1 vote
0 answers
273 views

Efficient multidimensional numerical integration in R and C++

I'm trying to perform a 4-dimensional numerical integration in R using a function I wrote in C++ code which is then sourced in <...
CafféSospeso's user avatar
1 vote
0 answers
409 views

Why does Eigen allocate a temporary to evaluate A.noalias() = B.transpose()*C in parallel?

I wrote a program which iteratively transforms data using matrix multiplications. To minimize the number of large memory allocations, I use two roughly equal-sized ...
Wout12345's user avatar
  • 121
1 vote
0 answers
487 views

Optimize speed for calculating the approximate inverse of a large matrix

I am searching for a faster method to calculate an approximate inverse of a large matrix (up to 32000x32000) resulting from a discrete non-linear system of partial differential equations. I'm using C++...
enco909's user avatar
  • 11
1 vote
0 answers
1k views

Which library to use in C++ for fast DCT's?

I need to apply a 1D type-II DCT (Discrete Cosine Transform) to each column of a matrix while normalizing the result in C++. Effectively, I want to multiply my matrix with an orthogonal type-II DCT-...
Wout12345's user avatar
  • 121
1 vote
0 answers
196 views

How to deal with a huge system of ODEs in Boost ODEINT?

I am using the C++ library ODEint, which is part of Boost, to solve an extremely large system of coupled ODEs - in particular 1975 equations with large rational functions in the coefficients. In the ...
Schnarco's user avatar
  • 111
1 vote
0 answers
299 views

Metis: how to use and tutorial recommendation

I am new to METIS and trying to use it in my fortran code. I read the manual online. But still, I am not sure about how to implement it my code. I tried the test cases in the graphs directory. For ...
shushi_piggy's user avatar
1 vote
0 answers
1k views

Newton - Raphson method : maxima of function in 2 variables

I am computing the maximum of a function (with two-variables) using Newton-Raphson method. The function is : $e^{-(x \ - x_0)^2 - (y \ - y_0)^2}$, whose maxima exists at $(x_0,y_0)$. The Jacobian ...
Sthavishtha Bhopalam's user avatar
1 vote
0 answers
183 views

MPI_Finalize() only some processors

I want to develop a distributed algorithm with MPI which have load balancing capability. But there is a situation that I'm not very clear about, which is, when the number of tasks is less than the ...
user123's user avatar
  • 699
1 vote
0 answers
134 views

Problem in analyzing the program of Gauss Jordan Inverse problem

I had to code a program which calculates Inverse of a matrix by Gauss-Jordan Inverse method , I was trying to analyse the program and then code it myself. the link http://hullooo.blogspot.in/2011/...
BAYMAX's user avatar
  • 229
1 vote
0 answers
706 views

Looking for C++ function for performing optimization of parameters for multivariable function

I am adapting a Java program from C++ and need a C++ function to perform the same task as the Java BOBYQAOptimizer() function. Can anyone recommend a C/C++ library with equivalent or similar functions ...
Keith Fraser's user avatar
1 vote
0 answers
148 views

C++ Library: What is the Most Efficient Library that Factorizes a Polynomial?

I need to know what library is the fastest one that can factorize a polynomial of large degree whose coefficients are big integers. I have tried NTL library to factorize a monic polynomial but it is ...
user13676's user avatar
  • 161
1 vote
0 answers
105 views

Elemental vs DPLASMA

I want to use one of these two libraries into my C++ project to basically invert a dense matrix (with Cholesky). Of course, I am interested in a distributed environment. Both libraries seem nice so ...
gsamaras's user avatar
  • 113
1 vote
0 answers
708 views

Can you provide me with the source code of DMRG writen by C++?

I want to study the Density matrix renormalization Group(DMRG). Can some one provide me with the souce code which is writen by C++ for study purpose only? The code is not necessiary very professional, ...
Roger209's user avatar
  • 111
1 vote
0 answers
369 views

Practical implementation of spatial binning for rectangular range queries

I have a bunch of polygons and a coarse uniform grid. I want to implement two different range queries, for a rectangle aligned with the uniform grid: Does the rectangle intersect with any polygon at ...
Thomas Klimpel's user avatar
1 vote
0 answers
319 views

Memory allocation error with GSL ODE solver applied to system of 4 ODEs

I am trying to solve a (large) system of ODEs with GSL solvers. When I use driver method I get an error message of could not allocate space for gsl_interp_accel, ...
Eugene B's user avatar
  • 111
0 votes
0 answers
56 views

Is there a reasonably simple solution for nonlinear parameter optimization using c++ objects?

I have a problem under the form of a set of 2 ODE that includes 6 free parameters. I need to optimize these parameters based on experimental results. So far, basically, I have implemented a C++ object ...
user22744's user avatar
0 votes
0 answers
98 views

Numerically integrating photon wavelength undergoing gravitational time dilation

I am trying to integrate the wavelength of a photon that is undergoing gravitational redshift. The formula that I'm trying to emulate is: \begin{equation} \lambda_{i} = \lambda_{e} \frac{ \sqrt{...
shawn_halayka's user avatar
0 votes
0 answers
66 views

Where should we compute `Energy` and `Trajectory` in this listing?

Suppose, I have the following listing for a barebone MD simulation: ...
user366312's user avatar
0 votes
0 answers
109 views

How to use a surface mesh parameterization?

I'm currently playing with the surface mesh parameterizations of the C++ library CGAL. For a mesh with a boundary, the computed uv-space (parameterization domain) is either a disk or a square, and so ...
Stéphane Laurent's user avatar
0 votes
0 answers
96 views

How best to iterate over three dimensional grid?

My problem is to iterate through $[0.95,1] \times [0.95,1] \times[0.95,1] \in \mathbb{R}^{3}$. Is there a generic way to do this? I was considering rolling it all out and effectively vectorising the ...
KeynesCoeFen's user avatar
0 votes
0 answers
224 views

Numerical integration library interfacing with eigen

I am looking for a numerical integration library like this one. The examples look very appealing but I see that all test functions use very barebones C arrays. Do you have any recommendations of ...
KeynesCoeFen's user avatar
0 votes
0 answers
125 views

Recursion relations for integrating Gaussian functions

I'm trying to implement a numerical method used in quantum chemistry from scratch. I'm using this paper as a reference. It's also available on Sci-Hub. So, the method requires calculating integrals of ...
Dmitry Govorov's user avatar
0 votes
0 answers
93 views

Book recommendation request: A good C++ based software development book for a computational mathematician

I'm hoping that this type of question is on-topic, and I have put in a little hunting to make sure it isn't a flat out repeat. If it is either of the above, I apologize in advance. I'm an early career ...
Chessnerd321's user avatar
0 votes
0 answers
247 views

Ill-conditioned stiffness matrix

I am writting a Fem code in c++ for a 2d plane stress model. My question is regarding the assembly stiffness matrix.I noticed that some elements of the matrix are not exactly zero but insted a number ...
spyros's user avatar
  • 481