# Specific Domains

**URL:** https://discourse.julialang.org/c/domain/10.md?no_subcategories=false&page=219

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

**Page:** 220

---

## [Vectorized Modulo Function for JuMP](https://discourse.julialang.org/t/vectorized-modulo-function-for-jump/93800)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 3\
**Last updated:** [January 31, 2023, 4:25am UTC](https://discourse.julialang.org/t/vectorized-modulo-function-for-jump/93800 "2023-01-31T04:25:01Z")

</div>

I’m trying to write a vectorized modulo function for JuMP to be invoked via: e = reformulate\_mod\_vec(model, A\*\[x;y\], v) A is a Jx(n+m) fixed matrix, x is a nx1 vector of JuMP variables, y is a mx1 vector of JuMP variab…

---

## [How to use the rule set from ChainRules.jl?](https://discourse.julialang.org/t/how-to-use-the-rule-set-from-chainrules-jl/93658)

<div class="topic-metadata">

**Author:** [@Jonas208](https://discourse.julialang.org/u/Jonas208)\
**Replies:** 1\
**Last updated:** [January 30, 2023, 10:10pm UTC](https://discourse.julialang.org/t/how-to-use-the-rule-set-from-chainrules-jl/93658 "2023-01-30T22:10:59Z")

</div>

What is the best way to use the ruleset from ChainRules.jl if you want to build an AD engine based on operator overloading. I can’t find much useful information in the ChainRules documentation, nor in the ChainRulesOver…

---

## [How to label individuals dots in scatterplot?](https://discourse.julialang.org/t/how-to-label-individuals-dots-in-scatterplot/93791)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 4\
**Last updated:** [January 30, 2023, 9:01pm UTC](https://discourse.julialang.org/t/how-to-label-individuals-dots-in-scatterplot/93791 "2023-01-30T21:01:17Z")

</div>

I want to scatter plto a bunch of dots, attaching a label to each. However, the label command gives the first label to each dot. Sample code: using Plots xs = \[1,2,3\] ys = \[2,4,6\] colors = \[:red :blue :green\] labels = \[…

---

## [Vmls - sum of vectors, displacement](https://discourse.julialang.org/t/vmls-sum-of-vectors-displacement/93779)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 5\
**Last updated:** [January 30, 2023, 7:52pm UTC](https://discourse.julialang.org/t/vmls-sum-of-vectors-displacement/93779 "2023-01-30T19:52:33Z")

</div>

Hello, good afternoon. I’m reading the VMLS book introduction about algebra linear and trying to draw the vector displacement in a plot. When sum two vectors a and b, the a+b vector dont need to connect to the end of b…

---

## [Combining ContinuousSpace with discrete grid property in InteractiveDynamics](https://discourse.julialang.org/t/combining-continuousspace-with-discrete-grid-property-in-interactivedynamics/93684)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 7\
**Last updated:** [January 30, 2023, 5:27pm UTC](https://discourse.julialang.org/t/combining-continuousspace-with-discrete-grid-property-in-interactivedynamics/93684 "2023-01-30T17:27:10Z")

</div>

Hi, I’m writing simulations for a course on Agent-Based Modeling, and I’m struggling to combine discrete heatmaps with movement in a ContinuousSpace. In the following code, everything works fine until I add the final li…

---

## [ElementaryChemistry.jl](https://discourse.julialang.org/t/elementarychemistry-jl/63373)

<div class="topic-metadata">

**Author:** [@Baobab\_The\_fruit](https://discourse.julialang.org/u/Baobab_The_fruit)\
**Replies:** 3\
**Last updated:** [January 30, 2023, 4:46pm UTC](https://discourse.julialang.org/t/elementarychemistry-jl/63373 "2023-01-30T16:46:27Z")

</div>

Both an announcement and topic that would fit in here this is my package should be added to the general registry tomorrow. I would love suggestions, ideas on what formulas, ideas, or concepts to add to the project. bao…

---

## [Could CUDA.jl be better at explaining what went wrong](https://discourse.julialang.org/t/could-cuda-jl-be-better-at-explaining-what-went-wrong/93735)

<div class="topic-metadata">

**Author:** [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Replies:** 8\
**Last updated:** [January 30, 2023, 2:51pm UTC](https://discourse.julialang.org/t/could-cuda-jl-be-better-at-explaining-what-went-wrong/93735 "2023-01-30T14:51:37Z")

</div>

Wouldn’t it be possible to include a bit more information in the CUDA error messages? It is often hard to locate the source of an error that manifests itself in the CUDA code and I would think all clues would be welcome…

---

## [Margins controls for PyPlot](https://discourse.julialang.org/t/margins-controls-for-pyplot/93759)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 1\
**Last updated:** [January 30, 2023, 1:07pm UTC](https://discourse.julialang.org/t/margins-controls-for-pyplot/93759 "2023-01-30T13:07:11Z")

</div>

Hello what are the Julia PyPlot equivalents to R’s margin parameters oma and mai? Thank you

---

## [Integral equations in ModelingToolkit](https://discourse.julialang.org/t/integral-equations-in-modelingtoolkit/74346)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 3\
**Last updated:** [January 30, 2023, 1:36pm UTC](https://discourse.julialang.org/t/integral-equations-in-modelingtoolkit/74346 "2023-01-30T13:36:26Z")

</div>

Hi Everyone, I’d like to know how/if the following integral equation can be solved in ModelingToolkit: using ModelingToolkit using DomainSets @parameters t β γ @variables S(..) I(..) R(..) It = Integral(t in DomainSet…

---

## [Working with shared memory as one or more variables, what is a good approach?](https://discourse.julialang.org/t/working-with-shared-memory-as-one-or-more-variables-what-is-a-good-approach/93758)

<div class="topic-metadata">

**Author:** [@bcsj](https://discourse.julialang.org/u/bcsj)\
**Replies:** 2\
**Last updated:** [January 30, 2023, 1:14pm UTC](https://discourse.julialang.org/t/working-with-shared-memory-as-one-or-more-variables-what-is-a-good-approach/93758 "2023-01-30T13:14:29Z")

</div>

I’m somewhat new to writing gpu code, but I am working on a somewhat complicated kernel function, which involves a number of steps in which shared memory is used to speed up the computations. To be efficient I reuse the…

---

## [What's wrong with this system/circuit?](https://discourse.julialang.org/t/whats-wrong-with-this-system-circuit/93569)

<div class="topic-metadata">

**Author:** [@sh2pro](https://discourse.julialang.org/u/sh2pro)\
**Replies:** 7\
**Last updated:** [January 30, 2023, 11:52am UTC](https://discourse.julialang.org/t/whats-wrong-with-this-system-circuit/93569 "2023-01-30T11:52:08Z")

</div>

I’ve defined a system as follows: using ModelingToolkit, ModelingToolkitStandardLibrary using DifferentialEquations using ModelingToolkitStandardLibrary.Electrical using ModelingToolkitStandardLibrary.Blocks function C…

---

## [\[ANN\]: TernaryDiagrams.jl](https://discourse.julialang.org/t/ann-ternarydiagrams-jl/92312)

<div class="topic-metadata">

**Author:** [@Elmo](https://discourse.julialang.org/u/Elmo)\
**Replies:** 2\
**Last updated:** [January 30, 2023, 10:23am UTC](https://discourse.julialang.org/t/ann-ternarydiagrams-jl/92312 "2023-01-30T10:23:36Z")

</div>

Hi all! I made a small Makie recipe package that allows you to draw ternary plots like this: I am planning on eventually making a ternary axis properly (instead of co-opting the regular 2D axis like I do currently), …

---

## [Quadratic Program solver for Portfolio Optimization](https://discourse.julialang.org/t/quadratic-program-solver-for-portfolio-optimization/93264)

<div class="topic-metadata">

**Author:** [@maxchendt](https://discourse.julialang.org/u/maxchendt)\
**Replies:** 8\
**Last updated:** [January 30, 2023, 8:56am UTC](https://discourse.julialang.org/t/quadratic-program-solver-for-portfolio-optimization/93264 "2023-01-30T08:56:53Z")

</div>

Any recommendations? For portfolio selection problem with equality and inequality constraints, and lower and upper bounds for portfolio weights. So far, what I have tested ( I do not test commercial solver like Gurobi …

---

## [Constrain weights and biases to be positive](https://discourse.julialang.org/t/constrain-weights-and-biases-to-be-positive/93381)

<div class="topic-metadata">

**Author:** [@marco\_menarini](https://discourse.julialang.org/u/marco_menarini)\
**Replies:** 5\
**Last updated:** [January 30, 2023, 8:38am UTC](https://discourse.julialang.org/t/constrain-weights-and-biases-to-be-positive/93381 "2023-01-30T08:38:02Z")

</div>

Is it possible to use a custom constrained optimizer or to modify the gradients to only allow for positive weights and biases?

---

## [⸘How do I do "tensor slicing" in Flux and CUDA‽](https://discourse.julialang.org/t/how-do-i-do-tensor-slicing-in-flux-and-cuda/93590)

<div class="topic-metadata">

**Author:** [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Replies:** 5\
**Last updated:** [January 30, 2023, 3:47am UTC](https://discourse.julialang.org/t/how-do-i-do-tensor-slicing-in-flux-and-cuda/93590 "2023-01-30T03:47:02Z")

</div>

If I have a tensor T ∈ ∏ ℝⁱₖ|k ∈ {1,…,m} and I want to drop some elements to get T̂ ∈ ∏ ℝⁿₖ|k ∈ {1,…,m}, nₖ = iₖ | k ∈ {1,…,m}\\{p| p ∈ ℕ, 1 ≤ p ≤ m} ∧ 1 ≤ nₖ ≤ iₖ | k = p, how should I then include that transformation in…

---

## [How to access the exit of MadNLP solver directly](https://discourse.julialang.org/t/how-to-access-the-exit-of-madnlp-solver-directly/93685)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 5\
**Last updated:** [January 29, 2023, 8:39pm UTC](https://discourse.julialang.org/t/how-to-access-the-exit-of-madnlp-solver-directly/93685 "2023-01-29T20:39:52Z")

</div>

Hi all, I wonder if it is possible to access the exit of a solver directly from JuMP0, i.e. the exit we get when not setting the JuMP model in silent as shown in the screenshot below. I would really appreciate it if you…

---

## [How to properly pass structs into GPU? (MWE included)](https://discourse.julialang.org/t/how-to-properly-pass-structs-into-gpu-mwe-included/93727)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [January 29, 2023, 8:23pm UTC](https://discourse.julialang.org/t/how-to-properly-pass-structs-into-gpu-mwe-included/93727 "2023-01-29T20:23:50Z")

</div>

Hello! Lately I’ve been asking a few questions about how to program on GPU etc. and I’ve gotten some answers (thank you very much!), but of course it is hard to help me if I only provide a few line of codes. So this mor…

---

## [Duality gap in Convex.jl](https://discourse.julialang.org/t/duality-gap-in-convex-jl/93741)

<div class="topic-metadata">

**Author:** [@ajd](https://discourse.julialang.org/u/ajd)\
**Replies:** 2\
**Last updated:** [January 29, 2023, 7:50pm UTC](https://discourse.julialang.org/t/duality-gap-in-convex-jl/93741 "2023-01-29T19:50:31Z")

</div>

Using the SCS solver with Convex.jl, the output of the solver includes in its printed output the duality gap: ------------------------------------------------------------------ SCS v3.2.1 - Splitting Conic Solve…

---

## [Passing mutable struct to kernel](https://discourse.julialang.org/t/passing-mutable-struct-to-kernel/71948)

<div class="topic-metadata">

**Author:** [@lodygaw](https://discourse.julialang.org/u/lodygaw)\
**Replies:** 7\
**Last updated:** [January 29, 2023, 3:20pm UTC](https://discourse.julialang.org/t/passing-mutable-struct-to-kernel/71948 "2023-01-29T15:20:27Z")

</div>

Hi, I am looking for the best way to use structs inside the kernels and I am having hard time with understanding whole mutable/immutable/isbits/inline thing. My goal is to be able to pass struct as an argument to a kern…

---

## [Turing.jl Warning: The current proposal will be rejected due to numerical error(s). isfinite.((θ, r, ℓπ, ℓκ)) = (true, false, false, false)](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s-isfinite-r-true-false-false-false/93472)

<div class="topic-metadata">

**Author:** [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Replies:** 4\
**Last updated:** [January 29, 2023, 12:26pm UTC](https://discourse.julialang.org/t/turing-jl-warning-the-current-proposal-will-be-rejected-due-to-numerical-error-s-isfinite-r-true-false-false-false/93472 "2023-01-29T12:26:14Z")

</div>

I slightly modifies the gdemo example in Turing.jl to accept more data to # Import packages. using Turing # Define a simple Normal model with unknown mean and variance. @model function gdemo(x) s² ~ InverseGamma(2,…

---

## [Implementing convolution from scratch](https://discourse.julialang.org/t/implementing-convolution-from-scratch/93723)

<div class="topic-metadata">

**Author:** [@skittishdev](https://discourse.julialang.org/u/skittishdev)\
**Replies:** 5\
**Last updated:** [January 29, 2023, 9:43am UTC](https://discourse.julialang.org/t/implementing-convolution-from-scratch/93723 "2023-01-29T09:43:23Z")

</div>

Hello, I already posted this question on Stackoverflow, but decided I’d ask here as well. Please find my question from Stackoverflow pasted below (verbatim). I am trying to implement convolution by hand in Julia. I’m …

---

## [NaNs In The Output of SVD](https://discourse.julialang.org/t/nans-in-the-output-of-svd/93712)

<div class="topic-metadata">

**Author:** [@robin-armstrong](https://discourse.julialang.org/u/robin-armstrong)\
**Replies:** 1\
**Last updated:** [January 28, 2023, 10:22pm UTC](https://discourse.julialang.org/t/nans-in-the-output-of-svd/93712 "2023-01-28T22:22:47Z")

</div>

I am currently running numerical experiments which involve computing the SVD of a very large number of random matrices. Occasionally, Julia’s SVD function will return a Vt factor that contains a row of all NaNs. Here is …

---

## [How do I get allocations down but keep code speed?](https://discourse.julialang.org/t/how-do-i-get-allocations-down-but-keep-code-speed/93692)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 9\
**Last updated:** [January 28, 2023, 9:11pm UTC](https://discourse.julialang.org/t/how-do-i-get-allocations-down-but-keep-code-speed/93692 "2023-01-28T21:11:17Z")

</div>

using CUDA, StaticArrays, Flux N = 10^6 T = Float32 WgL = CuArray(rand(SVector{3,T},N)) I\_ = CuArray(rand(1:6195,N)) J\_ = CuArray(rand(1:6195,N)) WGL = CuArray(zeros(SVector{3,T},N)) CUDA.@allocated WGL .= WgL\[I\_\] -…

---

## [New package: ApproximateVI.jl](https://discourse.julialang.org/t/new-package-approximatevi-jl/93454)

<div class="topic-metadata">

**Author:** [@Nikos\_Gianniotis](https://discourse.julialang.org/u/Nikos_Gianniotis)\
**Replies:** 5\
**Last updated:** [January 28, 2023, 7:56pm UTC](https://discourse.julialang.org/t/new-package-approximatevi-jl/93454 "2023-01-28T19:56:57Z")

</div>

Hello everyone, I recently wrapped up some code of mine and decided for my own sake to package it and register it with general Julia registry. The package can be found here: The package is about approximating an intr…

---

## [Why does GPU allocate so much for me?](https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [January 28, 2023, 9:41am UTC](https://discourse.julialang.org/t/why-does-gpu-allocate-so-much-for-me/93681 "2023-01-28T09:41:35Z")

</div>

Hello! Probably a noob question, but got to ask :slight\_smile: Suppose I have: using CUDA N = 10^6 AGPU = CuArray(rand(N)) BGPU = CuArray(rand(N)) ACPU = rand(N) BCPU = rand(N) # Why does GPU allocate so much mo…

---

## [Unable to use CUDA from artifacts](https://discourse.julialang.org/t/unable-to-use-cuda-from-artifacts/86854)

<div class="topic-metadata">

**Author:** [@yoshi](https://discourse.julialang.org/u/yoshi)\
**Replies:** 5\
**Last updated:** [January 28, 2023, 8:06am UTC](https://discourse.julialang.org/t/unable-to-use-cuda-from-artifacts/86854 "2023-01-28T08:06:46Z")

</div>

I’m trying to use julia in an HPC environment. I load the CUDA driver using slurm’s “module” functionality. I can see where it is in the $PATH variable. But when I go to run “pkg\> test CUDA” I get warnings saying “This v…

---

## [Multi-Threading with GPU](https://discourse.julialang.org/t/multi-threading-with-gpu/93542)

<div class="topic-metadata">

**Author:** [@frog](https://discourse.julialang.org/u/frog)\
**Replies:** 3\
**Last updated:** [January 28, 2023, 2:42am UTC](https://discourse.julialang.org/t/multi-threading-with-gpu/93542 "2023-01-28T02:42:46Z")

</div>

Attempting to create a program that gets the maximum number of threads available for a system GPU ( CUDA ) and runs a function per thread. First the program gets the total number of available threads and adds a slight b…

---

## [MOI Count Repetitions of Integers](https://discourse.julialang.org/t/moi-count-repetitions-of-integers/93545)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 6\
**Last updated:** [January 26, 2023, 7:43am UTC](https://discourse.julialang.org/t/moi-count-repetitions-of-integers/93545 "2023-01-26T07:43:05Z")

</div>

Given a vector of integers, is there a MOI constraint that will count the number of repetitions of each distinct integer in the vector?

---

## [How to switch between several layouts in Makie?](https://discourse.julialang.org/t/how-to-switch-between-several-layouts-in-makie/93578)

<div class="topic-metadata">

**Author:** [@pzabka](https://discourse.julialang.org/u/pzabka)\
**Replies:** 6\
**Last updated:** [January 27, 2023, 9:51pm UTC](https://discourse.julialang.org/t/how-to-switch-between-several-layouts-in-makie/93578 "2023-01-27T21:51:42Z")

</div>

Hello, I am creating a GUI in Makie, and I would like to be able to change the layout with a menu widget. So far, I can add widgets (GridLaouts) at runtime, but I didn’t find how to hide or replace them. See the mwe bel…

---

## [Can I "warm start" Optim.jl's BFGS more cleanly?](https://discourse.julialang.org/t/can-i-warm-start-optim-jls-bfgs-more-cleanly/93648)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 1\
**Last updated:** [January 27, 2023, 7:28pm UTC](https://discourse.julialang.org/t/can-i-warm-start-optim-jls-bfgs-more-cleanly/93648 "2023-01-27T19:28:31Z")

</div>

Hey, I am solving a series of problems which are in some sense very small modifications from one another. At eash step, I modify my loss using the information from the inverse hessian obtained by BFGS, and then i resta…

[Previous page](https://discourse.julialang.org/c/domain/10.md?no_subcategories=false&page=218)

[Next page](https://discourse.julialang.org/c/domain/10.md?no_subcategories=false&page=220)
