Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimum dimension of an array in Julia

Tags:

arrays

julia

Let us consider an array which could be given by AA = [1] or by AA= [1 2]. Thus, we don't know beforehand its dimensions.

We can extract the minimum dimension in Matlab using:

min(size(AA))

What commands should I use in Julia? A similar approach would lead to an error:

m,n=size(AA,1),size(AA,2)

minimum(m,n)

it seems that Julia computes the minimum of a collection and it would not see (m,n) as a collection.

like image 931
user3510226 Avatar asked Dec 29 '25 12:12

user3510226


1 Answers

Doing

minimum(size(A))

just works.

size(A) returns a tuple which is seen as a collection. To get the minimum of several arguments one can use min(m,n).

like image 61
Cristóvão D. Sousa Avatar answered Jan 01 '26 22:01

Cristóvão D. Sousa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!