<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>inarizuuuushi</author_name>
  <author_url>https://blog.hatena.ne.jp/inarizuuuushi/</author_url>
  <blog_title>Sabrou-mal サブロウ丸</blog_title>
  <blog_url>https://inarizuuuushi.hatenablog.com/</blog_url>
  <categories>
    <anon> python </anon>
  </categories>
  <description>Cython その2 - サブロウ丸の続きです。 今回はCythonでの配列の型付けの話をします。 配列の要素が全て同一の型の場合、(当然ですが)そのことを宣言した方がより高速になります。 Cythonで上記を実現するにはメモリービューと呼ばれるものを使用します。 numpyと組み合わせて使うのが一般的のようです。 要素が全てint型(32bit)の長さがnの配列arrayを宣言するには cdef int[:] array = np.zeros(n, dtype=np.int32) と書きます。これで初期値として0が入った配列ができます。 mallocを使う方法もあるそうですが、宣言時に各要素…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Finarizuuuushi.hatenablog.com%2Fentry%2F2017%2F02%2F19%2F132917&quot; title=&quot;Cython その3 配列の型付け - Sabrou-mal サブロウ丸&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-02-19 13:29:17</published>
  <title>Cython その3 配列の型付け</title>
  <type>rich</type>
  <url>https://inarizuuuushi.hatenablog.com/entry/2017/02/19/132917</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
