C is a general purpose programming language. Originally intended for implementing system software, C and its close relatives are the principle languages used in most modern operating systems. Due to its thin layer of abstraction and low overhead, C allows efficient coding of algorithms and data ...

learn more… | top users | synonyms

1
vote
1answer
51 views

Profiling optimized C code using gprof

I have a simple C code with many function calls, which I profiled using gprof. ...
0
votes
0answers
2 views

Visual C++: C language programming error [migrated]

So I started practicing my C language programming through Visual C++ until I get MATLAB, anyway. As I was programming, I got this error and I was wondering what it meant. ...
1
vote
1answer
52 views

Kronecker products and basis contractions (ie. B.A.Transpose[B]) in C?

I have implemented a basis transformation in C of the following form kron[A,A]*B*Transpose[kron[A,A]] where A and ...
2
votes
1answer
76 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 ...
4
votes
1answer
86 views

What is wrong with this matrix multiplication?

I am attempting to write a matrix multiplication routine because I need to do some analysis in CUDA and I want to validate it with CPU code. I am trying to use ...
2
votes
2answers
142 views

BLAS, LAPACK or ATLAS for Matrix Multiplication in C

I am trying to find the most optimized way to perform Matrix Multiplication of very large sizes in C language and under Windows 7 or Ubuntu 14.04. And searching led me to BLAS, LAPACK and ATLAS. ...
0
votes
1answer
52 views

Water Properties IAPWS-IF97 implementation on C/C++

I'm Looking for an implementation of the IAPWS-IF97 water properties on C/C++. I'm aware of the library freesteam. However freesteam does not include all the properties I'm looking for. Particularly I ...
-2
votes
2answers
80 views

Ways to solve numerically differential equations in C [closed]

I have to solve numerically a differential equation in C. The equation is: How can I write some code to solve it? Are there some numerical methods (Runge-Kutta maybe?) to solve it? A colleague ...
1
vote
0answers
39 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
1answer
59 views

Find area of a polygon. In C and Obj C.

I've been given an assignment: Create a console application (using C and Obj C) that will calculate area of a random polygon. The application should process input data as a .txt file with a list of ...
1
vote
1answer
41 views

Is it valid MPI-3 to nest non-blocking collectives?

Is the following a standards-conformant MPI-3 C program? ...
2
votes
1answer
110 views

Efficient compressed row storage Gauss Seidel C/C++

I am trying to figure out why my sparse (CRS) Gauss Seidel solver is so slow. I tried to find an implementation of the Gauss Seidel method in sparse format online but could only find implementations ...
1
vote
4answers
436 views

Use of Java or Scala in HPC?

I was looking to brush up and/or pick up some languages for a hobby project on my free Amazon EC2, and I was going through the benchmark results for Java vs C (or Scala vs C)and Fortran vs C. It seems ...
1
vote
3answers
211 views

Searching solution for solving huge linear system in MATLAB or C

I am encountering a problem that my MATLAB code ran and an error occurs and shows that it is out of memory. My code is using finite element method to solve some complicated kind of integral equation ...
0
votes
0answers
56 views

Complex Numbers in C Resulting in Unstable Calculation

I'm trying to perform a calculation which involves the following C-function: ...
0
votes
0answers
284 views

Eigen-unsupported: Levenberg - Marquardt algorithm

I am using Eigen-unsupported: LevenbergMarquardt algorithm. I use this algorithm inside my model. I wrote the minimization code both in MATLAB (using fsolve) and C++ and both gave the similar results ...
-2
votes
1answer
100 views

Solving electron density function for Hydrogen and drawing in 3D

I recently stumbled upon interesting site that has interactive 3D representation of radial electron distribution (atomic orbital). here is the url: ...
7
votes
1answer
144 views

Performance of adding eight numbers sequentially vs. in a tree

The simplest way to add 8 numbers would be something like this, sum = one + two + three + four + five + six + seven + eight; This (in C) would add ...
0
votes
0answers
34 views

Double integrals and parameters in GSL

I'm trying to calculate a numerical integral in C. I have a function that depends on several variables, two of which I want to integrate over while leaving rest of them as parameters. I was going to ...
5
votes
2answers
796 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
128 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 ...
1
vote
1answer
51 views

How can DFT of a two dimensional array be found using program for one dimensional DFT in C?

I have the program four1.c from Numerical Recipes in C to calculate the Discrete Fourier Transform (DFT) of a one dimensional array. I want to calculate the DFT of ...
0
votes
1answer
69 views

Beginning Computer Programming [closed]

I was 7 years old when I learnt BASIC. Then I learnt C and Visual Basic till the age of 13. I stopped programming for 4 years continuously, and don't remember much about it now. I have lost the skill, ...
3
votes
2answers
345 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 / ...
3
votes
2answers
199 views

C - OpenMP, MPI, Serial Program

I'm part of a Computational Science course and come from a non-programming background, so please forgive me my ignorance. I'm working on a set of code in C to numerically solve the Navier Stokes ...
0
votes
1answer
204 views

C - OpenMP, MPI, Serial Program [duplicate]

I'm part of a Computational Science course and come from a non-programming background, so please forgive me my ignorance. I'm working on a set of code in C to numerically solve the Navier Stokes ...
0
votes
1answer
222 views

PyOpenGL/OpenGL Generating Cosmic NBodys

I am working on a Universe Simulator. I'm stuck on creating the dark matters webs of the universe that look like this: http://www.mpa-garching.mpg.de/galform/data_vis/sim3dnew-highres.png I am ...
3
votes
1answer
179 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$$ ...
1
vote
1answer
121 views

Appell function implementation in C++?

Is there a C++/C implementation of the Appell series? GSL and Boost do not seem to have this function.
0
votes
1answer
70 views

Calculation of isotropic-nematic phase transition

In this paper, the theory behind the isotropic-nematic phase transition is discussed. Furthermore, an algorithm is given to calculate some properties of this phase transition. I have written a ...
3
votes
5answers
1k views

Optimization of prime factorization in C

I am trying to teach myself some programming in C by doing the problems of project Euler. I am trying to find the largest prime factor of the number 600851475143 (Euler problem 3). I have written a ...
4
votes
1answer
1k views

Free open source C/C++ library to solve 2d Poisson equation using the finite difference method

I have been writing some code in C for particle-in-cell simulation. One of the steps of the PIC algorithm requires to solve (numerically) Poisson's equation $$ \Delta \varphi = - 4 \pi \rho. $$ ...
3
votes
2answers
1k views

Developing finite volume (FVM) code in C . General advice

I need to develop a FVM code in C (The multiscale FVM method for heterogeneous media). I know that: Only uniform rectangular grids will be considered (2d now, later 3d) Sparse systems will be large ...
7
votes
1answer
138 views

WELL pseudo-random number generations

I've used MT19937 in a test harness to generate uniformly (unsigned) 32-bit [0, $2^{32}$- 1] values, based on the original Authors' mt19937.c implementation, to ...
5
votes
3answers
222 views

A clean way to compute exp(-1/x^2) near x=0 in C?

I am looking for a clean way to compute preciseley, when $x$ is very close to zero: $$\exp(-1/x^2)$$ using C. What is the best way (speed, precision, etc.) ?
3
votes
0answers
115 views

The traveling salesman problem - Using Space Renormalization

Image attached is where I am at the moment. Blue dots=points/cities, Black x's represent central points in each box that contains at least one city, and pink dots represent the midpoint of these ...
5
votes
2answers
97 views

Odd accuracy barrier in C/PETSc regarding finite elements

I’m implementing a finite element code (translating from a working MATLAB version, so I have results to compare to) and for some odd reason, some of my computations are only accurate to around 6 ...
4
votes
1answer
243 views

PETSc input format for linear solvers

I’m going through some considerable effort to translate one of my codes from MATLAB. It’s a type of finite element code and I haven’t implemented the solver yet but comparing CPU times for simply ...
2
votes
1answer
164 views

Sparse linear solvers in C?

I'm working on translating a discontinuous Galerkin code from MATLAB to C and I'm at the final point where I need to solve a sparse system. I've taken a course in C before but I'm very rusty and ...
3
votes
0answers
108 views

N-body simulation for particles

I would like use N-body simulation for measure a torque on an object in a liquid (helium). It's a 2D study. On the site : http://www.browndeertechnology.com/docs/BDT_OpenCL_Tutorial_NBody-rev3.html I ...
3
votes
4answers
243 views

Finding a molecular dynamics visualization library for C

I asked this question over at stackoverflow, and got blasted for it. I am currently working with legacy MD code written in C that my university uses, and haven't moved to a more modern library like ...
9
votes
4answers
351 views

Compute $(e^x-1)/x$ near $x = 0$

The function $f \colon x \mapsto (e^x-1)/x$ has singularity near $x = 0$. That singularity can be lifted, though: for $x = 1$, one should have $f(x) = 1$, since $$ e^x = \sum_{k=0} \frac{x^k}{k!} $$ ...
2
votes
3answers
2k views

When is MPI_Wait necessary for non-blocking calls?

I hope this is not too off-topic here -- I've asked it on SO but I'm hoping I'll get better answers here! I'm a little bit confused about when I should call MPI_Wait (or other variants such as: ...
4
votes
1answer
360 views

Libraries for distributed-memory Cholesky factorization?

What libraries can compute dense Cholesky factorizations in distributed-memory environments (preferably using MPI). I'm using C/C++, and have access to a cluster of between 1 and 40 nodes, where each ...
9
votes
2answers
438 views

Testing if two 12x12 matrices have the same determinant

I am given a $12 \times 12$ matrix $Q$ that is symmetric, invertible, positive definite and dense. I need to test if $$\det(Q) = \det(12I-Q-J) \; \; (1)$$ where $J$ is the all ones matrix. I am ...
1
vote
2answers
427 views

What sparse solver supports diagonal storage format

I'm writing finite-difference method program using C. The stiffness matrix is symmetrical and band. For its storage I'd like to use Sparse Diagonal Storage format. Could someone tell please, what ...
6
votes
5answers
248 views

Evaluate the sum

I want to evaluate the sum $$\sum_{k=1}^\infty \left(\frac{i+1}{\sqrt{2}}\right)^k\cdot k^{-\alpha}$$ where $i=\sqrt{-1}$ and $\alpha\in[\frac{3}{4},1]$ with 8 digits accuracy. If I am willing to ...
3
votes
2answers
101 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?
9
votes
3answers
522 views

Recommendations for a lightweight/no-install C or C++ based dense linear algebra solver

Most of my programming is one-off research codes in C for my own use. I have never distributed any code to other than close collaborators. I have developed an algorithm that I am publishing in a ...
4
votes
2answers
506 views

Extracting a 2D matrix from a multidimensional array in C

In my c language program, I have to store multiple dense $m\times m$ matrices corresponding to gridpoints $x_i$ with $i=1,...,n$. I decided to create a three dimensional array $A\in R^{n\times ...