# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=676

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

**Page:** 677

---

## [JuMP.set\_objective\_coefficient performance](https://discourse.julialang.org/t/jump-set-objective-coefficient-performance/50283)

<div class="topic-metadata">

**Author:** [@omicron](https://discourse.julialang.org/u/omicron)\
**Replies:** 3\
**Last updated:** [November 17, 2020, 1:27pm UTC](https://discourse.julialang.org/t/jump-set-objective-coefficient-performance/50283 "2020-11-17T13:27:38Z")

</div>

Hi, I’m using JuMP to build LP-problems and later I want to update the objective coefficients with the function set\_objective\_coefficient instead of building the whole LP again. Below are the functions I defined and the …

---

## [How to solve error while generating random number inside kernel?](https://discourse.julialang.org/t/how-to-solve-error-while-generating-random-number-inside-kernel/50289)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 4\
**Last updated:** [November 17, 2020, 1:25pm UTC](https://discourse.julialang.org/t/how-to-solve-error-while-generating-random-number-inside-kernel/50289 "2020-11-17T13:25:04Z")

</div>

Hi, I am a newbie to CUDA and I am trying to generate random number inside a gpu kernel using the following commands, using CUDA using Random function kernel(cu\_status) idx = threadIdx().x unif = CUDA.rand(1) …

---

## [Is their any clear documentation that outlines what == and === does?](https://discourse.julialang.org/t/is-their-any-clear-documentation-that-outlines-what-and-does/50232)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 7\
**Last updated:** [November 17, 2020, 1:18pm UTC](https://discourse.julialang.org/t/is-their-any-clear-documentation-that-outlines-what-and-does/50232 "2020-11-17T13:18:29Z")

</div>

I’ve searched the documentation but was unable to find it. I found this answer on SO, however does any documentation exist that explains it?

---

## [Help on converting a plot animated](https://discourse.julialang.org/t/help-on-converting-a-plot-animated/50017)

<div class="topic-metadata">

**Author:** [@Amirrezz94](https://discourse.julialang.org/u/Amirrezz94)\
**Replies:** 2\
**Last updated:** [November 17, 2020, 1:01pm UTC](https://discourse.julialang.org/t/help-on-converting-a-plot-animated/50017 "2020-11-17T13:01:03Z")

</div>

Hi, I have a set of data as results of running an MPC on a plant. I Can plot them with different backends but all of them are kind of static and I want to have the plot somehow animated in a way that all the values send…

---

## [Boundary value is not what I defined](https://discourse.julialang.org/t/boundary-value-is-not-what-i-defined/50290)

<div class="topic-metadata">

**Author:** [@Fred\_He](https://discourse.julialang.org/u/Fred_He)\
**Replies:** 0\
**Last updated:** [November 17, 2020, 11:12am UTC](https://discourse.julialang.org/t/boundary-value-is-not-what-i-defined/50290 "2020-11-17T11:12:49Z")

</div>

Hello all, I started using DifferentialEquations package to solve a transit convection-diffusion equation with reaction, but the result looks strange. Firstly, I define a du/dt = -usg du/dx + Deg d^2u/dx the boundary …

---

## [Closures and Let Blocks](https://discourse.julialang.org/t/closures-and-let-blocks/50197)

<div class="topic-metadata">

**Author:** [@nucklass](https://discourse.julialang.org/u/nucklass)\
**Replies:** 4\
**Last updated:** [November 17, 2020, 6:48am UTC](https://discourse.julialang.org/t/closures-and-let-blocks/50197 "2020-11-17T06:48:07Z")

</div>

Anyone have any basic examples of when to use/what the effects are of having a let block along with a closure? I’ve been looking to learn more about functional programming in Julia and reading through the manual, but I …

---

## [How to make a command with brackets in it](https://discourse.julialang.org/t/how-to-make-a-command-with-brackets-in-it/50268)

<div class="topic-metadata">

**Author:** [@scone](https://discourse.julialang.org/u/scone)\
**Replies:** 2\
**Last updated:** [November 17, 2020, 1:38am UTC](https://discourse.julialang.org/t/how-to-make-a-command-with-brackets-in-it/50268 "2020-11-17T01:38:42Z")

</div>

Hi everyone, this is very simple and frutrating. I just want to make this into a command that I can run: for x = 4:2:10 y = \[4 5.5 7\] run( \`surfaceTransformPoints -translate '( $x $y 0 )' file.stl file\_temp.st…

---

## [Readstring encoding](https://discourse.julialang.org/t/readstring-encoding/4245)

<div class="topic-metadata">

**Author:** [@merl-dev](https://discourse.julialang.org/u/merl-dev)\
**Replies:** 8\
**Last updated:** [November 16, 2020, 10:55pm UTC](https://discourse.julialang.org/t/readstring-encoding/4245 "2020-11-16T22:55:17Z")

</div>

Just got a project with quite a few iso8859-1 encoded files. Is there a concise way to readstring a given file in Julia that is not utf-8? UPDATED: forgot about StringEncodings.jl

---

## [Order of arguments in Differential Equations functions](https://discourse.julialang.org/t/order-of-arguments-in-differential-equations-functions/28096)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 21\
**Last updated:** [November 16, 2020, 10:45pm UTC](https://discourse.julialang.org/t/order-of-arguments-in-differential-equations-functions/28096 "2020-11-16T22:45:48Z")

</div>

I am going through the documentation of DifferentialEquation and found this in the tutorial. The function is defined as parameterized\_lorenz(du,u,p,t) but when the arguments are supplied in a different order as prob = …

---

## [Improve performance of vector-matrix multiplication](https://discourse.julialang.org/t/improve-performance-of-vector-matrix-multiplication/50251)

<div class="topic-metadata">

**Author:** [@uwechsler](https://discourse.julialang.org/u/uwechsler)\
**Replies:** 2\
**Last updated:** [November 16, 2020, 10:16pm UTC](https://discourse.julialang.org/t/improve-performance-of-vector-matrix-multiplication/50251 "2020-11-16T22:16:19Z")

</div>

In a larger project, I have to compute a (row)vector-matrix multiplication. I guess that in mathematical terms, I would write it as c = x\\cdot M^T where x\\in \\mathbb{R}^{1 \\times n}, M^T\\in \\mathbb{R}^{n \\times m} and c…

---

## [Autocorrelation of a vector](https://discourse.julialang.org/t/autocorrelation-of-a-vector/50249)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [November 16, 2020, 9:23pm UTC](https://discourse.julialang.org/t/autocorrelation-of-a-vector/50249 "2020-11-16T21:23:21Z")

</div>

https://juliastats.org/StatsBase.jl/v0.16/signalcorr.html#StatsBase.autocor If x is a vector, return a vector of the same length as x. julia\> length(autocor(randn(2000))) 34 Why isn’t the result length 2000?

---

## [Error doing Implicit Derivatives in ModelToolkit I think it's trying to divide by 0](https://discourse.julialang.org/t/error-doing-implicit-derivatives-in-modeltoolkit-i-think-its-trying-to-divide-by-0/50240)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 2\
**Last updated:** [November 16, 2020, 7:22pm UTC](https://discourse.julialang.org/t/error-doing-implicit-derivatives-in-modeltoolkit-i-think-its-trying-to-divide-by-0/50240 "2020-11-16T19:22:40Z")

</div>

when I try to run let ex = Differential(x)(f(x, y)) func\_ex = build\_function(expand\_derivatives(ex), x, y) @eval ∂xf(x, y) = ($func\_ex)(x,y) end I get an error ERROR: type Int64 has no fi…

---

## [Overwrite Cholesky factorization](https://discourse.julialang.org/t/overwrite-cholesky-factorization/50210)

<div class="topic-metadata">

**Author:** [@ahwillia](https://discourse.julialang.org/u/ahwillia)\
**Replies:** 3\
**Last updated:** [November 16, 2020, 7:19pm UTC](https://discourse.julialang.org/t/overwrite-cholesky-factorization/50210 "2020-11-16T19:19:25Z")

</div>

I am trying to figure out the best way to overwrite/update a Cholesky factorization. In short, I have a symmetric matrix K which is periodically updated with new data. Every time I update K I want to recompute its Choles…

---

## [Endianness doesn't seem to be conserved in FORTRAN shared libraries?](https://discourse.julialang.org/t/endianness-doesnt-seem-to-be-conserved-in-fortran-shared-libraries/50174)

<div class="topic-metadata">

**Author:** [@ctessum](https://discourse.julialang.org/u/ctessum)\
**Replies:** 9\
**Last updated:** [November 16, 2020, 4:04pm UTC](https://discourse.julialang.org/t/endianness-doesnt-seem-to-be-conserved-in-fortran-shared-libraries/50174 "2020-11-16T16:04:13Z")

</div>

Hello! I have a question regarding calling a FORTRAN shared library that needs to read a binary file that is big-endian. This is the file in question: https://github.com/wrf-model/WRF/blob/master/run/RRTMG\_LW\_DATA. I …

---

## [Function that's \`not defined\` is defined](https://discourse.julialang.org/t/function-thats-not-defined-is-defined/50212)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 3\
**Last updated:** [November 16, 2020, 2:36pm UTC](https://discourse.julialang.org/t/function-thats-not-defined-is-defined/50212 "2020-11-16T14:36:33Z")

</div>

The body of code is structured as function my\_fcn(...) ... if ... ... θ\_sed(r) = ... return θ\_sed, ... else ... t\_sed(r) = ... @show t\_sed(50.0) @show 2atan(t\_sed(50.0)) θ\_sed(r) = …

---

## [DataInterpolations -- add information after interpolation function has been created?](https://discourse.julialang.org/t/datainterpolations-add-information-after-interpolation-function-has-been-created/50226)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 1\
**Last updated:** [November 16, 2020, 2:32pm UTC](https://discourse.julialang.org/t/datainterpolations-add-information-after-interpolation-function-has-been-created/50226 "2020-11-16T14:32:56Z")

</div>

With package DataInterpolations – is it possible to add data after I have created an interpolation function? Example: u = \[1,2,3,4,5\] t = \[0,0.5,1,2,4\] f = ConstantInterpolation(u,t) Suppose I pass function f to some f…

---

## [Acceleration of a function](https://discourse.julialang.org/t/acceleration-of-a-function/50181)

<div class="topic-metadata">

**Author:** [@Jonas](https://discourse.julialang.org/u/Jonas)\
**Replies:** 16\
**Last updated:** [November 16, 2020, 2:09pm UTC](https://discourse.julialang.org/t/acceleration-of-a-function/50181 "2020-11-16T14:09:49Z")

</div>

Hello everyone, I am currently transforming some Matlab code into Julia. Everything works fine, but I recognized a big difference in runtime. I don’t have much experience in that regard, so I started reading the guideli…

---

## [Unreasonable GPU memory usage with PyCall](https://discourse.julialang.org/t/unreasonable-gpu-memory-usage-with-pycall/13700)

<div class="topic-metadata">

**Author:** [@Xiucheng\_Li](https://discourse.julialang.org/u/Xiucheng_Li)\
**Replies:** 3\
**Last updated:** [November 16, 2020, 12:12pm UTC](https://discourse.julialang.org/t/unreasonable-gpu-memory-usage-with-pycall/13700 "2020-11-16T12:12:54Z")

</div>

The GPU memory usage grows with the iteration when calling PyTorch with PyCall, I have opened an issue at github. It seems that PyTorch is unaware of the release of the local variable and I am wondering whether this is r…

---

## [Array of arrays indexing problem](https://discourse.julialang.org/t/array-of-arrays-indexing-problem/50145)

<div class="topic-metadata">

**Author:** [@amael](https://discourse.julialang.org/u/amael)\
**Replies:** 5\
**Last updated:** [November 16, 2020, 12:11pm UTC](https://discourse.julialang.org/t/array-of-arrays-indexing-problem/50145 "2020-11-16T12:11:12Z")

</div>

Hello, If i define an array of arrays like this: a = \[ zeros(10) for i in 1:3 \] I get an array of 3 elements that are arrays of 10 elements each. Then If I call a\[2\]\[:\] I get an array of length 10 which is normal an…

---

## [Error: Julia could not be started](https://discourse.julialang.org/t/error-julia-could-not-be-started/50219)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 7\
**Last updated:** [November 16, 2020, 10:53am UTC](https://discourse.julialang.org/t/error-julia-could-not-be-started/50219 "2020-11-16T10:53:33Z")

</div>

I recently updated my mac and I am getting this error since then. I was using using Atom as the editor without any issue before the update. I tried the followings but none worked so far: Uninstall/install Julia client…

---

## [Speed up jump diffusion solution for estimation?](https://discourse.julialang.org/t/speed-up-jump-diffusion-solution-for-estimation/43174)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 13\
**Last updated:** [November 16, 2020, 11:02am UTC](https://discourse.julialang.org/t/speed-up-jump-diffusion-solution-for-estimation/43174 "2020-11-16T11:02:13Z")

</div>

I am interested in estimating the parameters of a jump diffusion using simulation-based methods, and filtering statistics through a neural net. The basic idea is working quite well. Now, I need to make the simulations as…

---

## [Is there a command for forcing a fresh precompilation of a module?](https://discourse.julialang.org/t/is-there-a-command-for-forcing-a-fresh-precompilation-of-a-module/49730)

<div class="topic-metadata">

**Author:** [@wg030](https://discourse.julialang.org/u/wg030)\
**Replies:** 5\
**Last updated:** [November 16, 2020, 10:21am UTC](https://discourse.julialang.org/t/is-there-a-command-for-forcing-a-fresh-precompilation-of-a-module/49730 "2020-11-16T10:21:28Z")

</div>

Hey, I am wondering if one can force a module to be precompiled. So I am looking for a command like precompilemodule( "pathto/MyModule.jl")

---

## [Index of element with lowest non-negative value](https://discourse.julialang.org/t/index-of-element-with-lowest-non-negative-value/50175)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 4\
**Last updated:** [November 16, 2020, 9:16am UTC](https://discourse.julialang.org/t/index-of-element-with-lowest-non-negative-value/50175 "2020-11-16T09:16:07Z")

</div>

I need to be able to find the index of the element within a 1d array that has the lowest non-negative value (so excluding all negative numbers). I know one way I finding it, namely using: minVal = Inf; index = 0; for i …

---

## [Why no mutating filter function for strings?](https://discourse.julialang.org/t/why-no-mutating-filter-function-for-strings/50213)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 7\
**Last updated:** [November 16, 2020, 9:02am UTC](https://discourse.julialang.org/t/why-no-mutating-filter-function-for-strings/50213 "2020-11-16T09:02:37Z")

</div>

Is there a reason why julia\> str = " a" " a" julia\> filter(isspace, str) " " works but julia\> filter!(isspace, str) ERROR: MethodError: no method matching filter!(::typeof(isspace), ::String) Closest candidates are: …

---

## [Use external CSS file in WebIO?](https://discourse.julialang.org/t/use-external-css-file-in-webio/50218)

<div class="topic-metadata">

**Author:** [@Jojo\_Dad](https://discourse.julialang.org/u/Jojo_Dad)\
**Replies:** 0\
**Last updated:** [November 16, 2020, 9:02am UTC](https://discourse.julialang.org/t/use-external-css-file-in-webio/50218 "2020-11-16T09:02:15Z")

</div>

How can I load an external CSS file in WebIO?

---

## [Writing LaTeX from Julia](https://discourse.julialang.org/t/writing-latex-from-julia/50187)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 6\
**Last updated:** [November 16, 2020, 8:54am UTC](https://discourse.julialang.org/t/writing-latex-from-julia/50187 "2020-11-16T08:54:18Z")

</div>

I’m trying to write LaTeX (which I’m sure most of you know involves a lot of backslashes, e.g. \\dfrac{3}{5} to create a fraction with numerator 3 and denominator 5) to a text file. By a DuckDuckGo search I found that sed…

---

## [Const FileData = AbstractVector{UInt8}](https://discourse.julialang.org/t/const-filedata-abstractvector-uint8/50147)

<div class="topic-metadata">

**Author:** [@JuergenD](https://discourse.julialang.org/u/JuergenD)\
**Replies:** 7\
**Last updated:** [November 16, 2020, 7:47am UTC](https://discourse.julialang.org/t/const-filedata-abstractvector-uint8/50147 "2020-11-16T07:47:43Z")

</div>

Hi, I thought const FileData = AbstractVector{UInt8} it is just an alias, but afaik it is not. buf = obj.buf # buf is defined as ::FileData while start \< size ... fn(@view buf\[start:stop\]) ... end The ver…

---

## [Read gzipped protobuf file](https://discourse.julialang.org/t/read-gzipped-protobuf-file/50215)

<div class="topic-metadata">

**Author:** [@unis](https://discourse.julialang.org/u/unis)\
**Replies:** 1\
**Last updated:** [November 16, 2020, 7:22am UTC](https://discourse.julialang.org/t/read-gzipped-protobuf-file/50215 "2020-11-16T07:22:54Z")

</div>

I have a “protobuf reader”, generated using protoc, proto/coordinate\_push.jl, using which I’d like to import a gzipped file. This file contains a list of frames, each containing object coordinates. The corresponding Pyt…

---

## [Plots... \`xrot\` stopped working?](https://discourse.julialang.org/t/plots-xrot-stopped-working/46503)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [November 16, 2020, 7:19am UTC](https://discourse.julialang.org/t/plots-xrot-stopped-working/46503 "2020-11-16T07:19:03Z")

</div>

In min June, I used keyword xrot to rotate the xticks in Plots with PyPlot backend: Today, the xrot keyword doesn’t seem to work any more: Has the keyword been removed/changed?

---

## [Is there a way to do elementwise function argument?](https://discourse.julialang.org/t/is-there-a-way-to-do-elementwise-function-argument/50178)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 5\
**Last updated:** [November 15, 2020, 11:46pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-do-elementwise-function-argument/50178 "2020-11-15T23:46:24Z")

</div>

For example I have a array \[4,5,6,7\] and I want to clamp the first element to 1, second element to 2, third element to 3 and fourth element to 4. Can I do something like clamp.(\[4,5,6,7\],\[0,0,0,0\],\[1,2,3,4\]) and somehow …

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=675)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=677)
