# General Usage

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

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

**Page:** 440

---

## [How to tranform a vector into a matrix?](https://discourse.julialang.org/t/how-to-tranform-a-vector-into-a-matrix/82286)

<div class="topic-metadata">

**Author:** [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Replies:** 5\
**Last updated:** [June 6, 2022, 1:26pm UTC](https://discourse.julialang.org/t/how-to-tranform-a-vector-into-a-matrix/82286 "2022-06-06T13:26:33Z")

</div>

How to transform a vector of type: \[\[1.021434087e-5, 1.532972083e-5, -1.493500137e-5\], \[-0.19951695340554, 0.87894179053067, -0.62713882127936\], \[0.76712229809243, 0.24863902907755, 0.74526241504934\], \[0.355803343995…

---

## [MKL and sparse solvers](https://discourse.julialang.org/t/mkl-and-sparse-solvers/82292)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 2:59pm UTC](https://discourse.julialang.org/t/mkl-and-sparse-solvers/82292 "2022-06-06T14:59:21Z")

</div>

What I wonder is: do the sparse matrix routines of CHOMOD and UMFPACK take advantage of MKL behind the scenes? Enabling or disabling MKL (using MKL) made absolutely no difference when calling cholesky and lu.

---

## [Ascending order of float numbers](https://discourse.julialang.org/t/ascending-order-of-float-numbers/82296)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 9\
**Last updated:** [June 6, 2022, 1:56pm UTC](https://discourse.julialang.org/t/ascending-order-of-float-numbers/82296 "2022-06-06T13:56:12Z")

</div>

I want to get TotalCharges of females in ascending order so that i could plot them, but sort function is not taking care of decimal point in number. :yum: as you can see 102 is coming after 1017. what should i do ?

---

## [How to use textrm with LaTeXStrings and the pyplot backend](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [June 6, 2022, 1:44pm UTC](https://discourse.julialang.org/t/how-to-use-textrm-with-latexstrings-and-the-pyplot-backend/82303 "2022-06-06T13:44:04Z")

</div>

Hi all, I am trying to use a combination of math and text symbols with LaTeXStrings and the pyplot backend of Plots.jl. Unfortunately, textrm does not work for some reason. Is there anything special I need to do, or is …

---

## [I couldn't debug codes that ran normally](https://discourse.julialang.org/t/i-couldnt-debug-codes-that-ran-normally/82311)

<div class="topic-metadata">

**Author:** [@Ouyuan](https://discourse.julialang.org/u/Ouyuan)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 1:27pm UTC](https://discourse.julialang.org/t/i-couldnt-debug-codes-that-ran-normally/82311 "2022-06-06T13:27:38Z")

</div>

I could run my code correctly. But when I wanted to debugger and check some variables, it seemed that the debugger couldn’t get through function fft! in the FFTW package. The debugger broke down in FFTW package and I cou…

---

## [Spurious allocations with @threads, when setting variables using if statements](https://discourse.julialang.org/t/spurious-allocations-with-threads-when-setting-variables-using-if-statements/82233)

<div class="topic-metadata">

**Author:** [@lukas.grunwald](https://discourse.julialang.org/u/lukas.grunwald)\
**Replies:** 5\
**Last updated:** [June 6, 2022, 12:45pm UTC](https://discourse.julialang.org/t/spurious-allocations-with-threads-when-setting-variables-using-if-statements/82233 "2022-06-06T12:45:27Z")

</div>

Annotating a for loop with @threads, that depends on a variable fixed in an if statement, leads to many additional allocations inside the loop. Replacing the if-statement with a ternary-operator removes these additional …

---

## [Question about plotting panel data?](https://discourse.julialang.org/t/question-about-plotting-panel-data/82250)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 16\
**Last updated:** [June 6, 2022, 12:27pm UTC](https://discourse.julialang.org/t/question-about-plotting-panel-data/82250 "2022-06-06T12:27:24Z")

</div>

Dear all, In Stata, we can easily use xtline to plot the graph of panel data. webuse grunfeld,clear xtline invest In Julia, How can I plot this graph? julia\> using RDatasets julia\> using DataFrames julia\> df = d…

---

## [Github Actions CI using PyCall and a local/Github python package](https://discourse.julialang.org/t/github-actions-ci-using-pycall-and-a-local-github-python-package/82191)

<div class="topic-metadata">

**Author:** [@mabuwu](https://discourse.julialang.org/u/mabuwu)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 11:45am UTC](https://discourse.julialang.org/t/github-actions-ci-using-pycall-and-a-local-github-python-package/82191 "2022-06-06T11:45:20Z")

</div>

I’ve built a Julia package that uses a python package imported via PyCall. The python package is only available via GitHub, it’s not available via pip or Conda. Locally, this works fine. I can simply install the packag…

---

## [Type-stability with an elastic array in a struct](https://discourse.julialang.org/t/type-stability-with-an-elastic-array-in-a-struct/82298)

<div class="topic-metadata">

**Author:** [@james3](https://discourse.julialang.org/u/james3)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 10:40am UTC](https://discourse.julialang.org/t/type-stability-with-an-elastic-array-in-a-struct/82298 "2022-06-06T10:40:19Z")

</div>

I have defined a struct that contains an elastic array, similar to the following. struct MyStruct myelas::ElasticMatrix{Int64} end However, @code\_warntype shows the following is not type-stable. function test\_st…

---

## [What does #undef mean?](https://discourse.julialang.org/t/what-does-undef-mean/82031)

<div class="topic-metadata">

**Author:** [@acsofie](https://discourse.julialang.org/u/acsofie)\
**Replies:** 17\
**Last updated:** [June 6, 2022, 10:08am UTC](https://discourse.julialang.org/t/what-does-undef-mean/82031 "2022-06-06T10:08:48Z")

</div>

try to use julia\> Dict(:x=\>1,2=\>3,0=\>1).keys 16-element Vector{Any}: 0 #undef #undef #undef 2 #undef #undef #undef #undef #undef #undef #undef #undef #undef #undef :x julia\> typeof(ans) Vector{An…

---

## [What is the difference between two codes?](https://discourse.julialang.org/t/what-is-the-difference-between-two-codes/82287)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 5\
**Last updated:** [June 6, 2022, 7:55am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-two-codes/82287 "2022-06-06T07:55:27Z")

</div>

Dear all, Here are two kinds of codes, In the first one, I use global ,and the other one not use global, What is the difference between them? julia\> i = 1 1 julia\> while i \< 5 println(i) global i…

---

## [Question about reduce?](https://discourse.julialang.org/t/question-about-reduce/82290)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 3\
**Last updated:** [June 6, 2022, 2:47am UTC](https://discourse.julialang.org/t/question-about-reduce/82290 "2022-06-06T02:47:21Z")

</div>

What’s wrong with this? julia\> reduce(\*, 1:100) 0

---

## [Separating/ Filtering data of multiple waveforms](https://discourse.julialang.org/t/separating-filtering-data-of-multiple-waveforms/82151)

<div class="topic-metadata">

**Author:** [@wiseac](https://discourse.julialang.org/u/wiseac)\
**Replies:** 11\
**Last updated:** [June 5, 2022, 10:01pm UTC](https://discourse.julialang.org/t/separating-filtering-data-of-multiple-waveforms/82151 "2022-06-05T22:01:26Z")

</div>

Hello, I have a waveform(s) that i’m trying to separate out into individual max-fall-min for each set. This is what it looks like. (Without time added) The data comes in a one dimensional array (Voltage) then i add a…

---

## [Building julia with \`march=native\`](https://discourse.julialang.org/t/building-julia-with-march-native/82256)

<div class="topic-metadata">

**Author:** [@sobhan](https://discourse.julialang.org/u/sobhan)\
**Replies:** 15\
**Last updated:** [June 5, 2022, 8:51pm UTC](https://discourse.julialang.org/t/building-julia-with-march-native/82256 "2022-06-05T20:51:50Z")

</div>

I decided to build julia from source and was thinking of setting march=native in a futile hope of getting a speed up. After reading through some of the docs, i decided to use the following user.make ARCH=x86\_64 MARCH=na…

---

## [Difference between StructArrays and TypedTables](https://discourse.julialang.org/t/difference-between-structarrays-and-typedtables/82207)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 4\
**Last updated:** [June 5, 2022, 5:29pm UTC](https://discourse.julialang.org/t/difference-between-structarrays-and-typedtables/82207 "2022-06-05T17:29:35Z")

</div>

Curious if anyone sees any major differences in practical usage for these packages. StructArrays can use struct of arrays or array of structs approach. TypedTables uses namedtuple of arrays and constructs the array of …

---

## [Add a property to a StructArray](https://discourse.julialang.org/t/add-a-property-to-a-structarray/74450)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [June 5, 2022, 2:01pm UTC](https://discourse.julialang.org/t/add-a-property-to-a-structarray/74450 "2022-06-05T14:01:49Z")

</div>

Is it possible to add a property to a StructArray? The following code fails: julia\> using KiteUtils, StructArrays julia\> syslog=demo\_syslog(7) julia\> function Base.getproperty(st::StructArray{SysState}, sym::Symbol) …

---

## [Upgrading Julia for GMT.jl users](https://discourse.julialang.org/t/upgrading-julia-for-gmt-jl-users/82223)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 6\
**Last updated:** [June 5, 2022, 1:10pm UTC](https://discourse.julialang.org/t/upgrading-julia-for-gmt-jl-users/82223 "2022-06-05T13:10:26Z")

</div>

What is the best way to upgrade Julia when you have the GMT.jl package installed? I’m on Mac OS (Intel Processor). It happened a few times that after upgrading to a newer version of Julia, I can no longer use my GMT.jl.…

---

## ['Parallel' Feature in Flux works with '+' but not '\*'](https://discourse.julialang.org/t/parallel-feature-in-flux-works-with-but-not/82264)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 3\
**Last updated:** [June 5, 2022, 10:38am UTC](https://discourse.julialang.org/t/parallel-feature-in-flux-works-with-but-not/82264 "2022-06-05T10:38:39Z")

</div>

The ‘Parallel’ feature for defining network architectures in Flux is very handy and includes the ‘vcat’ and ‘+’ operations. I tried the ‘\*’ (multiplication) operator but it didn’t work for me. Or is there a way to get …

---

## [Fuzzy testing](https://discourse.julialang.org/t/fuzzy-testing/82266)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 0\
**Last updated:** [June 5, 2022, 10:11am UTC](https://discourse.julialang.org/t/fuzzy-testing/82266 "2022-06-05T10:11:40Z")

</div>

Hi all :slight\_smile: Quick question: is there a good fuzzy testing pkg? What are the experiences? Cheers

---

## [Decoding protobuf message from mapbox API, using ProtoBuf.jl](https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261)

<div class="topic-metadata">

**Author:** [@captchanjack1](https://discourse.julialang.org/u/captchanjack1)\
**Replies:** 1\
**Last updated:** [June 5, 2022, 8:34am UTC](https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261 "2022-06-05T08:34:35Z")

</div>

Hi, I’m new to the world of protocol buffers, looking for some guidance here. I have a fairly simple use case which is to decode protobuf messages from the mapbox API into GeoJSON format. How would I approach this pro…

---

## [Question about loop?](https://discourse.julialang.org/t/question-about-loop/82251)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 6\
**Last updated:** [June 4, 2022, 11:51pm UTC](https://discourse.julialang.org/t/question-about-loop/82251 "2022-06-04T23:51:32Z")

</div>

Dear all, I want to generate x1,x2,…x10, How can I write the code? julia\> for i in 1:10 x$i = i end I want to generate x1 = 1, x2 = 2...

---

## [How to type this circle in Julia?](https://discourse.julialang.org/t/how-to-type-this-circle-in-julia/82254)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 1\
**Last updated:** [June 4, 2022, 11:23pm UTC](https://discourse.julialang.org/t/how-to-type-this-circle-in-julia/82254 "2022-06-04T23:23:38Z")

</div>

Dear all, How to type the circle below? plot((plot() for i in 1:7)..., layout=@layout(\[\_ ° \_; ° ° °; ° ° °\])) I try to type \\circ\[TAB\], but it’ not the same circle.

---

## [How to use the macro @label and @goto](https://discourse.julialang.org/t/how-to-use-the-macro-label-and-goto/82247)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 7\
**Last updated:** [June 4, 2022, 11:20pm UTC](https://discourse.julialang.org/t/how-to-use-the-macro-label-and-goto/82247 "2022-06-04T23:20:43Z")

</div>

Dear all, I want to know how to use @label and @goto. Can you give me an example to use them? Many thanks.

---

## [I think LLVM can do better here](https://discourse.julialang.org/t/i-think-llvm-can-do-better-here/82213)

<div class="topic-metadata">

**Author:** [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Replies:** 4\
**Last updated:** [June 4, 2022, 6:05pm UTC](https://discourse.julialang.org/t/i-think-llvm-can-do-better-here/82213 "2022-06-04T18:05:01Z")

</div>

This an LLVM question that came up in the process of trying to make min/max faster. In that discussion, this other PR was brought up where @N5N3 suggests the following implementation for min: function \_\_min(x, y) di…

---

## [Findnearest function?](https://discourse.julialang.org/t/findnearest-function/4143)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 20\
**Last updated:** [June 4, 2022, 3:58pm UTC](https://discourse.julialang.org/t/findnearest-function/4143 "2022-06-04T15:58:29Z")

</div>

Is there a simple findnearest() function somewhere in Julia-land? A = \[1, 5, 12, 23\]; findnearest(A, 14) # -\> 3 findnearest(A, 18) # -\> 4

---

## [Passing a Julia function to C and then calling from C code](https://discourse.julialang.org/t/passing-a-julia-function-to-c-and-then-calling-from-c-code/82217)

<div class="topic-metadata">

**Author:** [@Fadi\_Hamad](https://discourse.julialang.org/u/Fadi_Hamad)\
**Replies:** 3\
**Last updated:** [June 4, 2022, 12:52pm UTC](https://discourse.julialang.org/t/passing-a-julia-function-to-c-and-then-calling-from-c-code/82217 "2022-06-04T12:52:30Z")

</div>

Hello, I am trying to pass a Julia function to a some C code and then call that Julia function from within my C code. I followed the instruction from the section https://docs.julialang.org/en/v1/manual/calling-c-and-for…

---

## [Create new column in dataframe based on list](https://discourse.julialang.org/t/create-new-column-in-dataframe-based-on-list/77483)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 5\
**Last updated:** [June 4, 2022, 12:32pm UTC](https://discourse.julialang.org/t/create-new-column-in-dataframe-based-on-list/77483 "2022-06-04T12:32:29Z")

</div>

Hello, I’m trying to figure out how to create a 0,1 valued column in a dataframe based on comparing a dataframe column with a list. Here is an example data = DataFrame(:index =\> String\[\], :values =\> Int64\[\]) push!(da…

---

## [Symbolics function](https://discourse.julialang.org/t/symbolics-function/82226)

<div class="topic-metadata">

**Author:** [@jerry\_ji](https://discourse.julialang.org/u/jerry_ji)\
**Replies:** 1\
**Last updated:** [June 4, 2022, 11:59am UTC](https://discourse.julialang.org/t/symbolics-function/82226 "2022-06-04T11:59:53Z")

</div>

Hi I trying to building an function with Symbolics.jl package, instead of output an Vector{Bool}, folloing code output an Vector{SymbolicUtils.Term{Bool, Nothing}}. using Symbolics N=12 @variables t c\[1:N\] Γ(t,c) Γ=…

---

## [Array broadcasting slower than numpy?](https://discourse.julialang.org/t/array-broadcasting-slower-than-numpy/82212)

<div class="topic-metadata">

**Author:** [@chunjiw](https://discourse.julialang.org/u/chunjiw)\
**Replies:** 20\
**Last updated:** [June 4, 2022, 7:22am UTC](https://discourse.julialang.org/t/array-broadcasting-slower-than-numpy/82212 "2022-06-04T07:22:03Z")

</div>

@time let m = 10^7 + 19 v = fill(0, m) w = copy(v) for \_ in 1:100 i = mod(rand(Int), m) v\[1:i\] .+= @view w\[end-i+1:end\] v\[i+1:end\] .+= @view w\[1:end-i\] end end import time import numpy as np import random t0 …

---

## [What is the difference between copy and deepcopy?](https://discourse.julialang.org/t/what-is-the-difference-between-copy-and-deepcopy/82149)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 21\
**Last updated:** [June 4, 2022, 3:36am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-copy-and-deepcopy/82149 "2022-06-04T03:36:20Z")

</div>

Dear all, I want to know the difference between copy and deepcopy? Many thanks.

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

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