2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

汚いながらもなんとか、ベクトルの足し算。

var matABuf: [Double] =
    [1, 2, 3,
     4, 5, 6,
     7, 8, 9]
let vecA = la_matrix_from_double_buffer(matABuf,
                                        3,  /* 行数 */
    1,  /* 列数 */
    3,  /* 改行ごとにメモリバッファをスライドさせる幅 */
    la_hint_t(LA_NO_HINT),
    la_attribute_t(LA_DEFAULT_ATTRIBUTES))
print(vecA.matrixDescription)
 
var matBBuf: [Double] =
    [1, 4, 7,
     2, 5, 8,
     3, 6, 9]
let vecB = la_matrix_from_double_buffer(matBBuf,
                                        3,  /* 行数 */
    1,  /* 列数 */
    3,  /* 改行ごとにメモリバッファをスライドさせる幅 */
    la_hint_t(LA_NO_HINT),
    la_attribute_t(LA_DEFAULT_ATTRIBUTES))
print(vecB.matrixDescription)
 
let ans = la_sum(vecA, vecB)
print(ans.matrixDescription)

以下が結果。

1.0
4.0
7.0
 
1.0
2.0
3.0
 
2.0
6.0
10.0

計算できてるじゃん。

関連情報
[iOS 8] Accelerate.Frameworkに加わった新たな線形代数ライブラリ

BLAS

Cocoa Advent Calendar 2017

Cocoa勉強会 BUKURO.swift (connpass)

Cocoa勉強会 BUKURO.swift (ATND)

Cocoa勉強会 BUKURO.swift (Peatix)

【Cocoa練習帳】
http://www.bitz.co.jp/weblog/

http://ameblo.jp/bitz/(ミラー・サイト)

Qiita

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?