# Latest

**URL:** https://discourse.julialang.org/latest.md?page=785

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

**Page:** 786

---

## [Surprising benchmark results for a basic mixed precision example](https://discourse.julialang.org/t/surprising-benchmark-results-for-a-basic-mixed-precision-example/94410)

<div class="topic-metadata">

**Author:** [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)\
**Replies:** 1\
**Last updated:** [February 10, 2023, 1:47pm UTC](https://discourse.julialang.org/t/surprising-benchmark-results-for-a-basic-mixed-precision-example/94410 "2023-02-10T13:47:57Z")

</div>

I started to experiment with mixed precision and I benchmarked a basic example as follows: using BenchmarkTools using Quadmath using LinearAlgebra a16 = Vector{Float16}(undef, 100\_000\_000); a32 = Vector{Float32}(undef, …

---

## [Beginning programming in Julia (Stanford Summer School)](https://discourse.julialang.org/t/beginning-programming-in-julia-stanford-summer-school/94411)

<div class="topic-metadata">

**Author:** [@logankilpatrick](https://discourse.julialang.org/u/logankilpatrick)\
**Replies:** 0\
**Last updated:** [February 10, 2023, 1:47pm UTC](https://discourse.julialang.org/t/beginning-programming-in-julia-stanford-summer-school/94411 "2023-02-10T13:47:22Z")

</div>

Hey folks, I’m thrilled to share I’ll be starting to teach a course on “beginning programming in Julia” this summer at Stanford through the division of continuing education. If all goes well, this course will be one of t…

---

## [DiffEqFlux.jl: Questions about Neural ODEs](https://discourse.julialang.org/t/diffeqflux-jl-questions-about-neural-odes/94409)

<div class="topic-metadata">

**Author:** [@scj](https://discourse.julialang.org/u/scj)\
**Replies:** 1\
**Last updated:** [February 10, 2023, 1:46pm UTC](https://discourse.julialang.org/t/diffeqflux-jl-questions-about-neural-odes/94409 "2023-02-10T13:46:05Z")

</div>

I’m relatively new to both Julia and deep learning. I want to learn the dynamical model of a system using a set of observed trajectories. I’ve heard neural ODEs may be of promise, but they seem quite new, and I haven’t b…

---

## [Symbolic matrix exponential](https://discourse.julialang.org/t/symbolic-matrix-exponential/85435)

<div class="topic-metadata">

**Author:** [@Kaguro](https://discourse.julialang.org/u/Kaguro)\
**Replies:** 9\
**Last updated:** [February 10, 2023, 1:45pm UTC](https://discourse.julialang.org/t/symbolic-matrix-exponential/85435 "2023-02-10T13:45:23Z")

</div>

Hello All! I am fairly new to Julia. I want to find the matrix exponential of a symbolic matrix. How to do this? When I use the Symbolics and LinearAlgebra packages together, it doesn’t work: using Symbolics using Lin…

---

## [\[ANN\] ModelWrappers.jl - Flatten/Unflatten your Model Parameter in an Automatic Differentiation friendly way](https://discourse.julialang.org/t/ann-modelwrappers-jl-flatten-unflatten-your-model-parameter-in-an-automatic-differentiation-friendly-way/94401)

<div class="topic-metadata">

**Author:** [@PatAsch](https://discourse.julialang.org/u/PatAsch)\
**Replies:** 1\
**Last updated:** [February 10, 2023, 12:24pm UTC](https://discourse.julialang.org/t/ann-modelwrappers-jl-flatten-unflatten-your-model-parameter-in-an-automatic-differentiation-friendly-way/94401 "2023-02-10T12:24:49Z")

</div>

This package exists for some time now, but it is finally in a mature enough state that I wanted to share it here too. ModelWrappers.jl allows you to work with Model parameter either as a NamedTuple or as Vector and makes…

---

## [How to obtain the name of a constant given it's value?](https://discourse.julialang.org/t/how-to-obtain-the-name-of-a-constant-given-its-value/94402)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 4\
**Last updated:** [February 10, 2023, 10:46am UTC](https://discourse.julialang.org/t/how-to-obtain-the-name-of-a-constant-given-its-value/94402 "2023-02-10T10:46:59Z")

</div>

Suppose we have defined some const MY\_CONST\_NAME = 1. Then we have some function x = returnSomeNumber() which returns 1. Is it possible to print MY\_CONST\_NAME instead of 1 given the value of x without using, e.g., an ad…

---

## [Using large NTuples makes Julia hang](https://discourse.julialang.org/t/using-large-ntuples-makes-julia-hang/78900)

<div class="topic-metadata">

**Author:** [@Maurizio\_Tomasi](https://discourse.julialang.org/u/Maurizio_Tomasi)\
**Replies:** 23\
**Last updated:** [February 10, 2023, 10:40am UTC](https://discourse.julialang.org/t/using-large-ntuples-makes-julia-hang/78900 "2023-02-10T10:40:10Z")

</div>

Julia 1.7.2 on Linux x86\_64 seems to hang when instantiating structures containing large NTuple types, as the following code shows: struct Foo id:: UInt64 tag::NTuple{32, UInt8} start\_comment::NTuple{4096, U…

---

## [Fast string comparisons for strings of fixed length](https://discourse.julialang.org/t/fast-string-comparisons-for-strings-of-fixed-length/94378)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 3\
**Last updated:** [February 10, 2023, 10:23am UTC](https://discourse.julialang.org/t/fast-string-comparisons-for-strings-of-fixed-length/94378 "2023-02-10T10:23:45Z")

</div>

I want to leave here an interesting benchmark and see if someone comes with a new approach that provides faster results. The problem is: Given two arrays list and blocklist, find which elements in list also belong to b…

---

## [Computation of the expected value of a multidimensional array providing PMF on each dimension](https://discourse.julialang.org/t/computation-of-the-expected-value-of-a-multidimensional-array-providing-pmf-on-each-dimension/94404)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [February 10, 2023, 10:20am UTC](https://discourse.julialang.org/t/computation-of-the-expected-value-of-a-multidimensional-array-providing-pmf-on-each-dimension/94404 "2023-02-10T10:20:26Z")

</div>

Isn’t there something smarter already in the Julia standard lib to compute the expected value of a multidimensional tensor given a vector of PMFs than the following code ? julia\> function EV(v,p) # v is a multidimension…

---

## [Broadcast macro @. "escape" from it](https://discourse.julialang.org/t/broadcast-macro-escape-from-it/94396)

<div class="topic-metadata">

**Author:** [@mreichMPI-BGC](https://discourse.julialang.org/u/mreichMPI-BGC)\
**Replies:** 2\
**Last updated:** [February 10, 2023, 10:17am UTC](https://discourse.julialang.org/t/broadcast-macro-escape-from-it/94396 "2023-02-10T10:17:43Z")

</div>

Dear all, I like the @. macro, but is there a way to partly escape it? Use case is a situation where in an expression 9 out of 10 operations need the . and one operation does not. @. sum(a + b + c + d) where a to d ar…

---

## [Web server with latency-sensitive and compute-heavy task separate thread pools](https://discourse.julialang.org/t/web-server-with-latency-sensitive-and-compute-heavy-task-separate-thread-pools/93949)

<div class="topic-metadata">

**Author:** [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Replies:** 12\
**Last updated:** [February 10, 2023, 9:32am UTC](https://discourse.julialang.org/t/web-server-with-latency-sensitive-and-compute-heavy-task-separate-thread-pools/93949 "2023-02-10T09:32:03Z")

</div>

I need to set up a web server that mainly serves requests which are computationally heavy and multithreaded, but should remain responsive to health checks (from a Kubernetes cluster) which are latency sensitive. I want t…

---

## [Nested for loop](https://discourse.julialang.org/t/nested-for-loop/94394)

<div class="topic-metadata">

**Author:** [@j\_tanu](https://discourse.julialang.org/u/j_tanu)\
**Replies:** 3\
**Last updated:** [February 10, 2023, 8:58am UTC](https://discourse.julialang.org/t/nested-for-loop/94394 "2023-02-10T08:58:42Z")

</div>

HI, I am trying to write a nested for loop, and I am not getting the desired output. Possibly I am making some mistakes, and there must be other ways to solve this problem. I am writing down the part of my code. for i…

---

## [Saving Unitful DataFrame to file](https://discourse.julialang.org/t/saving-unitful-dataframe-to-file/69313)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 8\
**Last updated:** [February 10, 2023, 7:08am UTC](https://discourse.julialang.org/t/saving-unitful-dataframe-to-file/69313 "2023-02-10T07:08:03Z")

</div>

Imagine I have a DataFrame with some of the columns being Unitful. Is there a way to save such a DataFrame into a file while preserving the information about the units? The only solution I can think about is to strip it…

---

## [Getting OpticSim.jl to work](https://discourse.julialang.org/t/getting-opticsim-jl-to-work/93982)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 8\
**Last updated:** [February 10, 2023, 7:01am UTC](https://discourse.julialang.org/t/getting-opticsim-jl-to-work/93982 "2023-02-10T07:01:25Z")

</div>

The documentation for OpticSim.jl says that I should “Run this example to check that everything installed properly”. The example produces the following for me: julia\> using OpticSim julia\> Vis.draw(SphericalLens(OpticS…

---

## [Why is it that Arrays can't be modified using nested index](https://discourse.julialang.org/t/why-is-it-that-arrays-cant-be-modified-using-nested-index/93889)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 18\
**Last updated:** [February 10, 2023, 5:10am UTC](https://discourse.julialang.org/t/why-is-it-that-arrays-cant-be-modified-using-nested-index/93889 "2023-02-10T05:10:08Z")

</div>

In this expression A = ones(3,3); # this works A\[1,1\] = 2; julia\> A 3×3 Matrix{Float64}: 2.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 # but this does not A\[:,1\]\[1\] = 3; julia\> A 3×3 Matrix{Float64}: 2.0 1.0 1.0 1…

---

## [ReverseDiff for loss function with Zygote derivatives](https://discourse.julialang.org/t/reversediff-for-loss-function-with-zygote-derivatives/94382)

<div class="topic-metadata">

**Author:** [@PatrickMcFarlane](https://discourse.julialang.org/u/PatrickMcFarlane)\
**Replies:** 1\
**Last updated:** [February 10, 2023, 3:30am UTC](https://discourse.julialang.org/t/reversediff-for-loss-function-with-zygote-derivatives/94382 "2023-02-10T03:30:24Z")

</div>

I’m trying to use Flux.jl to find the solution to a function equation with a form a bit like g(f(x)\[1\]) = h(f’(x)), where f(x) is an unkown function to be approximated by a neural network. The loss function for this set…

---

## [Can I use user defined data types with ODE?](https://discourse.julialang.org/t/can-i-use-user-defined-data-types-with-ode/94390)

<div class="topic-metadata">

**Author:** [@shaurya](https://discourse.julialang.org/u/shaurya)\
**Replies:** 2\
**Last updated:** [February 10, 2023, 3:26am UTC](https://discourse.julialang.org/t/can-i-use-user-defined-data-types-with-ode/94390 "2023-02-10T03:26:36Z")

</div>

Can I use user defined data type with ODE function? mutable struct ud a::Float64 b::Float64 end function od!(dx,x,t) dx.= \[1, x.a \]; end ic = ud(1.0,2.0); prob=ODEProblem(od!,ic,(0.0,1.2)); sol1=solve(p…

---

## [NLopt :FORCED\_STOP after one iteration Gradient based optimization](https://discourse.julialang.org/t/nlopt-forced-stop-after-one-iteration-gradient-based-optimization/94383)

<div class="topic-metadata">

**Author:** [@SamerGerges](https://discourse.julialang.org/u/SamerGerges)\
**Replies:** 7\
**Last updated:** [February 10, 2023, 2:33am UTC](https://discourse.julialang.org/t/nlopt-forced-stop-after-one-iteration-gradient-based-optimization/94383 "2023-02-10T02:33:19Z")

</div>

Hello, I am using NLopt to solve an optimization problem with non-linear constraints. I provide the gradients for both the optimization function and the gradient function. Both functions provide the correct values of th…

---

## [How to test solvers in JuMP](https://discourse.julialang.org/t/how-to-test-solvers-in-jump/94250)

<div class="topic-metadata">

**Author:** [@kevinqiao](https://discourse.julialang.org/u/kevinqiao)\
**Replies:** 2\
**Last updated:** [February 10, 2023, 1:42am UTC](https://discourse.julialang.org/t/how-to-test-solvers-in-jump/94250 "2023-02-10T01:42:58Z")

</div>

I have installed JuMP and some solvers, how to test solvers in JuMP, as I want to verify the solvers work well and the correct solution can be obtained. Thanks in advance.

---

## [InitError(mod=:micromamba\_jll](https://discourse.julialang.org/t/initerror-mod-micromamba-jll/94377)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 7\
**Last updated:** [February 10, 2023, 1:27am UTC](https://discourse.julialang.org/t/initerror-mod-micromamba-jll/94377 "2023-02-10T01:27:06Z")

</div>

I fail to run the application MyApp.exe compiled from the minimal example of the package PackageCompiler The error message can be found here: # InitError(mod=:micromamba\_jll … Any ideas? - Is this a current situation …

---

## [How to optimize trace of matrix inverse with JuMP or Convex?](https://discourse.julialang.org/t/how-to-optimize-trace-of-matrix-inverse-with-jump-or-convex/94167)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 6\
**Last updated:** [February 10, 2023, 1:03am UTC](https://discourse.julialang.org/t/how-to-optimize-trace-of-matrix-inverse-with-jump-or-convex/94167 "2023-02-10T01:03:43Z")

</div>

Hi community, I want to minimize tr(S^{-1}) + tr((A - S)^{-1}) such that S \\succeq 0 and A - S \\succeq 0 (S is the optimization matrix, A is some fixed positive definite matrix) I tried using JuMP + Hypatia: using Hyp…

---

## [Multiple tests and error checking at the time of creating a struct with a many properties](https://discourse.julialang.org/t/multiple-tests-and-error-checking-at-the-time-of-creating-a-struct-with-a-many-properties/94317)

<div class="topic-metadata">

**Author:** [@saumil-sh](https://discourse.julialang.org/u/saumil-sh)\
**Replies:** 10\
**Last updated:** [February 9, 2023, 11:10pm UTC](https://discourse.julialang.org/t/multiple-tests-and-error-checking-at-the-time-of-creating-a-struct-with-a-many-properties/94317 "2023-02-09T23:10:54Z")

</div>

I am new to Julia and object-oriented programming. I am used to the following practice function compare\_sizes(x,y) length(x) == length(y) ? "good to go" : error(DimensionMismatch) end Now, in object-oriented progra…

---

## [Using CuSparseMatrixCSR](https://discourse.julialang.org/t/using-cusparsematrixcsr/94379)

<div class="topic-metadata">

**Author:** [@shakedregev](https://discourse.julialang.org/u/shakedregev)\
**Replies:** 1\
**Last updated:** [February 9, 2023, 11:09pm UTC](https://discourse.julialang.org/t/using-cusparsematrixcsr/94379 "2023-02-09T23:09:35Z")

</div>

Hi, Based on the CUDA.jl github I tried to create a CuSparseMatrixCSR matrix. I’m sparing the loading of the data, all of the values I input in are defined. using CUDA export CuSparseMatrixCSC, CuSparseMatrixCSR, CuSp…

---

## [Implement getindex for array indexing and range indexing](https://discourse.julialang.org/t/implement-getindex-for-array-indexing-and-range-indexing/94369)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 4\
**Last updated:** [February 9, 2023, 10:17pm UTC](https://discourse.julialang.org/t/implement-getindex-for-array-indexing-and-range-indexing/94369 "2023-02-09T22:17:38Z")

</div>

I have a struct which should behave like a matrix. I want to have all the standard indexing methods julia has, like A\[:, j\], A\[1:3, j\], A\[\[1,3,4\], j\] and so on. Currently I have the following (simplified) function Base…

---

## [MTK & vector equations -- get error message on "axes of broadcast not known"](https://discourse.julialang.org/t/mtk-vector-equations-get-error-message-on-axes-of-broadcast-not-known/94343)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 9\
**Last updated:** [February 9, 2023, 9:15pm UTC](https://discourse.julialang.org/t/mtk-vector-equations-get-error-message-on-axes-of-broadcast-not-known/94343 "2023-02-09T21:15:23Z")

</div>

OK… I’m finally trying to learn MTK by re-implementing old models from Modelica (i.e., the models work). Now, I’m doing a manual discretization of an advection PDE/simple gas pipe. It is not super realistic, but that is…

---

## [CairoMakie: UndefVarError: Axis not defined](https://discourse.julialang.org/t/cairomakie-undefvarerror-axis-not-defined/94367)

<div class="topic-metadata">

**Author:** [@aquarelleX332](https://discourse.julialang.org/u/aquarelleX332)\
**Replies:** 3\
**Last updated:** [February 9, 2023, 9:06pm UTC](https://discourse.julialang.org/t/cairomakie-undefvarerror-axis-not-defined/94367 "2023-02-09T21:06:49Z")

</div>

Hello dear all, Julia-1.8.5 Makie v0.19.2 CairoMakie v0.10.2 I am trying to learn the basics of Makie according to the basic tutorial. After installation: julia\> using CairoMakie julia\> f = Figure(resolution = (40…

---

## [AI: Sing-song, Musdb.jl (and Nerf.jl)](https://discourse.julialang.org/t/ai-sing-song-musdb-jl-and-nerf-jl/94373)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [February 9, 2023, 8:32pm UTC](https://discourse.julialang.org/t/ai-sing-song-musdb-jl-and-nerf-jl/94373 "2023-02-09T20:32:21Z")

</div>

There has been some notable music related AI recently, e.g. from Google: https://storage.googleapis.com/sing-song/index.html I mention it since, linked from there was: Tools Parsers musdb: Python based dataset pars…

---

## [What is the difference between variable definition in JuMP like these two ways](https://discourse.julialang.org/t/what-is-the-difference-between-variable-definition-in-jump-like-these-two-ways/94337)

<div class="topic-metadata">

**Author:** [@Betristor](https://discourse.julialang.org/u/Betristor)\
**Replies:** 4\
**Last updated:** [February 9, 2023, 8:20pm UTC](https://discourse.julialang.org/t/what-is-the-difference-between-variable-definition-in-jump-like-these-two-ways/94337 "2023-02-09T20:20:20Z")

</div>

I got two difinition ways used in my JuMP model. And I encountered some trouble when I try to access their results using value function. A is a variable defined as @variable(M, A\[i = 1:3, t = 1:24\]) and B is like @variab…

---

## [Number of iterations increases with successive optimizations](https://discourse.julialang.org/t/number-of-iterations-increases-with-successive-optimizations/94352)

<div class="topic-metadata">

**Author:** [@aurelhern](https://discourse.julialang.org/u/aurelhern)\
**Replies:** 2\
**Last updated:** [February 9, 2023, 7:40pm UTC](https://discourse.julialang.org/t/number-of-iterations-increases-with-successive-optimizations/94352 "2023-02-09T19:40:59Z")

</div>

Dear all, I am running an optimization problem (multi-period DC-optimal power flow). And when using set\_normalized\_rhs function to modify the constant term on the right-hand-side of the concerned constraints and re-opti…

---

## [Bug/unexpected behavior when extending Base.any with new type](https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359)

<div class="topic-metadata">

**Author:** [@brunbjerg](https://discourse.julialang.org/u/brunbjerg)\
**Replies:** 4\
**Last updated:** [February 9, 2023, 7:40pm UTC](https://discourse.julialang.org/t/bug-unexpected-behavior-when-extending-base-any-with-new-type/94359 "2023-02-09T19:40:26Z")

</div>

I have extended the any function as shown in the example below: function Base.any(array::Matrix{Real}) checker = zeros(Bool, size(array)\[1\]) for i in axes(array, 1) for j in axes(array, 2) i…

[Previous page](https://discourse.julialang.org/latest.md?page=784)

[Next page](https://discourse.julialang.org/latest.md?page=786)
