Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save genkuroki/c7c4f41124b10b4e882de23030dac7ed to your computer and use it in GitHub Desktop.
Save genkuroki/c7c4f41124b10b4e882de23030dac7ed to your computer and use it in GitHub Desktop.
0-dimensional (i.e. length-0) Vector and 0x0 Matrix
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "VERSION",
"execution_count": 1,
"outputs": [
{
"data": {
"text/plain": "v\"1.7.0-DEV.1049\""
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "v = zeros(0)",
"execution_count": 2,
"outputs": [
{
"data": {
"text/plain": "Float64[]"
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "v + v",
"execution_count": 3,
"outputs": [
{
"data": {
"text/plain": "Float64[]"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "3v",
"execution_count": 4,
"outputs": [
{
"data": {
"text/plain": "Float64[]"
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "A = zeros(0, 0)",
"execution_count": 5,
"outputs": [
{
"data": {
"text/plain": "0×0 Matrix{Float64}"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "A*v",
"execution_count": 6,
"outputs": [
{
"data": {
"text/plain": "Float64[]"
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "B = zeros(3, 0)",
"execution_count": 7,
"outputs": [
{
"data": {
"text/plain": "3×0 Matrix{Float64}"
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"cell_type": "code",
"source": "B*v",
"execution_count": 8,
"outputs": [
{
"data": {
"text/plain": "3-element Vector{Float64}:\n 0.0\n 0.0\n 0.0"
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "v = zeros(0)",
"execution_count": 1,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 1,
"data": {
"text/plain": "Float64[]"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "v'v",
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 2,
"data": {
"text/plain": "0.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "using LinearAlgebra\ndot(v, v)",
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 3,
"data": {
"text/plain": "0.0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "w = Int64[]",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 4,
"data": {
"text/plain": "Int64[]"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "w'w",
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 5,
"data": {
"text/plain": "0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "dot(w, w)",
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 6,
"data": {
"text/plain": "0"
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"_draft": {
"nbviewer_url": "https://gist.github.com/c7c4f41124b10b4e882de23030dac7ed"
},
"gist": {
"id": "c7c4f41124b10b4e882de23030dac7ed",
"data": {
"description": "0-dimensional (i.e. length-0) Vector and 0x0 Matrix",
"public": true
}
},
"kernelspec": {
"name": "julia-1.7-depwarn-o3",
"display_name": "Julia 1.7.0-DEV depwarn -O3",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.7.0"
},
"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
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment