# General Usage

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

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

**Page:** 417

---

## [Higher order SVD in Julia like Numpy?](https://discourse.julialang.org/t/higher-order-svd-in-julia-like-numpy/85025)

<div class="topic-metadata">

**Author:** [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Replies:** 2\
**Last updated:** [July 30, 2022, 12:07pm UTC](https://discourse.julialang.org/t/higher-order-svd-in-julia-like-numpy/85025 "2022-07-30T12:07:41Z")

</div>

Hello all I was wondering if there is any way to do higher order SVD in Julia using LinearAlgebra.jl like you can using numpy.linalg.svd or should I just use PyCall? I tried with LinearAlgebra.svd but it didn’t work out…

---

## [Run commands on externally running process](https://discourse.julialang.org/t/run-commands-on-externally-running-process/85026)

<div class="topic-metadata">

**Author:** [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Replies:** 1\
**Last updated:** [July 30, 2022, 2:00pm UTC](https://discourse.julialang.org/t/run-commands-on-externally-running-process/85026 "2022-07-30T14:00:33Z")

</div>

I want to run one command to open a program. Then do a second command in this program. For instance in the below case the first line opens a psql session and the second should insert some data via a csv file. line1 = \`…

---

## [How to append 3 dimension array( matrix) for example in MATLAB M(:,:,i) = b](https://discourse.julialang.org/t/how-to-append-3-dimension-array-matrix-for-example-in-matlab-m-i-b/85005)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 5\
**Last updated:** [July 30, 2022, 9:54am UTC](https://discourse.julialang.org/t/how-to-append-3-dimension-array-matrix-for-example-in-matlab-m-i-b/85005 "2022-07-30T09:54:27Z")

</div>

How to append 3 dimension array( matrix) for example in MATLAB M(:,:,i) = b. and i don’t know how far ‘i’ will go. so please give solution for initial matrix is blank rather than zeros. Thank You.

---

## [How to train the lstm model more than one epoch](https://discourse.julialang.org/t/how-to-train-the-lstm-model-more-than-one-epoch/84973)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 10\
**Last updated:** [July 30, 2022, 9:29am UTC](https://discourse.julialang.org/t/how-to-train-the-lstm-model-more-than-one-epoch/84973 "2022-07-30T09:29:31Z")

</div>

Here is an example in one epoch. How can I realize training the model in 10 epochs. using Flux using CUDA X\_train = rand(60000, 4) Y\_train = rand(60000, 1) seq\_len = 600 batch\_size = 10 no\_features = 4 N = size(X\_tra…

---

## [How to access the element of this type of vector](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 2\
**Last updated:** [July 30, 2022, 6:50am UTC](https://discourse.julialang.org/t/how-to-access-the-element-of-this-type-of-vector/85010 "2022-07-30T06:50:51Z")

</div>

I want to access all the 2nd element of this vector. exp 1.5588154785672663 , 1.5588154785672663,1.5588154785672663. … how without for loop?

---

## [Any way to accelerate the creation of shared library?](https://discourse.julialang.org/t/any-way-to-accelerate-the-creation-of-shared-library/85013)

<div class="topic-metadata">

**Author:** [@lionisxn](https://discourse.julialang.org/u/lionisxn)\
**Replies:** 2\
**Last updated:** [July 30, 2022, 1:13am UTC](https://discourse.julialang.org/t/any-way-to-accelerate-the-creation-of-shared-library/85013 "2022-07-30T01:13:08Z")

</div>

I recently work on shared libraries created by “PackageCompiler.create\_library”. I noticed that every complete creation lasts 6 min to 10 min or so. I wonder whether there is a way to accelerate a new creation based on a…

---

## [Slow permutations?](https://discourse.julialang.org/t/slow-permutations/39427)

<div class="topic-metadata">

**Author:** [@natemcintosh](https://discourse.julialang.org/u/natemcintosh)\
**Replies:** 6\
**Last updated:** [July 29, 2022, 7:56pm UTC](https://discourse.julialang.org/t/slow-permutations/39427 "2022-07-29T19:56:57Z")

</div>

I have a an array of strings, of length ~2,000. I would like to produce all permutations of lengths 1 to n (n is always going to be less than or equal to 2). The problem: this is taking much longer than I think it shoul…

---

## [More problems trying to add packages from private repos](https://discourse.julialang.org/t/more-problems-trying-to-add-packages-from-private-repos/69059)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 20\
**Last updated:** [July 29, 2022, 7:27pm UTC](https://discourse.julialang.org/t/more-problems-trying-to-add-packages-from-private-repos/69059 "2022-07-29T19:27:29Z")

</div>

There have been many threads about the difficulties of using private repositories with Pkg. Here’s one, which contains links to various other threads: At some point in the past I managed to get things working somehow,…

---

## [Array of functions behaves differently when it is of length 1 vs longer](https://discourse.julialang.org/t/array-of-functions-behaves-differently-when-it-is-of-length-1-vs-longer/84996)

<div class="topic-metadata">

**Author:** [@alexpkeil1](https://discourse.julialang.org/u/alexpkeil1)\
**Replies:** 3\
**Last updated:** [July 29, 2022, 7:40pm UTC](https://discourse.julialang.org/t/array-of-functions-behaves-differently-when-it-is-of-length-1-vs-longer/84996 "2022-07-29T19:40:37Z")

</div>

I want to do something where I can call different functions on the same value, and that number of functions varies depending on how I use it. I’ve been using an array of functions to accomplish this, but I am getting an …

---

## [Optim interface.jl type instability and efficient exception handling](https://discourse.julialang.org/t/optim-interface-jl-type-instability-and-efficient-exception-handling/84972)

<div class="topic-metadata">

**Author:** [@psterzinger](https://discourse.julialang.org/u/psterzinger)\
**Replies:** 0\
**Last updated:** [July 29, 2022, 11:32am UTC](https://discourse.julialang.org/t/optim-interface-jl-type-instability-and-efficient-exception-handling/84972 "2022-07-29T11:32:29Z")

</div>

Hi, I am currently trying to optimize a simulation that involves repeated parameter estimation, which I do with Optim.jl’s optimize with supplied gradients and hessians. interjace.jl type instability Looking at the fl…

---

## [Julia call c++, could not load symbol](https://discourse.julialang.org/t/julia-call-c-could-not-load-symbol/84980)

<div class="topic-metadata">

**Author:** [@kongdd](https://discourse.julialang.org/u/kongdd)\
**Replies:** 2\
**Last updated:** [July 29, 2022, 3:16pm UTC](https://discourse.julialang.org/t/julia-call-c-could-not-load-symbol/84980 "2022-07-29T15:16:41Z")

</div>

In the debug.cpp: #include \<stdio.h\> // g++ -shared -fPIC -o debug.so debug.cpp void show(int \*a) { for (int i = 0; i \< 10; i++) { printf("a\[%d\] = %d\\n", i, a\[i\]); } } void hello() { printf("hello …

---

## [Bounds Error?](https://discourse.julialang.org/t/bounds-error/84953)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 4\
**Last updated:** [July 29, 2022, 2:41pm UTC](https://discourse.julialang.org/t/bounds-error/84953 "2022-07-29T14:41:38Z")

</div>

I am trying to run the following code: u\_vect = rand(5,2) for i in eachindex(u\_vect) println(i) a = u\_vect\[i,2\] end And get the error: “BoundsError: attempt to access 5×2 Matrix{Float64} at index \[6, 2\].” W…

---

## [Tuple to array](https://discourse.julialang.org/t/tuple-to-array/84944)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 3\
**Last updated:** [July 29, 2022, 2:29pm UTC](https://discourse.julialang.org/t/tuple-to-array/84944 "2022-07-29T14:29:11Z")

</div>

output is one element tuple vector. I can’t access the elements of that output. so, how to convert output to a 3x1 matrix. Thank You

---

## [Two CuDeviceArrays inside one kernel](https://discourse.julialang.org/t/two-cudevicearrays-inside-one-kernel/84977)

<div class="topic-metadata">

**Author:** [@Shirakumo](https://discourse.julialang.org/u/Shirakumo)\
**Replies:** 0\
**Last updated:** [July 29, 2022, 1:03pm UTC](https://discourse.julialang.org/t/two-cudevicearrays-inside-one-kernel/84977 "2022-07-29T13:03:53Z")

</div>

Hello everyone, I was wondering if I can achieve something like this: function test(output, output2, input) # Set up shared memory cache for this current block. cache1 = @cuDynamicSharedMem(Int64, (10,10,3)) …

---

## [Compound dataframe filtering with negated boolean expression](https://discourse.julialang.org/t/compound-dataframe-filtering-with-negated-boolean-expression/24877)

<div class="topic-metadata">

**Author:** [@notpeerreviewed](https://discourse.julialang.org/u/notpeerreviewed)\
**Replies:** 5\
**Last updated:** [July 29, 2022, 12:50pm UTC](https://discourse.julialang.org/t/compound-dataframe-filtering-with-negated-boolean-expression/24877 "2022-07-29T12:50:47Z")

</div>

I’m trying to reproduce a compound filter but it involves negation of a two part specification. I’d normally do something like this in R, using dplyr filter(!(Fuel == "Gas" & Field == "Maari")) In simple terms, I want…

---

## [How to round whole matrix like numpy.round()](https://discourse.julialang.org/t/how-to-round-whole-matrix-like-numpy-round/84897)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 8\
**Last updated:** [July 29, 2022, 12:13pm UTC](https://discourse.julialang.org/t/how-to-round-whole-matrix-like-numpy-round/84897 "2022-07-29T12:13:42Z")

</div>

how to round whole matrix like numpy.round() how to round SymPy Matrix in julia SymPy pakage

---

## [Some questions for LSTM](https://discourse.julialang.org/t/some-questions-for-lstm/84907)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 6\
**Last updated:** [July 29, 2022, 11:44am UTC](https://discourse.julialang.org/t/some-questions-for-lstm/84907 "2022-07-29T11:44:49Z")

</div>

I am trying to do batch training using LSTM for a time series data with multiple features. Assuming I have 5000 samples and 5 features for each sample. The input uses 14 days into the past and the output is a single val…

---

## [Global struct defined in some local scopes / what \*is\* top level?](https://discourse.julialang.org/t/global-struct-defined-in-some-local-scopes-what-is-top-level/84943)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 5\
**Last updated:** [July 29, 2022, 11:18am UTC](https://discourse.julialang.org/t/global-struct-defined-in-some-local-scopes-what-is-top-level/84943 "2022-07-29T11:18:03Z")

</div>

Struct definitions nested in macros or methods throw an error explaining they need to be at top level. Top level is generally explained as the module’s global scope, but it’s evidently not (example below). Furthermore, t…

---

## [Metaprogramming: Nested function variable interpolation](https://discourse.julialang.org/t/metaprogramming-nested-function-variable-interpolation/84940)

<div class="topic-metadata">

**Author:** [@RXGottlieb](https://discourse.julialang.org/u/RXGottlieb)\
**Replies:** 1\
**Last updated:** [July 29, 2022, 10:15am UTC](https://discourse.julialang.org/t/metaprogramming-nested-function-variable-interpolation/84940 "2022-07-29T10:15:52Z")

</div>

Hello, I’m working on a piece of code that generates a math expression with embedded variables, and I want to generate a function that will take those variables as inputs and evaluate the math expression using the given…

---

## [How to change datatype like MATLAB](https://discourse.julialang.org/t/how-to-change-datatype-like-matlab/84946)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 5\
**Last updated:** [July 29, 2022, 9:29am UTC](https://discourse.julialang.org/t/how-to-change-datatype-like-matlab/84946 "2022-07-29T09:29:46Z")

</div>

in matlab we can change datatype by double(22/7), is there any method in julia. Thank You

---

## [Metaprogramming: Obtain actual type from Symbol for field inheritance](https://discourse.julialang.org/t/metaprogramming-obtain-actual-type-from-symbol-for-field-inheritance/84912)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 15\
**Last updated:** [July 29, 2022, 8:55am UTC](https://discourse.julialang.org/t/metaprogramming-obtain-actual-type-from-symbol-for-field-inheritance/84912 "2022-07-29T08:55:22Z")

</div>

Hello, I admit, having read How to get the type of a symbol in a macro? I realize that this may be harder than I thought, but perhaps if I describe what I want to achieve, a solution can be made for this specific case. …

---

## [Scipy.optimize.curve\_fit(): "ValueError("\`x0\` is infeasible.")"](https://discourse.julialang.org/t/scipy-optimize-curve-fit-valueerror-x0-is-infeasible/84958)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 0\
**Last updated:** [July 29, 2022, 6:19am UTC](https://discourse.julialang.org/t/scipy-optimize-curve-fit-valueerror-x0-is-infeasible/84958 "2022-07-29T06:19:52Z")

</div>

Yesterday I struggled with the error message: "ValueError("x0 is infeasible.")" of the function scipy.optimize.curve\_fit(), this is my contribution for others that start to work with this well tested method. If you wor…

---

## [Should Julia model audio data like it models image data: with an easy conversion between a matrix and its corresponding media file?](https://discourse.julialang.org/t/should-julia-model-audio-data-like-it-models-image-data-with-an-easy-conversion-between-a-matrix-and-its-corresponding-media-file/84941)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 0\
**Last updated:** [July 28, 2022, 9:49pm UTC](https://discourse.julialang.org/t/should-julia-model-audio-data-like-it-models-image-data-with-an-easy-conversion-between-a-matrix-and-its-corresponding-media-file/84941 "2022-07-28T21:49:25Z")

</div>

I am using Julia to create a video entry into the Summer of Math Exposition II competition and I wanted to see how difficult it would be to automate all the video editing tasks with Julia and ffmpeg instead of spending h…

---

## [Manually create legend in Plots.jl](https://discourse.julialang.org/t/manually-create-legend-in-plots-jl/84925)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [July 28, 2022, 11:39pm UTC](https://discourse.julialang.org/t/manually-create-legend-in-plots-jl/84925 "2022-07-28T23:39:39Z")

</div>

Hi all, I have a plot with a gradient build from a large series of subplots. I would like to manually add a legend independent of the underlying series data. The legend might show a colored line paired with a label: (b…

---

## [Very strange language choice for printing integer vs float arrays](https://discourse.julialang.org/t/very-strange-language-choice-for-printing-integer-vs-float-arrays/84945)

<div class="topic-metadata">

**Author:** [@singularity](https://discourse.julialang.org/u/singularity)\
**Replies:** 2\
**Last updated:** [July 28, 2022, 10:19pm UTC](https://discourse.julialang.org/t/very-strange-language-choice-for-printing-integer-vs-float-arrays/84945 "2022-07-28T22:19:38Z")

</div>

I find the following behavior of print statement quite strange. Let’s say I have an array of floating point numbers and I print it. That is, a = \[2.0, 3.0\] println(a) I get the following result upon executing the code…

---

## [Accessing the docstring from within a macro, @\_\_doc\_\_ troubles](https://discourse.julialang.org/t/accessing-the-docstring-from-within-a-macro-doc-troubles/84937)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 0\
**Last updated:** [July 28, 2022, 8:32pm UTC](https://discourse.julialang.org/t/accessing-the-docstring-from-within-a-macro-doc-troubles/84937 "2022-07-28T20:32:34Z")

</div>

I’d like to have a wrapper for a function, which contains its docstring. This works: julia\> struct MyWrapper f docstring end julia\> macro wrap(fdef) fname = fdef.args\[1\].args\[1\] …

---

## [Is there such a thing like a pushcopy!(...)?](https://discourse.julialang.org/t/is-there-such-a-thing-like-a-pushcopy/84930)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 5\
**Last updated:** [July 28, 2022, 6:41pm UTC](https://discourse.julialang.org/t/is-there-such-a-thing-like-a-pushcopy/84930 "2022-07-28T18:41:07Z")

</div>

Hi, I was wondering if there’s an option or a function in base that pushes a copy rather than a reference into a collection, similarly to what pushcopy!(collection::AbstractVector, item::AbstractArray) = push!(collecti…

---

## [Infiltrator and Revise](https://discourse.julialang.org/t/infiltrator-and-revise/83539)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 1\
**Last updated:** [July 28, 2022, 4:12pm UTC](https://discourse.julialang.org/t/infiltrator-and-revise/83539 "2022-07-28T16:12:08Z")

</div>

Hello, I am currently debugging some functions in a package I am writing for myself. I do the actual code writing in VSCode but I have a REPL open with the package loaded (using MyPackage) as well as Infiltrator.jl. The…

---

## [Any One Know of A Julia Serverless Function/App Provider?](https://discourse.julialang.org/t/any-one-know-of-a-julia-serverless-function-app-provider/74072)

<div class="topic-metadata">

**Author:** [@Joe\_Schnetzler](https://discourse.julialang.org/u/Joe_Schnetzler)\
**Replies:** 2\
**Last updated:** [July 28, 2022, 3:00pm UTC](https://discourse.julialang.org/t/any-one-know-of-a-julia-serverless-function-app-provider/74072 "2022-07-28T15:00:34Z")

</div>

Hello Julia Devs! Does anyone know of really easy Julia Serverless Function providers and/or app providers (Genie.jl)? If not, anyone interested in helping me build one? Maybe using open-faas? Thinking something as simp…

---

## [Can't get sortperm to return the sorting order of columns of a matrix](https://discourse.julialang.org/t/cant-get-sortperm-to-return-the-sorting-order-of-columns-of-a-matrix/84081)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 11\
**Last updated:** [July 16, 2022, 11:27am UTC](https://discourse.julialang.org/t/cant-get-sortperm-to-return-the-sorting-order-of-columns-of-a-matrix/84081 "2022-07-16T11:27:38Z")

</div>

I’m sorting the columns of each matrix in long vector of matrices (having the matrix columns in a canonical order makes it easy to identify approximately equal matrices). Here’s a minimal working example: julia\> t 3×2 t…

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

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