Questions tagged [c++]
For questions about writing C++ computational code or utilizing libraries written with C++.
54
questions with no upvoted or accepted answers
10
votes
0
answers
333
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 ...
8
votes
0
answers
4k
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 ...
5
votes
0
answers
241
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,\...
4
votes
0
answers
85
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 ...
4
votes
0
answers
197
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 ...
3
votes
0
answers
180
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 ...
3
votes
0
answers
159
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 ...
3
votes
0
answers
101
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/...
3
votes
0
answers
54
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 ...
3
votes
0
answers
102
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 ...
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 ...
2
votes
0
answers
52
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 ...
2
votes
0
answers
58
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 ...
2
votes
0
answers
334
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 ...
2
votes
0
answers
56
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 ...
2
votes
0
answers
190
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 ...
2
votes
0
answers
42
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 ...
2
votes
0
answers
85
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 ...
2
votes
0
answers
156
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)(...
2
votes
0
answers
782
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 ...
2
votes
0
answers
210
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 ...
2
votes
0
answers
135
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 ...
1
vote
0
answers
66
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 ...
1
vote
0
answers
83
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 ...
1
vote
0
answers
112
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.
...
1
vote
0
answers
842
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 ...
1
vote
0
answers
239
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 <...
1
vote
0
answers
280
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 ...
1
vote
0
answers
432
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++...
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-...
1
vote
0
answers
159
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 ...
1
vote
0
answers
237
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 ...
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 ...
1
vote
0
answers
170
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 ...
1
vote
0
answers
133
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/...
1
vote
0
answers
682
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 ...
1
vote
0
answers
140
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 ...
1
vote
0
answers
103
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 ...
1
vote
0
answers
706
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, ...
1
vote
0
answers
365
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 ...
1
vote
0
answers
309
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, ...
0
votes
0
answers
60
views
Where should we compute `Energy` and `Trajectory` in this listing?
Suppose, I have the following listing for a barebone MD simulation:
...
0
votes
0
answers
85
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 ...
0
votes
0
answers
52
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 ...
0
votes
0
answers
118
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 ...
0
votes
0
answers
108
views
Solving L1 minimization problems in Eigen
I have an $m\times n$ dense matrix $\mathbf{M}$ and wish to solve $\mathbf{M}\mathbf{x} = \mathbf{b}$ via any of the "L1" methods using Eigen. By this I mean I'm happy with using basis ...
0
votes
0
answers
88
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 ...
0
votes
0
answers
86
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 ...
0
votes
0
answers
222
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 ...
0
votes
0
answers
142
views
Calculating the exponential of a complex matrix
I am trying to calculate the exponent of a 3 x 3 matrix using the formula
$\sum_{i=0}^\infty\frac {A^n}{n!}$
I believe that my error may lay in the scalar division with a factorial or the member ...