A powerful object oriented programming language.

learn more… | top users | synonyms

0
votes
1answer
71 views

Domain Decomposition with PETSc

Does anyone have any experience on Domain Decomposition using PETSc library? I have used PETSc for creating my vectors and matrix within my C++ code. I also used KSP to solve the linear system. I ...
-1
votes
0answers
40 views

Newton raphson method for finding square root of number [closed]

I am trying to use the newton raphson method for finding square roots. Considering the function f(x)= c-x^2 if we solve for f(x) =0 then x = square root of c which is what we want to find ...
0
votes
0answers
20 views

Cardiac Excitation Threshold in C++ modelling

So I am trying to write a code in C++ about the cardiac excitation threshold. I know that this excitation threshold is the shortest stimulus2 value at which it can conduct an action potential (known ...
0
votes
0answers
32 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 ...
0
votes
1answer
41 views

Windows C++ library for operations on mesh with a mex-interface in Matlab?

Please recommend me a well documented C++ library that I could wrap with a mex-interface in Matlab. The library should have the capability to read meshes (optimal in different formats, at least in ...
0
votes
0answers
29 views

Sequence optimization for multithreading

Given a list of object I must compute an expensive operation on any couple of object of the list. So I need to create a sequence of tasks. I want to find the sequence of tasks such that there is the ...
0
votes
2answers
80 views

How to determine the number of c points in algebraic multi grid

I am trying to write an algebraic multi-grid solver (in c++). At a given level I determine which nodes are c-points and which nodes are f-points (where the total number of c and f points equals the ...
3
votes
2answers
90 views

Should I pass command line arguments to MPI_Init or not?

When writing MPI 3.0 code, should I pass argc and argv to the MPI_Init call or not, and why? ...
0
votes
1answer
80 views

Fastest linear solver for sparse positive semidefinite, striclty diagonally dominant matrix

What is the state of the art for fastest linear solver for sparse, positive semi definite and strictly diagonally dominant matrix with N varies from ~700 to ~3000, and about a 1/16 of the matrix is ...
0
votes
1answer
79 views

How can I use Scipy to fit data generated from a C++ model?

I currently have a functioning and blazing fast model written in C++ and CUDA. However, I'd like to use Scipy.minimize to fit the model to some experimental data. I was hoping it would be easy, but ...
4
votes
3answers
104 views

Machine precision and local error

I'm working with an RKF45 integrator that I have programmed using CUDA C++ on my GPU and am pondering a few questions as I'm trying to track down some issues with my code. I'm using double ...
3
votes
2answers
143 views

Looking for Runge-Kutta 8th order in C/C++

I would like to use Runge-Kutta 8th order method (89) in a celestial mechanics / astrodynamics application, written in C++, using a Windows machine. Therefore I wonder if anyone knows a good library / ...
0
votes
2answers
160 views

Most efficient library to diagonalize exactly large hermitian or unitary matrices

I am working on a physics problem which requires obtaining the exact eigenvalues and eigenvectors of Hermitian and Unitary matrices numerically. Naturally I would like to ask the experts what are the ...
1
vote
1answer
84 views

How to minimize the artefact of a cartesian to polar transform followed by a polar to cartesian transform?

I'm transforming cartesian images into polar images. (x,y) => (angle, radius) I fill the polar image by iterating on each of its pixels and filling them by doing the reverse polar transform. For a ...
2
votes
2answers
62 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
3answers
217 views

How to efficiently assemble global stiffness matrix in sparse storage format (c++)

I am writing a finite element solver in C++. The main bottle neck is assembling the global stiffness matrix in sparse compressed row storage (so far I am only solving steady problems). Because I don't ...
7
votes
1answer
69 views

Do C++ matrix libraries translate compound vector operations to single loops?

I am trying to replicate Fortran90 array syntax using a C++ library. The libraries themselves are discussed at length in this question. They can all do something like this: ...
2
votes
0answers
67 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$$ ...
0
votes
1answer
57 views

GMRES: Making the matrix square without solving for boundaries

How do we define the matrix for GMRES, if we do not want to solve the boundary elements but only the interior ones. I am using pentagonal elements so in a row there are 6 elements (cell itself + 5 ...
2
votes
1answer
94 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
98 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
5answers
364 views

Fast, lightweight C++ tensor library for dimension-agnostic code

I am looking for a C++ tensor library that supports dimension-agnostic code. Specifically, I need to perform operations along each dimension (up to 3), e.g. calculating a weighted sum. The dimensions ...
1
vote
1answer
72 views

what went wrong with my logistic regression implementation in c++?

I have implemented a simple logistic regression function with IRLS algorithm using the armadillo linear algebra libray ...
1
vote
1answer
139 views

Coding complex equations into C++

I have here equations from a paper by E. Bradlow. They're for counting the events in a Weibull-distributed data set. $$\begin{align} \Pr(N(t)=n) &= \sum_{j=n}^\infty{\frac{(-1)^{j+n}(\lambda ...
12
votes
4answers
2k views

What language should I use when teaching an undergraduate course in computer programming?

Going to teach students of undergraduate level a course titled Introduction to Computer Programming. I am confused a bit. In Computational Physics scientists use C/C++ or Python or Fortran,CUDA ...
3
votes
3answers
132 views

Leave openMP theads ready

I have a C++ program that has a double for loop that I'd like to parallelize using opeMP. It is simple (a polynomial product) of varying length (between 100 and ...
0
votes
1answer
54 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$$
1
vote
1answer
140 views

How can I reuse the SVD of matrix A to solve LS problems for both A and its transpose via Eigen C++?

If $A\in R^{m\times n}, b\in R^m, c\in R^n$, if I need to solve the least square problems via SVD of $A$ and $A^T$, i.e. I need to solve the least square solutions to following linear systems via ...
3
votes
1answer
88 views

What is the most efficient way to obtain the max eigenvalue of a specific symmetric matrix via Eigen C++

Suppose I have a symmetric matrix $A_{1000\times 1000}$, which can be represented by: $A = J G J^T$ where $J$ in 1000x3 is full column rank dense matrix; $G$ in 3x3 is a nonsingular dense matrix. ...
4
votes
3answers
314 views

Which algorithm to use for solving an LP with a very large number of variables?

I'm a newbie at modelling and optimization of LPs. My research problem concerns assigning tasks/jobs to virtual machines in a data centre depending on the least energy cost incurred. As you can ...
4
votes
1answer
134 views

Solver suggestion for many small quadratic problem in C++

I have a C++ program/model that in some parts already use IPOPT (with ADOL-C and ColPack) to solve some pretty large non linear problems. Now in an other part of the program I need to solve a large ...
2
votes
1answer
59 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 ...
8
votes
0answers
209 views

Implementation of Jacobi-Davidson method for cubic eigenvalue problem

I have a large cubic eigenvalue problem: $$\left(\mathbf{A}_0 + \lambda\mathbf{A}_1 + \lambda^2\mathbf{A}_2 + \lambda^3\mathbf{A}_3\right)\mathbf{x} = 0.$$ I could solve this by converting to a ...
2
votes
1answer
252 views

Implementation of the Numerov Method for the 1D square well

I want to solve the Schrodinger via the Numerov Method but I had some troubles. I'm programing in C++, so here is my code: ...
2
votes
1answer
116 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
1answer
105 views

How to re-use the coefficient matrix decomposition result when solving linear systems by Eigen C++

My problem needs to solve dense symmetric linear systems something like: A x = b, A y = x, ...
1
vote
1answer
313 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 ...
3
votes
3answers
678 views

C++ Libraries for solving Complex Linear systems Ax=b [duplicate]

I am interested in solving a sparse complex linear system Ax=b where A is a square matrix of complex numbers and b is vector of complex numbers. If possible I would like such a library to be ...
1
vote
1answer
167 views

How to change the dimensions of an Eigen Matrix in a loop?

I have a while loop, in which I use a Matrix A, vectors B and x with varying dimensions: ...
3
votes
2answers
156 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
192 views

Can the Levenberg-Marquardt algorithm be used for minimization and not fitting

Can the Levenberg-Marquardt algorithm be used for minimization and not fitting? Usually we input the derivative of the function we want to fit in the minimizer. Now if I assume I have an objective ...
2
votes
3answers
1k 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 ...
6
votes
1answer
330 views

Why am I getting so much error for my Runge Kutta Fehlberg solver?

My current project is a reprogramming of a protein folding model involving the solution of thousands of ODEs in C++. I've been making some stop and start progress as I'm writing the solver to run ...
2
votes
2answers
223 views

How Do I solve large systems given UMFPACK memory limitations?

I am trying to solve a system of equations (A x = b) for 3D heat diffusion (i.e. each equation has at most 7 terms not including the constant "b" term) using UMFPACK with boost numeric bindings to ...
0
votes
1answer
646 views

Vertical and horizontal segments intersection (Line Sweep)

Introduction: I have a vertical segment S That i want to move across a plane (Left --> Right), and find intersections with horizontal lines. Problem : The problem which i am having is the ...
3
votes
1answer
159 views

A programming model for Quantum Mechanics angular momenta in Mathematica

I'm writing prototypes for solving the Liouville Equations with Mathematica and C++. Perhaps the question about this may not be suited for this forum in a strict way, but it suits the people here ...
1
vote
0answers
123 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 ...
7
votes
1answer
212 views

Exploiting parallelism within a single heterogeneous computing node

I'm looking for a library to exploit parallelism within a single heterogeneous computing node (possibly using Accelerators like Xeon Phi or nVidia's GPGPU's) in a C++ FV/DG code using hierarchical ...
1
vote
1answer
434 views

C+C++ library for inversion of a large scale matrix over cluster

I need to implement a matrix inversion of a very big matrix that currently is exceeding the memory limits of my machine (unfortunately I have little memory running on 32-bit machines). I would like to ...