Skip to content

Instantly share code, notes, and snippets.

@goropikari
Created September 3, 2018 11:46
Show Gist options
  • Save goropikari/23eb39852acdbfd06a499ceefa1392f2 to your computer and use it in GitHub Desktop.
Save goropikari/23eb39852acdbfd06a499ceefa1392f2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Julia Version 1.0.0\n",
"Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)\n",
"Platform Info:\n",
" OS: Linux (x86_64-pc-linux-gnu)\n",
" CPU: Intel(R) Xeon(R) CPU E5645 @ 2.40GHz\n",
" WORD_SIZE: 64\n",
" LIBM: libopenlibm\n",
" LLVM: libLLVM-6.0.0 (ORCJIT, westmere)\n",
"Environment:\n",
" JULIA_SHELL = /usr/bin/zsh\n"
]
}
],
"source": [
"versioninfo()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10×10 Array{Float64,2}:\n",
" 0.823648 0.585812 0.469304 … 0.796363 0.0947919 0.479261 \n",
" 0.910357 0.539289 0.0623676 0.505874 0.948884 0.0632371\n",
" 0.164566 0.260036 0.353129 0.39206 0.775188 0.470637 \n",
" 0.177329 0.910047 0.767602 0.479356 0.177409 0.382453 \n",
" 0.27888 0.167036 0.043141 0.0682234 0.0800227 0.97655 \n",
" 0.203477 0.655448 0.267985 … 0.479948 0.682194 0.216105 \n",
" 0.0423017 0.575887 0.0668464 0.468397 0.92936 0.86319 \n",
" 0.0682693 0.868279 0.156637 0.452457 0.973119 0.0653417\n",
" 0.361828 0.9678 0.605297 0.644211 0.651778 0.69999 \n",
" 0.973216 0.76769 0.135745 0.669275 0.596532 0.850205 "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using Random\n",
"Random.seed!(0);\n",
"x = rand(10,10)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.823648 0.585812 0.469304 0.838118 0.951691 0.196407 0.0491219 0.796363 0.0947919 0.479261 \n",
" 0.910357 0.539289 0.0623676 0.914712 0.801119 0.873581 0.482761 0.505874 0.948884 0.0632371\n",
" 0.164566 0.260036 0.353129 0.300075 0.124323 0.654922 0.665252 0.39206 0.775188 0.470637 \n",
" 0.177329 0.910047 0.767602 0.72285 0.114269 0.586712 0.842256 0.479356 0.177409 0.382453 \n",
" 0.27888 0.167036 0.043141 0.119653 0.0795545 0.632696 0.169107 0.0682234 0.0800227 0.97655 \n",
" 0.203477 0.655448 0.267985 0.76707 0.776674 0.735004 0.938857 0.479948 0.682194 0.216105 \n",
" 0.0423017 0.575887 0.0668464 0.801924 0.104823 0.548342 0.783726 0.468397 0.92936 0.86319 \n",
" 0.0682693 0.868279 0.156637 0.0353445 0.838075 0.476883 0.505805 0.452457 0.973119 0.0653417\n",
" 0.361828 0.9678 0.605297 0.484661 0.184115 0.602375 0.622156 0.644211 0.651778 0.69999 \n",
" 0.973216 0.76769 0.135745 0.899199 0.312145 0.791346 0.306804 0.669275 0.596532 0.850205 "
]
}
],
"source": [
"Base.print_array(IOContext(stdout, :compact => true), x)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.8236475079774124 0.5858115517433242 0.46930370935301835 0.838117753907359 0.951690700362799 0.19640742703220093 0.04912193901316875 0.7963633990166934 0.09479186551379559 0.4792609158905863 \n",
" 0.9103565379264364 0.5392892841426182 0.06236755817015882 0.9147120238969264 0.8011185163108001 0.8735809112632831 0.48276146782949847 0.5058741376644247 0.9488838151206662 0.0632370551390915 \n",
" 0.16456579813368521 0.26003585026904785 0.35312877270491705 0.30007495800798534 0.12432272872023531 0.6549215778230062 0.6652515059404427 0.39206003754122043 0.7751879774225319 0.4706372596782542 \n",
" 0.17732884646626457 0.910046541351011 0.767601895961374 0.7228497594213787 0.11426876182995338 0.5867124396397687 0.8422557594578175 0.47935649090647914 0.17740896332315637 0.3824528206459128 \n",
" 0.278880109331201 0.16703619444214968 0.043141023329413164 0.1196525672223625 0.07955447119057157 0.6326955174849529 0.16910729451857898 0.06822341709242075 0.08002265274552212 0.9765501230411475 \n",
" 0.20347655804192266 0.6554484126999125 0.2679846344919068 0.7670696322682211 0.7766742218683131 0.7350038044058131 0.9388569303494545 0.4799481236784777 0.6821935901697289 0.2161052678391404 \n",
" 0.042301665932029664 0.5758873948500367 0.06684644402498341 0.8019235854122897 0.1048226490565447 0.548342114623342 0.7837260309016443 0.4683970163381419 0.9293597577149693 0.8631896591631327 \n",
" 0.06826925550564478 0.8682787096942046 0.15663663731366406 0.035344549147287685 0.8380749803307581 0.47688264487569976 0.5058046332164718 0.45245669115936304 0.9731187745702308 0.06534170236345038\n",
" 0.3618283907762174 0.9677995536192001 0.6052967398293401 0.48466052213279887 0.18411485558080476 0.6023746021111653 0.6221557939669518 0.6442110258372615 0.6517776347893842 0.6999897089476348 \n",
" 0.9732164043865108 0.7676903325581188 0.13574455851185352 0.8991991479715158 0.3121451099216308 0.7913462490414747 0.30680415689806817 0.6692753552886208 0.596532097629072 0.8502054654407449 "
]
}
],
"source": [
"Base.print_array(IOContext(stdout, :compact => false), x)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"function Base.show(io::IO, x::Float64)\n",
" Base.Grisu._show(io, x, 3, 2, false, false) # 有効数字2桁\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" 0.82 0.59 0.47 0.84 0.95 0.2 0.049 0.8 0.095 0.48 \n",
" 0.91 0.54 0.062 0.91 0.8 0.87 0.48 0.51 0.95 0.063\n",
" 0.16 0.26 0.35 0.3 0.12 0.65 0.67 0.39 0.78 0.47 \n",
" 0.18 0.91 0.77 0.72 0.11 0.59 0.84 0.48 0.18 0.38 \n",
" 0.28 0.17 0.043 0.12 0.08 0.63 0.17 0.068 0.08 0.98 \n",
" 0.2 0.66 0.27 0.77 0.78 0.74 0.94 0.48 0.68 0.22 \n",
" 0.042 0.58 0.067 0.8 0.1 0.55 0.78 0.47 0.93 0.86 \n",
" 0.068 0.87 0.16 0.035 0.84 0.48 0.51 0.45 0.97 0.065\n",
" 0.36 0.97 0.61 0.48 0.18 0.6 0.62 0.64 0.65 0.7 \n",
" 0.97 0.77 0.14 0.9 0.31 0.79 0.31 0.67 0.6 0.85 "
]
}
],
"source": [
"Base.print_array(IOContext(stdout, :compact => false), x)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.0.0",
"language": "julia",
"name": "julia-1.0"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.0.0"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autoclose": false,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"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": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment