Skip to content

Instantly share code, notes, and snippets.

@genkuroki
Created July 5, 2020 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genkuroki/ecb6e711877ce266408b5c51a0f76109 to your computer and use it in GitHub Desktop.
Save genkuroki/ecb6e711877ce266408b5c51a0f76109 to your computer and use it in GitHub Desktop.
= and .=
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "@show A = zeros(4)\n@show B = Float64[1, 2, 3, 4]\n\nA .= B\n\n@show A\n\nA[2] = 20\n@show A\n@show B;",
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": "A = zeros(4) = [0.0, 0.0, 0.0, 0.0]\nB = Float64[1, 2, 3, 4] = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 20.0, 3.0, 4.0]\nB = [1.0, 2.0, 3.0, 4.0]\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "@show A = zeros(4)\n@show B = Float64[1, 2, 3, 4]\n\nA = B\n\n@show A\n\nA[2] = 20\n@show A\n@show B;",
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": "A = zeros(4) = [0.0, 0.0, 0.0, 0.0]\nB = Float64[1, 2, 3, 4] = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 20.0, 3.0, 4.0]\nB = [1.0, 20.0, 3.0, 4.0]\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "@show A = zeros(4)\n@show B = Float64[1, 2, 3, 4]\n\nA = copy(B)\n\n@show A\n\nA[2] = 20\n@show A\n@show B;",
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": "A = zeros(4) = [0.0, 0.0, 0.0, 0.0]\nB = Float64[1, 2, 3, 4] = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 2.0, 3.0, 4.0]\nA = [1.0, 20.0, 3.0, 4.0]\nB = [1.0, 2.0, 3.0, 4.0]\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "julia-1.4",
"display_name": "Julia 1.4.2",
"language": "julia"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"base_numbering": 1,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.4.2"
},
"@webio": {
"lastKernelId": null,
"lastCommId": null
},
"gist": {
"id": "ecb6e711877ce266408b5c51a0f76109",
"data": {
"description": "= and .=",
"public": true
}
},
"_draft": {
"nbviewer_url": "https://gist.github.com/ecb6e711877ce266408b5c51a0f76109"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment