Questions tagged [c++]

A powerful object oriented programming language.

Filter by
Sorted by
Tagged with
3
votes
2answers
663 views

How to avoid precision loss when handling very long integer constant involved multiple precision computation?

I have a numerical computation problem which requires solving nonlinear equations (with long integers) in multiple precision. I tried an MPFR C++ wrapper from this link by Pavel: mpfr C++ wrapper by ...
3
votes
2answers
113 views

Are matlab C library versions backwards compatible?

I have some C++ code that links to matlab2008b. Are matlab 2012a and 2012b backwards compatible with 2008b? If it's not trivially compatible, are there some simple steps to make it compatible?
3
votes
2answers
1k views

Developing a C++ solid mechanics program

I am a beginner in computational science and programming. I am doing research in non linear solid mechanics analysis and using C++ for coding. I have been exploring various finite element open source ...
3
votes
1answer
369 views

Software for triangulating a point set (with restrictions)

I want to triangulate a point-set like the one below. I would like the triangulation of the point-set to have the following properties The triangles must have as vertices the black and orange points ...
3
votes
5answers
1k views

Speed of solving linear system with block diagonal matrix

I have a bunch of 3x3 linear systems of the form $Ax=b$. In general, would it be faster to solve each individual system, or to formulate it as a giant block diagonal system and solve that? I expect ...
3
votes
1answer
630 views

Accurate implementation of the logarithm of the incomplete Beta function in C++?

I need an accurate implementation (for use in C/C++) of the logarithm of the incomplete Beta function: $$\log \mathrm{B}(x,y;\alpha,\beta) = \log \int_x^y t^{\alpha-1}(1-t)^{\beta-1}\mathrm{d}t$$ ...
3
votes
2answers
3k views

In C++, how do you calculate the analytical value of $\int_a^b \left|\sin x \right|\,dx$?

How would I find the definite integral (between any 2 limits, say a and b) of the absolute value of sin(x)? I can calculate for the interval 0 to Pi, and from 0 to 2*Pi, but what if the user enters a ...
3
votes
1answer
670 views

SQP optimization algorithm tuning advice

I am using a stable version of SQP algorithm from a lib. Parameters setting is left to the developer, althought default values are at hands. I launch solver on very simple optimization problems s.a. ...
3
votes
1answer
48 views

PETSc - Manipulate BAIJ matrix locally

My program loads a parallel PETSc matrix $A$ on several MPI processes, each holding a block submatrix $A_i$. I would like to retrieve the local submatrix $A_i$, the one corresponding to the current ...
3
votes
2answers
2k views

C++ Library: What is the common libraries that do polynomial arithmetic?

I need to know what libraries (in C++) support polynomial arithmetic specially over a field. So I can give to it an array of coefficients of polynomial over a field and it returns the roots of ...
3
votes
1answer
246 views

non-smooth convex c++ solver

I happened to know that there are advanced established techniques for non-smooth convex optimization in research. For example, these two papers: Nesterov, "Smooth minimization of non-smooth functions"...
3
votes
1answer
69 views

Library for solving a linear selection problem in a distributed memory machine

I need to solve a very large O(10^10) linear selection problem in a distributed memory machine, is there any library that will solve it for me? In shared memory ...
3
votes
2answers
118 views

C++ library to mutate pdb residues

Are there any open source libraries available to mutate PDB protein residues? If so are do you have any examples of them?
3
votes
1answer
226 views

SLEPc eigensolvers take long time to converge for large sparse symmetric matrices

I am leveraging the SLEPc library for solving the first $k$ (where $k = 3$ or $4$) eigenvalues and their corresponding vectors for a matrix of size 200,000. The matrix is sparse and symmetric. I ...
3
votes
1answer
794 views

Vectorize a part of a huge matrix in C++

I have a large matrix, side-length is about $n\geq 1000$. I need to do element-wise multiplication of this matrix with another matrix many, many times. I make this process by: Vectorizing (through ...
3
votes
1answer
568 views

Why is MPI/PETSc only showing 1 processor even though it works for helloworld?

I am a beginner with Unix and MPI. For the serial program, I run the program by typing make in /directory/buildagain and then <...
3
votes
1answer
335 views

Computing the (non-convex) boundary of a set of paths between two points

I have a set of paths between two fixed points (marked in red below). Each of these paths consists of an ordered series of $\{x, y\}$ points (marked in blue). I am trying to find the ordered set of ...
3
votes
0answers
38 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
0answers
61 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
0answers
52 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
0answers
908 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
4answers
11k views

What's the simplest way to graph a 2d array generated in C++ using Windows 7?

This was so much easier in Python (so much so that I'm considering going back to matplotlib for data analysis). But really, trying to figure out ROOT and Boost graph library and mathgl makes me want ...
2
votes
1answer
2k views

Parallel vs Serial Thomas Algorithm

I am currently writing a code that solves a large tridiagonal matrix every iteration and runs for 1,000's of iterations. I am currently using a Thomas algorithm to solve the matrix serially. I found a ...
2
votes
2answers
244 views

Suggestions for open source C++ library for medium scale non-linear solver

I need to find the root of a nonlinear system (which comes out of collocation, so I will change the order to test). I will likely have about 50-300 variables, and the Jacobian is going to be ...
2
votes
2answers
179 views

Compiled c++ code runs much faster with double than float. Explanation?

I am still rather new on here and I hope question is suitable for this forum otherwise please help me migrate it to greener pastures. I am an electrical engineer specializing in applying mathematics ...
2
votes
1answer
513 views

How to implement the spectral decomposition of a symmetric dense matrix via Eigen C++

Spectral decomposition of symmetric matrix $A_{n\times n}$, specifically, $n=3$ find the orthogonal matrix $Q$ and diagonal matrix $\Lambda$ such that: $A=Q\Lambda Q^T$ How to implement such ...
2
votes
3answers
147 views

Find a solution of large system of inequalities

I have a large system of homogenous inequalities involving 33 real unknowns of the form $$ \vec{F}(z_i)^T \cdot \vec{X}>0\, $$ where $\vec{X} = \left(x_1,...,x_{24}\right)^T$ are the unknowns and ...
2
votes
2answers
260 views

Integration of a diverge function in c++ GSL Library

I am trying to perform an Integral of Hypergeometric function 2F1(a,b,c,x) from -1 to 1 for some good values of $a,b,c$ (lets say $a=1,b=2,c=3$) . I did it in ...
2
votes
1answer
1k views

Armadillo library appears slow

I have been experimenting in building a C++ project for a FDTDS system for Electro-Magnetics. I have implemented a class [see below] which I called mesh using the Armadillo library. The 3D matrices {...
2
votes
2answers
803 views

Kummer's confluent hypergeometric for complex arguments in C/C++?

I need to evaluate Kummer's confluent hypergeometric function for imaginary arguments: $$_1F_1(a,b;ix)$$ where $i$ is the imaginary unit, $a,b,x$ are real, and $a,b>0$. Is there a routine ...
2
votes
2answers
137 views

General Linear Algebra Wrapper Library

I am currently mulling over the idea of taking a code I currently work with and rebuilding it from the ground up to allow for the use of more efficient programming and numerical techniques. In the ...
2
votes
1answer
297 views

MD Simulation: Reference for the Neighbor's List Method

With a rather basic knowledge in C++, I have written my own MD simulation code. Currently, I calculate forces in the most naive way: I go through all the atoms and account for their interactions. This ...
2
votes
1answer
281 views

Mathematica NIntegrate function in C++

I am working on computing a challenging integral. I am working with someone else who wrote some code in Mathematica to compute it. I do not have mathematica so I am trying to do the same thing in C++. ...
2
votes
1answer
85 views

How can I efficiently position the different segments of a large vector in Eigen C++?

I have a very large(up to 9 000 000) VectorXi vector defined in Eigen C++ which is read from a data file. The vector consists of 0, 1, 2, ...n segments with ...
2
votes
1answer
46 views

Gmsh meshes flat faces incorrectly for cylindrical faces

I have some C++ code that generates meshes from step files and then analyses these meshes for visibility of the faces from different viewing directions. I currently use CGAL but I would like to switch ...
2
votes
1answer
70 views

How to justify using available code (in different language) for comparing algorithms

I have proposed an algorithm for a scheduling problem in a submitting paper. In the revision, the reviewer asked us to compare with another algorithm from the literature. Our algorithm is in MATLAB, ...
2
votes
1answer
117 views

What are the tradeoffs of using statically allocated arrays vs. pointers and dynamic allocation? [closed]

I am learning Monte Carlo simulation by C++. I begin with reading codes (from the internet and text books) of the 2D Ising model and the XY model. I find some people define spins simply by a two ...
2
votes
1answer
3k views

How to use TrangularView class in Eigen C++

For a nonsingular lower or upper triangular square matrix $A$, how to solve such linear system in Eigen: $$A x = b$$
2
votes
1answer
967 views

Particle Tracking Code - MATLAB vs. C++

First some background, I am a mathematician by training with very little formal training in programming. I am most comfortable in MATLAB and have been working with it for a long time. My second choice ...
2
votes
1answer
406 views

Fast C++ implementation of sparse binary matrices

I am looking for the subject. The size of matrices will be around 1000x2000 elements with linear amount of ones (say, 6000 ones in the whole matrix). The operations I will use the most: iterating ...
2
votes
1answer
149 views

Topics about the deal.II finite element library class “SparsityPattern”

When learning the deal.II FE library, I am a bit confused about the mechanism of its "SparsityPattern" class. Through reading the documentation, I only got to know that it uses the Compressed Row ...
2
votes
1answer
2k views

Solving Linear Equations using Eigen

I am trying to solve linear equations in c++ using the Eigen library. For the simple equation Ax=b, I have a sparse matrix A that is n x n, and known values for b which is n x 1, but I need to find ...
2
votes
1answer
368 views

Recommendation for C/C++ library which offers Schur complement functions?

I need to find C/C++ libraries which offer function for computing Schur complement. I know about MUMPS and Pastix, but I need more of them to compare them in my research. Do you have any experience ...
2
votes
1answer
512 views

Not enough memory for GMRES

After realizing that Gauss-Seidel is extremely slow for my simulation, i wanted to try GMRES and luckily found the C++ code here without diving into the theory. The size of the matrix in my case is <...
2
votes
3answers
382 views

importing PARI libraries ( in C++) with Python

I noticed that Python does not have a good datatype for rational numbers, certainly not for algebraic numbers like $\tfrac{1 + \sqrt{2}}{3}$ or the real root of $x^3 - 5x + 7$. They have the ...
2
votes
1answer
2k views

Simple open-source Quantum chemistry or DFT code in C/C++

I know lot of density functional packages in fortran, including one which we are developing in our group (Fireball-DFT) but I don't like fortran very much and I would like something which is easier ...
2
votes
3answers
462 views

State of the art in parallel data structures [closed]

I'm currently evaluating how I could implement several algorithms on a parallel computer with a large number of nodes, each also equipped with a powerful GPU. It turns out that for many algorithms, it ...
2
votes
1answer
758 views

Complex Numerical Integration using GSL

I want to program an integration routine in C++ using the GSL library but for complex functions. How should I split my integrand to apply the gsl_integration_qag function on it. Just integrate the ...
2
votes
1answer
350 views

Kernel of a Sparse Matrix

Given a sparse rectangular matrix $A$ (let's say, with dimension $n,m$ and number of non-zero elements $O(n)\sim O(m)$) with entries in $\mathbb Z/2\mathbb Z$ I'm looking for a basis of the kernel as ...
2
votes
1answer
584 views

Interpolation using compactly supported radial basis function

I have been struggling for two days with the following problem. I would like to do a $d$-dimensional interpolation over some data. I tried first to use polyharmonic splines, but when the size of data ...