# Numerics

**URL:** https://discourse.julialang.org/c/domain/numerics/20.md?page=31

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 32

---

## [Reordering for memory contiguity/memory access](https://discourse.julialang.org/t/reordering-for-memory-contiguity-memory-access/43040)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [July 14, 2020, 3:54pm UTC](https://discourse.julialang.org/t/reordering-for-memory-contiguity-memory-access/43040 "2020-07-14T15:54:39Z")

</div>

I am simulating a “mass” that obeys a law of motion. The algorithm I use to discretize to a finite grid has the property that each cell is distributed to K others after being multiplied by something else. Formally, each x…

---

## [Nonuniform fast Fourier transforms](https://discourse.julialang.org/t/nonuniform-fast-fourier-transforms/4858)

<div class="topic-metadata">

**Author:** [@MikaelSlevinsky](https://discourse.julialang.org/u/MikaelSlevinsky)\
**Replies:** 10\
**Last updated:** [July 13, 2020, 11:10am UTC](https://discourse.julialang.org/t/nonuniform-fast-fourier-transforms/4858 "2020-07-13T11:10:04Z")

</div>

FastTransforms.jl v0.2.2 includes nonuniform fast Fourier transforms thanks to Alex Townsend: nufft1 assumes uniform samples and noninteger frequencies; nufft2 assumes nonuniform samples and integer frequencies; nuf…

---

## [Solving sparse matrix using backslash, got MethodError: no method matching lu!](https://discourse.julialang.org/t/solving-sparse-matrix-using-backslash-got-methoderror-no-method-matching-lu/42906)

<div class="topic-metadata">

**Author:** [@Liang\_Chen](https://discourse.julialang.org/u/Liang_Chen)\
**Replies:** 3\
**Last updated:** [July 11, 2020, 10:05pm UTC](https://discourse.julialang.org/t/solving-sparse-matrix-using-backslash-got-methoderror-no-method-matching-lu/42906 "2020-07-11T22:05:34Z")

</div>

I want to solve a system of equation Ax = b using A\\b where A and b are sparse matrix and vector. Also matrix A is symmetric positive definite. However I got an error says: “ERROR: LoadError: MethodError: no method mat…

---

## [Fast integration of log(2^(P(x)exp(-x^2/2)+1)](https://discourse.julialang.org/t/fast-integration-of-log-2-p-x-exp-x-2-2-1/42762)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 4\
**Last updated:** [July 9, 2020, 8:49am UTC](https://discourse.julialang.org/t/fast-integration-of-log-2-p-x-exp-x-2-2-1/42762 "2020-07-09T08:49:33Z")

</div>

Hello, I would like to compute \\int\_0^{x\_i}log(2^{P\_i(t)exp(-t^2/2)} + 1)dt for a large number of values x\_i where P\_i is a different polynomial (degree \<6) for each x\_i value. The naive approach is to use the functi…

---

## [Tricks for parallel computing in Julia](https://discourse.julialang.org/t/tricks-for-parallel-computing-in-julia/42638)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 11\
**Last updated:** [July 7, 2020, 11:12pm UTC](https://discourse.julialang.org/t/tricks-for-parallel-computing-in-julia/42638 "2020-07-07T23:12:41Z")

</div>

The graph above represents execution time per call of the function once in the program below as a function of the number of workers used on a 32 cpu/64 thread machine. The green line (left y axis) represents the progr…

---

## [Evaluation, gradient and Hessian of a scalar function for multiple values using ForwardDiff.jl](https://discourse.julialang.org/t/evaluation-gradient-and-hessian-of-a-scalar-function-for-multiple-values-using-forwarddiff-jl/42641)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 5\
**Last updated:** [July 7, 2020, 1:36am UTC](https://discourse.julialang.org/t/evaluation-gradient-and-hessian-of-a-scalar-function-for-multiple-values-using-forwarddiff-jl/42641 "2020-07-07T01:36:25Z")

</div>

Hello, I would like to evaluate a scalar-function f: R \\xrightarrow{} R as well as its derivative and hessian at around 200 values using ForwardDiff.jl To speed-up the computations, is it possible to precompute an obje…

---

## [Kronecker times vector with special structure](https://discourse.julialang.org/t/kronecker-times-vector-with-special-structure/42477)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 10\
**Last updated:** [July 5, 2020, 4:39pm UTC](https://discourse.julialang.org/t/kronecker-times-vector-with-special-structure/42477 "2020-07-05T16:39:11Z")

</div>

I would like to evaluate (I\_1 \\otimes a\_2^\\top \\otimes I\_3) \\cdot \\theta where I\_1 and I\_3 are identity matrices with size n \\times n and m \\times m, a\_2 is a vector of length k, \\theta is a vector of length mnk. …

---

## [Evaluation of product of Hermitian functions](https://discourse.julialang.org/t/evaluation-of-product-of-hermitian-functions/42316)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 1\
**Last updated:** [June 30, 2020, 8:03pm UTC](https://discourse.julialang.org/t/evaluation-of-product-of-hermitian-functions/42316 "2020-06-30T20:03:35Z")

</div>

Hello, I am working on expansion of a multivariate function f : R^k \\xrightarrow{} R onto a basis of product of univariates Hermite functions: f(x\_1, x\_2, \\ldots, x\_k) = \\sum\_{\\boldsymbol{\\alpha}} c\_{\\boldsymbol{\\alph…

---

## [PIC (particle-in-cell), space charge tracking simulation?](https://discourse.julialang.org/t/pic-particle-in-cell-space-charge-tracking-simulation/26077)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 32\
**Last updated:** [June 24, 2020, 2:29pm UTC](https://discourse.julialang.org/t/pic-particle-in-cell-space-charge-tracking-simulation/26077 "2020-06-24T14:29:44Z")

</div>

There’s a lot of demand in plasma/accelerator science to simulate space charge through so-called particle-in-cell model (which is somewhat like finite element analysis in structural dynamics etc) Many of them, for examp…

---

## [Error with ForwardDiff no method matching Float64](https://discourse.julialang.org/t/error-with-forwarddiff-no-method-matching-float64/41905)

<div class="topic-metadata">

**Author:** [@smickus](https://discourse.julialang.org/u/smickus)\
**Replies:** 4\
**Last updated:** [June 23, 2020, 8:07pm UTC](https://discourse.julialang.org/t/error-with-forwarddiff-no-method-matching-float64/41905 "2020-06-23T20:07:29Z")

</div>

I am trying to use forwardDiff to compute the gradient of a function in which I am solving an ODE, but I am getting an error that there is no method matching Float64. I have been stumped with this error for awile and wo…

---

## [Continuing bugs for SecondOrderODE problem solvers](https://discourse.julialang.org/t/continuing-bugs-for-secondorderode-problem-solvers/41559)

<div class="topic-metadata">

**Author:** [@CosmoProf](https://discourse.julialang.org/u/CosmoProf)\
**Replies:** 34\
**Last updated:** [June 21, 2020, 12:43am UTC](https://discourse.julialang.org/t/continuing-bugs-for-secondorderode-problem-solvers/41559 "2020-06-21T00:43:22Z")

</div>

Hi, working in DiffferentialEquations.jl, I find that a bunch of solvers don’t work with SecondOrderODE. This seems to be a bug at least a couple of years old, is there any way to use these solvers without reducing the p…

---

## [Investigating numerical change in function return value between v1.4 vs v1.5](https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332)

<div class="topic-metadata">

**Author:** [@jmert](https://discourse.julialang.org/u/jmert)\
**Replies:** 7\
**Last updated:** [June 20, 2020, 6:29pm UTC](https://discourse.julialang.org/t/investigating-numerical-change-in-function-return-value-between-v1-4-vs-v1-5/41332 "2020-06-20T18:29:33Z")

</div>

I’ve got a function which is exhibiting a change to the numerical return value when comparing Julia versions 1.2 through 1.4 versus the 1.5beta (and master). I think this is actually an LLVM “error” (or a misunderstandin…

---

## [Square root of the inverse of a matrix](https://discourse.julialang.org/t/square-root-of-the-inverse-of-a-matrix/41539)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 17\
**Last updated:** [June 19, 2020, 6:13pm UTC](https://discourse.julialang.org/t/square-root-of-the-inverse-of-a-matrix/41539 "2020-06-19T18:13:11Z")

</div>

Hello, I am working on square root factorization of the matrix of the form A = I + U'U which is typically positive semi-definite of dimension N \\sim 100. I need to solve a least square problem A^{-1}Y and compute the …

---

## [Best Solver for Bessel-like Differential Equations with Singularity; unexpected Interpolation Behavior](https://discourse.julialang.org/t/best-solver-for-bessel-like-differential-equations-with-singularity-unexpected-interpolation-behavior/41482)

<div class="topic-metadata">

**Author:** [@CosmoProf](https://discourse.julialang.org/u/CosmoProf)\
**Replies:** 6\
**Last updated:** [June 17, 2020, 2:27am UTC](https://discourse.julialang.org/t/best-solver-for-bessel-like-differential-equations-with-singularity-unexpected-interpolation-behavior/41482 "2020-06-17T02:27:20Z")

</div>

Hi, I’m starting a project solving equations (using the DifferentialEquations.jl package) that will be similar to Bessel equations: oscillatory in general, with a singularity in the function and its derivatives at t=0. (…

---

## [Handling unstable true solution issues with the Integrator Interface](https://discourse.julialang.org/t/handling-unstable-true-solution-issues-with-the-integrator-interface/41208)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 7\
**Last updated:** [June 15, 2020, 12:06pm UTC](https://discourse.julialang.org/t/handling-unstable-true-solution-issues-with-the-integrator-interface/41208 "2020-06-15T12:06:19Z")

</div>

Hi All, Working on a problem that has lead me to the Integrator Interface of DifferentialEquations.jl and have ran into something I can’t seem to work out. My case requires my to solve my ODEProblem on a timescale of d…

---

## [Heat / diffusion equation with co-ordinate dependent diffusion coefficient](https://discourse.julialang.org/t/heat-diffusion-equation-with-co-ordinate-dependent-diffusion-coefficient/41380)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 7\
**Last updated:** [June 14, 2020, 9:16pm UTC](https://discourse.julialang.org/t/heat-diffusion-equation-with-co-ordinate-dependent-diffusion-coefficient/41380 "2020-06-14T21:16:05Z")

</div>

I am starting with the example at DiffEqOperators . I am interested in the steady state only. Let us have Neumann border condition (physically, a constant source of e.g. heat) on the left, and Dirichlet BC on the right. …

---

## [Multidimentional integrals in julia: speed and automatic differentiation](https://discourse.julialang.org/t/multidimentional-integrals-in-julia-speed-and-automatic-differentiation/41375)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 9\
**Last updated:** [June 14, 2020, 8:16pm UTC](https://discourse.julialang.org/t/multidimentional-integrals-in-julia-speed-and-automatic-differentiation/41375 "2020-06-14T20:16:14Z")

</div>

I would like to differentiate through a two-dimensional integral. seems to be not possible for c++ wrappers (e.g. with the great Cuba.jl) Julia native integrators are way slower (HCubature.jl, NIntegration.jl) nested Q…

---

## [Eigensolver for interior eigenvalues of sparse (banded) Hermitian matrices?](https://discourse.julialang.org/t/eigensolver-for-interior-eigenvalues-of-sparse-banded-hermitian-matrices/41360)

<div class="topic-metadata">

**Author:** [@Grayscale](https://discourse.julialang.org/u/Grayscale)\
**Replies:** 3\
**Last updated:** [June 14, 2020, 8:54am UTC](https://discourse.julialang.org/t/eigensolver-for-interior-eigenvalues-of-sparse-banded-hermitian-matrices/41360 "2020-06-14T08:54:50Z")

</div>

I am trying to compute many interior eigenvalues of large sparse banded complex Hermitian matrices. By the way, the (absolute value of the) matrix looks like this for the ~1500 by ~1500 case: Here, ~ 98.8% of the el…

---

## [In place Cholesky solve with zero allocation (simplical vs. supernodal)](https://discourse.julialang.org/t/in-place-cholesky-solve-with-zero-allocation-simplical-vs-supernodal/41115)

<div class="topic-metadata">

**Author:** [@samuelpowell](https://discourse.julialang.org/u/samuelpowell)\
**Replies:** 7\
**Last updated:** [June 11, 2020, 7:16pm UTC](https://discourse.julialang.org/t/in-place-cholesky-solve-with-zero-allocation-simplical-vs-supernodal/41115 "2020-06-11T19:16:43Z")

</div>

I am unable to avoid allocation when performing an in-place solve against a simplical Cholesky factorisation, but have no problems with a supernodal factorisation. Note that: the allocation is small, but since I am pe…

---

## [Relative tolerances for near-zero integrals](https://discourse.julialang.org/t/relative-tolerances-for-near-zero-integrals/41141)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 8\
**Last updated:** [June 11, 2020, 1:22am UTC](https://discourse.julialang.org/t/relative-tolerances-for-near-zero-integrals/41141 "2020-06-11T01:22:25Z")

</div>

I have a question somewhat unrelated to the previous discussion. What is a good way to specify relative tolerance in the case where the exact value of the integral is close to zero? I’ve looked at QuadGK internals and …

---

## [Numerical integration of cauchy principal value](https://discourse.julialang.org/t/numerical-integration-of-cauchy-principal-value/36059)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 6\
**Last updated:** [March 17, 2020, 4:46pm UTC](https://discourse.julialang.org/t/numerical-integration-of-cauchy-principal-value/36059 "2020-03-17T16:46:00Z")

</div>

I have an integral of the form: I = \\int\\limits\_{-1}^{1} f(x)\*w(x) dx, The function f(x) has a singularity of the form 1/(x-a) inside the interval \[-1, 1\], so that the integral I exists only as a cauchy principal value…

---

## [ITensors.jl: Custom SiteTypes](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717)

<div class="topic-metadata">

**Author:** [@amitjamadagni](https://discourse.julialang.org/u/amitjamadagni)\
**Replies:** 2\
**Last updated:** [June 8, 2020, 6:14pm UTC](https://discourse.julialang.org/t/itensors-jl-custom-sitetypes/39717 "2020-06-08T18:14:14Z")

</div>

Hello, I have been tweaking around with ITensors.jl package (GitHub - ITensor/ITensors.jl: A Julia library for efficient tensor computations and tensor network calculations) to create custom SitesTypes. I have tried the…

---

## [Unexpected behavior DifferentialEquations (parabolic ODE) -- large # of steps](https://discourse.julialang.org/t/unexpected-behavior-differentialequations-parabolic-ode-large-of-steps/40886)

<div class="topic-metadata">

**Author:** [@egcjm](https://discourse.julialang.org/u/egcjm)\
**Replies:** 3\
**Last updated:** [June 6, 2020, 10:32pm UTC](https://discourse.julialang.org/t/unexpected-behavior-differentialequations-parabolic-ode-large-of-steps/40886 "2020-06-06T22:32:31Z")

</div>

\*\* This question is as much about numerics as about use of DifferentialEquations.jl \*\* \*\* This is a toy problem with an analytical solution – I’d like to understand the behavior of DifferentialEquations.jl, not interest…

---

## [The test isequal(+0.0,-0.0) returns FALSE](https://discourse.julialang.org/t/the-test-isequal-0-0-0-0-returns-false/38404)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 16\
**Last updated:** [June 2, 2020, 7:31am UTC](https://discourse.julialang.org/t/the-test-isequal-0-0-0-0-returns-false/38404 "2020-06-02T07:31:09Z")

</div>

so as isequal(+0.0im,-0.0im). I discovered this during a painful debug process. I really want to understand the philosophy behind this designing, and I wish to get some advice on numerical stability. Thank you @everyon…

---

## [Huge thanks to core devs for having such good implimentations of random Linear Algebra functions!hr](https://discourse.julialang.org/t/huge-thanks-to-core-devs-for-having-such-good-implimentations-of-random-linear-algebra-functions-hr/40007)

<div class="topic-metadata">

**Author:** [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Replies:** 0\
**Last updated:** [May 23, 2020, 2:24am UTC](https://discourse.julialang.org/t/huge-thanks-to-core-devs-for-having-such-good-implimentations-of-random-linear-algebra-functions-hr/40007 "2020-05-23T02:24:26Z")

</div>

As an undergrad student studying math and computer science, I have learned a lot of linear algebra. That said, I am quite far from being an expert, and have needed state of the art solutions for some fairly specific prob…

---

## [Removing redundant inequalities from a linear system of linear inequalities](https://discourse.julialang.org/t/removing-redundant-inequalities-from-a-linear-system-of-linear-inequalities/39742)

<div class="topic-metadata">

**Author:** [@KiriaKasis](https://discourse.julialang.org/u/KiriaKasis)\
**Replies:** 0\
**Last updated:** [May 19, 2020, 6:49am UTC](https://discourse.julialang.org/t/removing-redundant-inequalities-from-a-linear-system-of-linear-inequalities/39742 "2020-05-19T06:49:02Z")

</div>

I have a satisfiable system of inequalities Ax ≤ b or equivalently a\_i · x ≤ b\_i for 1 ≤ i ≤ n. I would like to find all indexes i such that the i\\text{-th} inequality is redundant. For example in \\begin{aligned} x + …

---

## [Timing Clebsch-Gordan-coefficients calls in Julia (beating c++ again)](https://discourse.julialang.org/t/timing-clebsch-gordan-coefficients-calls-in-julia-beating-c-again/32736)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 7\
**Last updated:** [May 12, 2020, 8:45am UTC](https://discourse.julialang.org/t/timing-clebsch-gordan-coefficients-calls-in-julia-beating-c-again/32736 "2020-05-12T08:45:34Z")

</div>

I have compared 4 different implementations of the Clebsch-Gordan coefficients freshly coded in my ThreeBodyDecay.jl package from GSL.jl call (c++ implementation) from SymPy.jl (for the sake of completeness) julia pac…

---

## [Sparse matrix and zero pivots](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332)

<div class="topic-metadata">

**Author:** [@Mirsad\_Cosovic](https://discourse.julialang.org/u/Mirsad_Cosovic)\
**Replies:** 2\
**Last updated:** [May 12, 2020, 8:24am UTC](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332 "2020-05-12T08:24:20Z")

</div>

I have a large sparse matrix and I need to find a position of zero pivots, so my matrix is singular. Standard QR factorization for dense matrices without permutations gives the result that I need, the pivots are on the m…

---

## [How to query elements in a matrix diagonal to a given point](https://discourse.julialang.org/t/how-to-query-elements-in-a-matrix-diagonal-to-a-given-point/39253)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 8\
**Last updated:** [May 11, 2020, 5:13pm UTC](https://discourse.julialang.org/t/how-to-query-elements-in-a-matrix-diagonal-to-a-given-point/39253 "2020-05-11T17:13:56Z")

</div>

I’m wondering if there’s an efficient way to return all of the elements in a matrix that are diagonal to some starting point. For example, given the following matrix: julia\> A = \[1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 1…

---

## [Five argument mul! in FFTW](https://discourse.julialang.org/t/five-argument-mul-in-fftw/35443)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 3\
**Last updated:** [May 10, 2020, 10:01am UTC](https://discourse.julialang.org/t/five-argument-mul-in-fftw/35443 "2020-05-10T10:01:58Z")

</div>

I couldn’t find a 5 argument method of mul! in FFTW.jl for FFTW.rFFTWPlan and its siblings. Would it be reasonable to add such methods? In particular, I would like to be able to do something like julia\> using LinearAlge…

[Previous page](https://discourse.julialang.org/c/domain/numerics/20.md?page=30)

[Next page](https://discourse.julialang.org/c/domain/numerics/20.md?page=32)
