# Questions tagged [efficiency]

The tag has no usage guidance.

59 questions
Filter by
Sorted by
Tagged with
73 views

### Incomplete Cholesky preconditioner for CG efficiency

I am currently solving the harmonic equation using a P1 FEM discretisation. The resulting matrix $A$ is SPD and fairly sparse so I use a preconditioned conjugate gradients (CG) solver to find a ...
69 views

### How asymmetric encryption is done very fast [closed]

In any asymmetric encryption specifications, there is a step where we need to calculate data ^ public_key mod e to get ...
178 views

### Solving stiff ODEs: Dealing with Jacobian terms which take too long to compute with finite differences

I have a system of PDEs describing atmospheric chemistry and transport. I use finite-differences to make my system of PDEs into a system of ~10,000 ODEs. I then integrate the ODEs forward in time with ...
117 views

### How can I extract the banded or block diagonal part of a sparse matrix in MATLAB?

Given a large sparse (square) matrix in MATLAB, how can I extract the banded or the block-diagonal parts (of fixed size) of it efficiently? These are useful operations when prototyping and testing ...
152 views

### Methods to improve the efficiency and the memory requirement of LU factorization for complex symmetric system matrix

I want to solve a linear set of equations (Ax=b) using LU decomposition. My "A" matrix is a complex matrix which is ...
44 views

### Effecient method for iterating over sparse dataset

Apologies if this isn't the appropriate forum for this question. I have a set of elements that I need to iterate over as part of a modeling workflow. The elements exists over a set of dimensions (i, ...
65 views

### How can I optimize that loop?

I need to populate a matrix $A_{kl}$, where $$k = (m-1)J+n$$ $$l = (p-1)J+q$$ And $$m,p = 1, 2, ..., I$$ $$n,q = 1, 2, ..., J$$ Its components are (mnpq). For ...
394 views

### Fastest way to calculate the $2$-norm (or an upper bound for the $2$-norm) of the inverse of a matrix $A\in \mathbb{C}^{N\times N}$

I have a matrix $A\in \mathbb{C}^{N\times N}$ and I need to calculate $||A^{-1}||_{2}$ efficiently. Can it be done without having to evaluate the inverse explicitly? In general, I am looking for ...
81 views

### Reducing run time of a numerical calculation using a mex file in Matlab

I wrote a Matlab code that involves doing a numeric calculation (relaxation), but it is quite slow. I learned of the possibility of using a mex file to run a C code and integrate it into Matlab, so I ...
2k views

### What is the most efficient way to write 'for' loops in Matlab?

I have read that if, for example, I have a double for loop that runs over the indexes of a matrix, then putting the column running index in the outer loop is more ...
88 views

### How to efficiently invert $K \otimes M+I_T\otimes \Sigma$?

I'm looking for a way to efficiently invert $$K \otimes M+I_T\otimes \Sigma$$ where the inverses for $M,K$ exist. $I_T$ is the identity matrix of dimension $T$, and $\Sigma$ is a diagonal matrix, with ...
125 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, ...
160 views

### Why is the method of im2col with GEMM is more efficient than the method of direction implementation with SIMD in CNN

The convolutional layers are most computationally intense parts of Convolutional neural networks (CNNs).Currently the common approach to impement convolutional layers is to expand the image into a ...
354 views

### Accurate and efficient computation of the inverse Langevin function

The Langevin function $\mathcal{L}(x) = \mathrm{coth}(x) - \frac{1}{x}$ occurs in computations related to elastomers and paramagnetic materials. It is easily computed accurately and with high ...
61 views

68 views

### Calculate proportions of exponentially weighted factors avoiding underflow problem

I am trying to implement in Python this ratio: $\frac{w_t(i)}{\sum w_t(j)}$ where $w_t(i) = w_{t-1}(i)\cdot\exp{(-x_{t}(i))}$, i.e. the weights are exponentially decreasing without running into ...
584 views

### Power series regression linear fit in VBA excel

I wrote a program that calculates the best fit in VBA excel for the following model $$y_k=c_1x_k+c_0+c_{-1}(x_k)^{-1}$$ solving for the best fit parameters $c_1$, $c_0$, and $c_{-1}$. However I ...
180 views

### Performance based on the Roofline model

To somewhat follow up on the question asked here, I have been told that the Roofline model is one way of assessing the performance of any scientific code. Basically I compute the Arithmetic Intensity (...
325 views

### Comparing various implementations/software packages for large-scale finite element simulations

I currently use FEniCS and Deal.II to solve various FEM problems. I am also writing my own implementation of these problems by directly implementing the data structures, routines, and solvers within ...
712 views

### Efficient Implementation of the Log Sum Exp Log trick for Preventing Underflow erros

So I'm constructing a Gibbs sampler for a moderately sized graphical model, and I started encountering underflow errors (the computed relative frequencies were all very small). To get around this, I'...
188 views

### most efficient way to calculate eigen states of a 2D or 3D potential (Matlab)

I know of several ways to calculated the eigen states of 1D potentials (i.e. DVR, Crank–Nicolson, etc). However I wonder what is the most efficient way to do the same for a N-Dimensional potential? ...
934 views

### Determining efficiency in MFLOPS/s of a parallel program

I am running some scientific (parallel) code and would like to obtain some performance profiling measurements. I want to obtain the "efficiency" of the code in terms of flops/s over theoretical (peak) ...
75 views

### Help on writing sofware: general guidelines, in particular separation of computation and visualization

Although I already did some work in the intersection of theory and simulation I'm still very new to this field and I need some guidance. If anybody can give some recommendations for introductory ...
117 views

### Comparison of the time efficiency of an optimization problem formulated as a Network Flow model and Mixed Integer Programming

In combinatorial optimization, there are many problems that can be formulated as either Network Flow model or Mixed Integer Programming (MIP), e.g. supply chains, transportation, and graph-base ...
842 views

### Is there a complexity between $O(n)$ and $O(n \log n)$ [closed]

Is there a complexity degree that is bigger than $O(n)$ and smaller than $O(n \log n)$?
71 views

### What's the most efficient way to calculate the Wiger quasiprobability distribution?

I want to calculate the Wigner quasiprobability distribution function of a particular wavefunction. The definition suggests a few straightforward ways of calculating it, but I was wondering if there's ...
894 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, ...
73 views

### What is the fomula of polynomial time of solving positive definite symmetric linear system

For a positive definite symmetric linear system, Cholesky decomposition based method should be the best solver which has a rough n^3/3 flops requirement. What is ...