# Questions tagged [c]

For questions related to computational software and libraries written in the C programming language

137 questions
Filter by
Sorted by
Tagged with
60 views

### Absence of discontinuity in Specific Heat in liquid-gas transition (Based on the Ising Model)

I'm trying to do a model for the transition liquid-gas based on the Ising model and the metropolis algorithm, instead of using values of spins, I'm saying that a cell is occupied by a particle or not. ...
246 views

### How can I convert a C program into a CUDA program?

Suppose I already have a C program that solves a specific computational problem. I want to convert that into a CUDA program. What steps should I follow to do that? For instance, can I think as follows?...
• 109
158 views

### Assign and print the results of CHOLMOD package

I am trying to solve a simple working example, a linear system $Ax=b$, where $A$ is sparse SPD and $b$ is dense, using CHOLMOD. ...
1 vote
237 views

### What language are best for creating data compression algorithms except for C/C++?

I've been trying to implement data compression algorithms in python, but I just can't get mine as fast as the other algorithms other have made. So I've decided on using C since I've asked people about ...
• 153
107 views

...
• 209
284 views

### float in C: Size of the exponent

This question is very related to the question Number of decimal of float and double in C. In the second table we may see that the exponent of the float are from -38 to +38. But the IEEE754 standard ...
• 515
128 views

### Number of decimal of float and double in C

I'm reading the following table (from https://www.tutorialspoint.com/cprogramming/c_data_types.htm ) Why the precision of the float is 6 decimal places, but I see that the float are in the interval [...
• 515
1 vote
71 views

### Integration in 3D

So the question was to use a nested loop to solve a 3D integral with the function conditions (written below in the code) to find $$\int dxdydz$$ and the x and y coordinate of the centre of mass of ...
• 13
1 vote
77 views

### Poisson equation fast solver on large grids

Below is kind of a broad question. Was given Poisson equation with BC, on meshgrid of NxM. Rewrote as system of N*M linear equations, Converted to sparse format (CSR/CRS/Yale), solved using Conj Grad ...
• 384
1 vote
82 views

### Memory issues with iterative solvers

Was trying to implement a poisson 2d solver using Conjugate Gradient Method, so from 10x10 grid the matrix becomes 100x100 (since we have 100 nodes to find the values at), 100x100 grid goes to ...
• 384
34 views

### Identical .so shared libraries (with no symbols) are generated when compiling different C source files [closed]

At the institution I work for we have a User Exit made in Pro*C (SQL embedded in C language). We are having some troubles because identical shared libraries are generated when compiling different ...
267 views

• 39
357 views

### OpenMP: parallelizing calculation of pair interaction forces

I recently started to learn OpenMP. Albeit I have developed some intuition I still have some doubts on how to proceed under certain circumstances that are very useful for computational physicists. My ...
• 68
478 views

326 views

### Finding a shortest path in a graph

If each edge of a graph $G$ is unweighted or has equal weights, then the shortest path between two nodes in that graph is the path that contains the fewest number of edges. Such a path can be obtained ...
• 1
261 views

### C standard for computational science

Which C standard should be used for computational science code ? Should we keep compatibility with C89/90/ANSI or jump to C99 or C11 ? Context: Code will use third-party : BLAS, LAPACK, MKL, ...
1 vote
252 views

### Wrong result of 'ddot' from BLAS

I am having trouble with a C/C++ program that uses the BLAS routine ddot. I am running Linux and so far LAPACK routines worked without any problems. I get a wrong ...
2k views

### How good are current implementations of rand() in C?

There is a lot of literature that indicates using rand() for simulations might be harmful. A couple of them are as follows: https://www.sciencedirect.com/science/...
• 61
1 vote
210 views

### MPI data broadcast or not in C

I have two slightly different but getting the same results MPI code. The first one is from an open-source package having several data exchange steps in between: ...
1 vote
147 views

### Problem with 'dsysv' from LAPACK

I am having trouble with a C program that uses the function dsysv from LAPACK. Everything compiles and works without any errors, my only problem is, that the ...
3k views

### Efficient eigen-decomposition of covariance matrix

I am looking for an C/C++/Python algorithm implementation that calculates eigenvalues and eigenvectors of a symmetric, positive semidefinite covariance matrix. A general-purpose eigen-decomposition ...
• 191
245 views

### Looking for a converter of AMPL/GAMS models into C code

I've done an extensive web search, but could not find an option. Conversion between model formats is available, but conversion of objective function and constraint equations into C code seems absent. ...
• 191
471 views

### I've developed a derivative-free optimization method, looking for comments

Here is the URL: https://github.com/avaneev/biteopt I've tested it on numerous global optimization benchmarking functions (included), and on real-world hyperparameter optimization problems I have. ...
• 191
86 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 ...
318 views

### Use of multidimensional FFTW and normalisation factor

I am using the FFTW MPI in C. I have a simple question. Quoting from fftw.org The multi-dimensional transforms of FFTW, in general, compute simply the separable product of the given 1d ...
• 33
505 views

### Potential gain - Matlab vs C/C++ - assembly and eigenvalues

I have a Matlab code computing the solution to an eigenvalue PDE. It consists of two parts: assembly of the stiffness/rigidity matrices and solving a generalized eigenvalue problem. I mention that the ...
• 985
462 views

### High precision Discrete Fourier Transform in c

I'm trying to do a high precision discrete fourier transform on a signal. To examine the precision, I use a gaussian function as the signal, because the fourier transform is also a gaussian function. ...
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 ...
169 views

### Using GSL for basic operations

I am learning C/C++ for Scientific Computing and I have a question regarding the usage of scientific libraries for basic operations. Suppose I have to write a small program in C for a bioinformatics ...
• 404
1 vote
171 views

### How to deal with big numbers in intermediate calculations?

I have a rather long expression (https://pastebin.com/jUsxdCCs) that is an analytical solution of a set of differential equations generated symbolically from Maple. I need to solve a set of equations ...
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 ...
306 views

### minimalistic library for classical molecular mechanics force-field in C/C++/Python

I would like some classical molecular mechanics forcefield library or super-simple program which does not have any external dependences, so that I can plug it into my software without worry of "...