I want to absorb the difference between the for statement on the Python + numpy matrix and the Julia for statement

When I'm using Python + Numpy and when I'm using Julia, I've written a recent problem that often results in bad code (or rather doesn't work). Can anyone please give me a good idea?

For Python + numpy

--Tried with Anaconda 4.3.0 (64-bit), Python 3.6.0, IPython 5.1.0

import numpy as np
X = np.array([[1, 2, 3], [4, 5, 6]])
# X = np.matrix([[1, 2, 3], [4, 5, 6]])But about the same

for elem in X: print(elem)
#output
# [1 2 3](In the case of matrix[[1 2 3]])
# [4 5 6](In the case of matrix[[4 5 6]])

――I'm used to it, so I want you to do this.

For Julia

--I tried it with Julia 0.5.0

X = [1 2 3; 4 5 6]
#output
# 2x3 Array{Int64, 2}:
#  1 2 3
#  4 5 6

for elem in X; println(elem); end
#output
# 1
# 4
# 2
# 5
# 3
# 6

――Personally, this iteration is not very intuitive (it can be called Python / Numpy brain), so I want to do something about it. --Originally Julia has a slow iteration of either Row or Column (I don't know the details) --Mass production of the following code with a feeling of dying

X = [1 2 3; 4 5 6]
m, n = size(X)
for i=1:m; println(X[i, :]); end
#output

――It works for the time being --Unpleasant reason: Mood

What I looked up

There are various discussions (although it is not old).

Recommended Posts

I want to absorb the difference between the for statement on the Python + numpy matrix and the Julia for statement
I just want to find the 95% confidence interval for the difference in population ratios in Python
[Python] I want to get a common set between numpy
I didn't know how to use the [python] for statement
I want to know the features of Python and pip
I tried to enumerate the differences between java and python
Difference in how to write if statement between ruby ​​and python
I tried to find out the difference between A + = B and A = A + B in Python, so make a note
[Python] Comprehension notation. Write a for statement simply. (A collection is the difference between an iterator and an iterator)
[Introduction to Python] What is the difference between a list and a tuple?
I want to separate the processing between test time and production environment
I want to format and check Python code to my liking on VS Code
About the difference between "==" and "is" in python
I want to display the progress in Python!
I want to use Python in the environment of pyenv + pipenv on Windows 10
I want to get the file name, line number, and function name in Python 3.4
I tried Python on Mac for the first time.
I want to handle optimization with python and cplex
I want to inherit to the back with python dataclass
I want to write in Python! (3) Utilize the mock
I want to AWS Lambda with Python on Mac!
How to use argparse and the difference between optparse
I want to use the R dataset in python
[Python] I want to use only index when looping a list with a for statement
[TensorFlow] I want to master the indexing for Ragged Tensor
I want to initialize if the value is empty (python)
I installed the retro game engine pyxel for Python on Mac and started the sample code
maya Python I want to fix the baked animation again.
I want to move selenium for the time being [for mac]
Understand the difference between cumulative assignment to variables and cumulative assignment to objects
[Introduction to Udemy Python3 + Application] 42. for statement, break statement, and continue statement
To go back and forth between standard python, numpy, pandas ①
I want to change the Japanese flag to the Palau flag with Numpy
[Python] I want to use the -h option with argparse
I want to judge the authenticity of the elements of numpy array
I want to use the Ubuntu desktop environment on Android for the time being (Termux version)
I want to use Ubuntu's desktop environment on Android for the time being (UserLAnd version)
I want to map the EDINET code and securities number
I want to align the significant figures in the Numpy array
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
[Python] I want to be a gourmet person [Data Driven approach] Choosing a store for the year-end and New Year holidays
I want to create a Dockerfile for the time being.
Performance comparison between 2D matrix calculation and for with numpy
I want to create a histogram and overlay the normal distribution curve on it. matplotlib edition
I don't really understand the difference between modules, packages and libraries, so I tried to organize them.
I want to clear up the question of the "__init__" method and the "self" argument of a Python class.
I want to record the execution time and keep a log.
I want to know the weather with LINE bot feat.Heroku + Python
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
[Introduction to Python] I compared the naming conventions of C # and Python.
I want to output the beginning of the next month with Python
I want to know if you install Python on Mac ・ Iroha
I want to run the Python GUI when starting Raspberry Pi
[Introduction to Python] How to use the in operator in a for statement?
I want to use both key and value of Python iterator
I want to connect remotely to another computer, and the nautilus command
For the time being, I want to convert files with ffmpeg !!
The road to installing Python and Flask on an offline PC
I investigated the behavior of the difference between hard links and symbolic links
Python / Numpy> Link> Difference between numpy.random and random.random> thread-safe or not
Difference between Ruby and Python split