BLAS.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <chapter id="BLAS">
  5. <title><emphasis>BLAS Support</emphasis></title>
  6. <para>This section provides support tor Basic Linear Algebra Subprogram
  7. support.</para>
  8. <para>The BLAS functions use the column major mapping for the storage of a
  9. matrix. This is the mapping used in Fortran, and has the entries of the
  10. first column followed by the entries of the second column. This is the
  11. transpose of the row major form commonly used in the C language where the
  12. entries of the first row are followed by the entries of the second
  13. row.</para>
  14. <sect1 id="BLASTypes">
  15. <title>Types</title>
  16. <para><emphasis role="bold">STD.BLAS.Types<indexterm>
  17. <primary>STD.BLAS.Types</primary>
  18. </indexterm><indexterm>
  19. <primary>BLAS.Types</primary>
  20. </indexterm><indexterm>
  21. <primary>Types</primary>
  22. </indexterm></emphasis></para>
  23. <informaltable colsep="1" frame="all" rowsep="1">
  24. <tgroup cols="2">
  25. <tbody>
  26. <row>
  27. <entry><emphasis>value_t</emphasis></entry>
  28. <entry>REAL8</entry>
  29. </row>
  30. <row>
  31. <entry><emphasis>dimension_t</emphasis></entry>
  32. <entry>UNSIGNED4</entry>
  33. </row>
  34. <row>
  35. <entry><emphasis>matrix_t</emphasis></entry>
  36. <entry>SET OF REAL8</entry>
  37. </row>
  38. <row>
  39. <entry><emphasis>Triangle</emphasis></entry>
  40. <entry>ENUM(UNSIGNED1, Upper=1, Lower=2)</entry>
  41. </row>
  42. <row>
  43. <entry><emphasis>Diagonal</emphasis></entry>
  44. <entry>ENUM(UNSIGNED1, UnitTri=1, NotUnitTri=2)</entry>
  45. </row>
  46. <row>
  47. <entry><emphasis>Side</emphasis></entry>
  48. <entry>ENUM(UNSIGNED1, Ax=1, xA=2)</entry>
  49. </row>
  50. </tbody>
  51. </tgroup>
  52. </informaltable>
  53. <para>Types for the Block Basic Linear Algebra Sub-programs support</para>
  54. <para></para>
  55. </sect1>
  56. <sect1 id="ICellFunc">
  57. <title>ICellFunc</title>
  58. <para><emphasis role="bold">STD.BLAS.ICellFunc<indexterm>
  59. <primary>STD.BLAS.ICellFunc</primary>
  60. </indexterm><indexterm>
  61. <primary>BLAS.ICellFunc</primary>
  62. </indexterm><indexterm>
  63. <primary>ICellFunc</primary>
  64. </indexterm>(</emphasis> <emphasis>v, r</emphasis> <emphasis
  65. role="bold">,</emphasis> <emphasis>c</emphasis> <emphasis>);</emphasis>
  66. <emphasis></emphasis></para>
  67. <informaltable colsep="1" frame="all" rowsep="1">
  68. <tgroup cols="2">
  69. <colspec colwidth="80.50pt" />
  70. <colspec />
  71. <tbody>
  72. <row>
  73. <entry><emphasis>v</emphasis></entry>
  74. <entry>The value</entry>
  75. </row>
  76. <row>
  77. <entry><emphasis>r</emphasis></entry>
  78. <entry>The row ordinal</entry>
  79. </row>
  80. <row>
  81. <entry><emphasis>c</emphasis></entry>
  82. <entry>The column ordinal</entry>
  83. </row>
  84. <row>
  85. <entry>Return:<emphasis></emphasis></entry>
  86. <entry>The updated value</entry>
  87. </row>
  88. </tbody>
  89. </tgroup>
  90. </informaltable>
  91. <para><emphasis role="bold">ICellFunc </emphasis>is the function prototype
  92. for Apply2Cells.</para>
  93. <para>Example:</para>
  94. <programlisting format="linespecific">IMPORT STD;
  95. REAL8 my_func(STD.BLAS.Types.value_t v, STD.BLAS.Types.dimension_t x, STD.BLAS.Types.dimension_t y)
  96. := 1/v; //set element to the reciprocal value
  97. </programlisting>
  98. <para>See Also: <link linkend="Apply2Cells">Apply2Cells</link></para>
  99. </sect1>
  100. <sect1 id="Apply2Cells">
  101. <title>Apply2Cells</title>
  102. <para><emphasis role="bold">STD.BLAS.Apply2Cells<indexterm>
  103. <primary>STD.BLAS.Apply2Cells</primary>
  104. </indexterm><indexterm>
  105. <primary>BLAS.Apply2Cells</primary>
  106. </indexterm><indexterm>
  107. <primary>Apply2Cells</primary>
  108. </indexterm>(</emphasis> <emphasis>m, n</emphasis> <emphasis
  109. role="bold">,</emphasis> <emphasis>x, f</emphasis> <emphasis>);</emphasis>
  110. <emphasis></emphasis></para>
  111. <para></para>
  112. <informaltable colsep="1" frame="all" rowsep="1">
  113. <tgroup cols="2">
  114. <colspec colwidth="80.50pt" />
  115. <colspec />
  116. <tbody>
  117. <row>
  118. <entry><emphasis>m</emphasis></entry>
  119. <entry>Number of rows</entry>
  120. </row>
  121. <row>
  122. <entry><emphasis>n</emphasis></entry>
  123. <entry>Number of columns</entry>
  124. </row>
  125. <row>
  126. <entry><emphasis>x</emphasis></entry>
  127. <entry>Matrix</entry>
  128. </row>
  129. <row>
  130. <entry><emphasis>f</emphasis></entry>
  131. <entry>Function to apply</entry>
  132. </row>
  133. <row>
  134. <entry>Return:<emphasis></emphasis></entry>
  135. <entry>The updated matrix</entry>
  136. </row>
  137. </tbody>
  138. </tgroup>
  139. </informaltable>
  140. <para>The <emphasis role="bold">Apply2Cells </emphasis>function iterates a
  141. matrix and applies a function to each cell.</para>
  142. <para>Example:</para>
  143. <programlisting format="linespecific">IMPORT STD;
  144. STD.BLAS.Types.value_t example_1(STD.BLAS.Types.value_t v,
  145. STD.BLAS.Types.dimensiopn_t x,
  146. STD.BLAS.Types.dimension_t y) := FUNCTION
  147. RETURN IF(x=y, 1.0, 1/v);
  148. END;
  149. init_mat := [1, 2, 4, 4, 5, 10, 2, 5, 2];
  150. new_mat := STD.BLAS.Apply2Cells(3, 3, init_mat, example_1);
  151. // The new_mat matrix will be [1, .5, .25, .25, 1, .1, .5, .2, 1]
  152. </programlisting>
  153. <para>See Also: <link linkend="ICellFunc">ICellFunc</link></para>
  154. </sect1>
  155. <sect1 id="dasum">
  156. <title>dasum</title>
  157. <para><emphasis role="bold">STD.BLAS.dasum<indexterm>
  158. <primary>STD.BLAS.dasum</primary>
  159. </indexterm><indexterm>
  160. <primary>BLAS.dasum</primary>
  161. </indexterm><indexterm>
  162. <primary>dasum</primary>
  163. </indexterm>(</emphasis> <emphasis>m, </emphasis> <emphasis>x, incx,
  164. skipped);</emphasis> <emphasis></emphasis></para>
  165. <para></para>
  166. <informaltable colsep="1" frame="all" rowsep="1">
  167. <tgroup cols="2">
  168. <colspec colwidth="80.50pt" />
  169. <colspec />
  170. <tbody>
  171. <row>
  172. <entry><emphasis>m</emphasis></entry>
  173. <entry>Number of entries</entry>
  174. </row>
  175. <row>
  176. <entry><emphasis>x</emphasis></entry>
  177. <entry>The column major matrix holding the vector</entry>
  178. </row>
  179. <row>
  180. <entry><emphasis>incxx</emphasis></entry>
  181. <entry>The increment for x, 1 in the case of an actual
  182. vector</entry>
  183. </row>
  184. <row>
  185. <entry><emphasis>skipped</emphasis></entry>
  186. <entry>The number of entries stepped over. Default is
  187. zero.</entry>
  188. </row>
  189. <row>
  190. <entry>Return:<emphasis></emphasis></entry>
  191. <entry>The sum of the absolute values</entry>
  192. </row>
  193. </tbody>
  194. </tgroup>
  195. </informaltable>
  196. <para>The <emphasis role="bold">dasum </emphasis>function gets the
  197. absolute sum, the 1 norm of a vector.</para>
  198. <para>Example:</para>
  199. <programlisting format="linespecific">IMPORT STD;
  200. STD.BLAS.Types.matrix_t test_data := [2, -2, -3, 3, 1, 3, -1, -1, 1];
  201. STD.BLAS.dasum(9, test_data, 1); //sums the absolute values of the matrix, and returns 17
  202. </programlisting>
  203. <para></para>
  204. </sect1>
  205. <sect1 id="daxpy">
  206. <title>daxpy</title>
  207. <para><emphasis role="bold">STD.BLAS.daxpy<indexterm>
  208. <primary>STD.BLAS.daxpy</primary>
  209. </indexterm><indexterm>
  210. <primary>BLAS.dasum</primary>
  211. </indexterm><indexterm>
  212. <primary>dasum</primary>
  213. </indexterm>(</emphasis> <emphasis>N, alpha, X, incX, Y, incY,
  214. x_skipped,y_skipped);</emphasis> <emphasis></emphasis></para>
  215. <para></para>
  216. <informaltable colsep="1" frame="all" rowsep="1">
  217. <tgroup cols="2">
  218. <colspec colwidth="80.50pt" />
  219. <colspec />
  220. <tbody>
  221. <row>
  222. <entry><emphasis>N</emphasis></entry>
  223. <entry>Number of entries</entry>
  224. </row>
  225. <row>
  226. <entry><emphasis>alpha</emphasis></entry>
  227. <entry>The column major matrix holding the vector</entry>
  228. </row>
  229. <row>
  230. <entry><emphasis>X</emphasis></entry>
  231. <entry>The increment for x, 1 in the case of an actual
  232. vector</entry>
  233. </row>
  234. <row>
  235. <entry><emphasis>incX</emphasis></entry>
  236. <entry>The column major matrix holding the vector X</entry>
  237. </row>
  238. <row>
  239. <entry><emphasis>Y</emphasis></entry>
  240. <entry>The column major matrix holding the vector Y</entry>
  241. </row>
  242. <row>
  243. <entry><emphasis>incY</emphasis></entry>
  244. <entry>The increment or stride of Y</entry>
  245. </row>
  246. <row>
  247. <entry><emphasis>x_skipped</emphasis></entry>
  248. <entry>The number of entries stepped over. to get to the first X
  249. .</entry>
  250. </row>
  251. <row>
  252. <entry><emphasis>y_skipped</emphasis></entry>
  253. <entry>The number of entries stepped over. to get to the first Y
  254. .</entry>
  255. </row>
  256. <row>
  257. <entry>Return:<emphasis></emphasis></entry>
  258. <entry>The updated matrix</entry>
  259. </row>
  260. </tbody>
  261. </tgroup>
  262. </informaltable>
  263. <para>The <emphasis role="bold">daxpy</emphasis> function is used to sum
  264. two vectors or matrices with a scalar multiplier applied during the sum
  265. operation..</para>
  266. <para>Example:</para>
  267. <programlisting format="linespecific">IMPORT STD;
  268. STD.BLAS.Types.t_matrix term_1 := [1, 2, 3];
  269. STD.BLAS.Types.t_matrix term_2 := [3, 2, 1].
  270. STD.BLAS.daxpy(3, 2, term_1, 1, term_2, 1); // result is [5, 6, 7]
  271. </programlisting>
  272. <para></para>
  273. </sect1>
  274. <sect1 id="dgemm">
  275. <title>dgemm</title>
  276. <para><emphasis role="bold">STD.BLAS.dgemm<indexterm>
  277. <primary>STD.BLAS.dgemm</primary>
  278. </indexterm><indexterm>
  279. <primary>BLAS.dgemm</primary>
  280. </indexterm><indexterm>
  281. <primary>dgemm</primary>
  282. </indexterm>(</emphasis> <emphasis>transposeA, transposeB, M, N, K,
  283. alpha, A, B, beta, C);</emphasis> <emphasis></emphasis></para>
  284. <para></para>
  285. <informaltable colsep="1" frame="all" rowsep="1">
  286. <tgroup cols="2">
  287. <colspec colwidth="80.50pt" />
  288. <colspec />
  289. <tbody>
  290. <row>
  291. <entry><emphasis>transposeA</emphasis></entry>
  292. <entry>True when transpose of A is used</entry>
  293. </row>
  294. <row>
  295. <entry><emphasis>transposeB</emphasis></entry>
  296. <entry>True when transpose of B is used</entry>
  297. </row>
  298. <row>
  299. <entry><emphasis>M</emphasis></entry>
  300. <entry>Number of rows in product</entry>
  301. </row>
  302. <row>
  303. <entry><emphasis>N</emphasis></entry>
  304. <entry>Number of columns in product</entry>
  305. </row>
  306. <row>
  307. <entry><emphasis>K</emphasis></entry>
  308. <entry>Number of columns/rows for the
  309. multiplier/multiplicand</entry>
  310. </row>
  311. <row>
  312. <entry><emphasis>alpha</emphasis></entry>
  313. <entry>Scalar used on A</entry>
  314. </row>
  315. <row>
  316. <entry><emphasis>A</emphasis></entry>
  317. <entry>Matrix A</entry>
  318. </row>
  319. <row>
  320. <entry><emphasis>B</emphasis></entry>
  321. <entry>Matrix B</entry>
  322. </row>
  323. <row>
  324. <entry><emphasis>beta</emphasis></entry>
  325. <entry>Scalar for matirx C</entry>
  326. </row>
  327. <row>
  328. <entry><emphasis>C</emphasis></entry>
  329. <entry>Matrix C (or empty)</entry>
  330. </row>
  331. <row>
  332. <entry>Return:<emphasis></emphasis></entry>
  333. <entry>The updated matrix</entry>
  334. </row>
  335. </tbody>
  336. </tgroup>
  337. </informaltable>
  338. <para>The <emphasis role="bold">dgemm</emphasis> function is used to
  339. multiply two matrices and optionally add that product to another
  340. matrix.</para>
  341. <para>Example:</para>
  342. <programlisting format="linespecific">IMPORT STD;
  343. STD.BLAS.Types.t_matrix term_a := [2, 4, 8];
  344. STD.BLAS.Types.t_matrix term_c := [2, 1, 1];
  345. STD.BLAS.dgemm(TRUE, FALSE, 3, 3, 1, 1, term_a, term_b);
  346. //the outer product of the term_a and term_b vectors
  347. //result is [4,8, 16, 2, 4, 8, 2, 4, 8]
  348. </programlisting>
  349. <para></para>
  350. </sect1>
  351. <sect1 id="dgetf2">
  352. <title>dgetf2</title>
  353. <para><emphasis role="bold">STD.BLAS.dgetf2<indexterm>
  354. <primary>STD.BLAS.dgetf2</primary>
  355. </indexterm><indexterm>
  356. <primary>BLAS.dgetf2</primary>
  357. </indexterm><indexterm>
  358. <primary>dgetf2</primary>
  359. </indexterm>(</emphasis> <emphasis>m, n, a);</emphasis>
  360. <emphasis></emphasis></para>
  361. <para></para>
  362. <informaltable colsep="1" frame="all" rowsep="1">
  363. <tgroup cols="2">
  364. <colspec colwidth="80.50pt" />
  365. <colspec />
  366. <tbody>
  367. <row>
  368. <entry><emphasis>m</emphasis></entry>
  369. <entry>Number of rows of matrix a</entry>
  370. </row>
  371. <row>
  372. <entry><emphasis>n</emphasis></entry>
  373. <entry>Number of columns of matrix a</entry>
  374. </row>
  375. <row>
  376. <entry><emphasis>a</emphasis></entry>
  377. <entry>Matrix a</entry>
  378. </row>
  379. <row>
  380. <entry>Return:<emphasis></emphasis></entry>
  381. <entry>Composite matrix of factors, lower triangle has an implied
  382. diagonal of ones. Upper triangle has the diagonal of the
  383. composite.</entry>
  384. </row>
  385. </tbody>
  386. </tgroup>
  387. </informaltable>
  388. <para>The <emphasis role="bold">dgetf2</emphasis> function produces a
  389. combine lower and upper triangular factorization.</para>
  390. <para>Example:</para>
  391. <programlisting format="linespecific">IMPORT STD;
  392. STD.BLAS.Types.t_matrix test := [2,4,6,3,10,25, 9,34,100];
  393. STD.BLAS.dgetf2(3, 3, test); //result is [2,2,3,3,4,4,9,16,25];
  394. </programlisting>
  395. <para></para>
  396. </sect1>
  397. <sect1 id="dpotf2">
  398. <title>dpotf2</title>
  399. <para><emphasis role="bold">STD.BLAS.dpotf2<indexterm>
  400. <primary>STD.BLAS.dpotf2</primary>
  401. </indexterm><indexterm>
  402. <primary>BLAS.dpotf2</primary>
  403. </indexterm><indexterm>
  404. <primary>dpotf2</primary>
  405. </indexterm>(</emphasis> <emphasis>tri,, r, A, clear);</emphasis>
  406. <emphasis></emphasis></para>
  407. <para></para>
  408. <informaltable colsep="1" frame="all" rowsep="1">
  409. <tgroup cols="2">
  410. <colspec colwidth="80.50pt" />
  411. <colspec />
  412. <tbody>
  413. <row>
  414. <entry><emphasis>tri</emphasis></entry>
  415. <entry>Indicates whether upper or lower triangle is used</entry>
  416. </row>
  417. <row>
  418. <entry><emphasis>r</emphasis></entry>
  419. <entry>Number of rows/columns in the square matrix</entry>
  420. </row>
  421. <row>
  422. <entry><emphasis>A</emphasis></entry>
  423. <entry>The square matrix A</entry>
  424. </row>
  425. <row>
  426. <entry><emphasis>clear</emphasis></entry>
  427. <entry>Clears the unused triangle</entry>
  428. </row>
  429. <row>
  430. <entry>Return:<emphasis></emphasis></entry>
  431. <entry>The triangular matrix requested</entry>
  432. </row>
  433. </tbody>
  434. </tgroup>
  435. </informaltable>
  436. <para>The <emphasis role="bold">dpotf2</emphasis> function computes the
  437. Cholesky factorization of a real symmetric positive definite matrix A. The
  438. factorization has the form A = U**T*U if the <emphasis>tri</emphasis>
  439. parameter is Triangle.Upper, or A = L * L**T if the
  440. <emphasis>tri</emphasis> parameter is Triangle.Lower. This is the
  441. unblocked version of the algorithm, calling Level 2 BLAS.</para>
  442. <para>Example:</para>
  443. <programlisting format="linespecific">IMPORT STD;
  444. STD.BLAS.Types.matrix_t symmetric_pos_def := [4, 6, 8, 6, 13, 18, 8, 18, 29];
  445. Lower_Triangle := BLAS.dpotf2(STD.BLAS.Types.Triangle.lower, 3, symmetric_pos_def); </programlisting>
  446. <para></para>
  447. </sect1>
  448. <sect1 id="dscal">
  449. <title>dscal</title>
  450. <para><emphasis role="bold">STD.BLAS.dscal<indexterm>
  451. <primary>STD.BLAS.dscal</primary>
  452. </indexterm><indexterm>
  453. <primary>BLAS.dscal</primary>
  454. </indexterm><indexterm>
  455. <primary>dscal</primary>
  456. </indexterm>(</emphasis> <emphasis>N, alpha, X, incX,
  457. skipped);</emphasis> <emphasis></emphasis></para>
  458. <para></para>
  459. <informaltable colsep="1" frame="all" rowsep="1">
  460. <tgroup cols="2">
  461. <colspec colwidth="80.50pt" />
  462. <colspec />
  463. <tbody>
  464. <row>
  465. <entry><emphasis>N</emphasis></entry>
  466. <entry>Number of elements in the vector</entry>
  467. </row>
  468. <row>
  469. <entry><emphasis>alpha</emphasis></entry>
  470. <entry>The scaling factor</entry>
  471. </row>
  472. <row>
  473. <entry><emphasis>X</emphasis></entry>
  474. <entry>The column major matrix holding the vector</entry>
  475. </row>
  476. <row>
  477. <entry><emphasis>incX</emphasis></entry>
  478. <entry>The stride to get to the next element in the vector</entry>
  479. </row>
  480. <row>
  481. <entry><emphasis>skipped</emphasis></entry>
  482. <entry>The number of elements skipped to get to the first
  483. element</entry>
  484. </row>
  485. <row>
  486. <entry>Return:<emphasis></emphasis></entry>
  487. <entry>The updated matrix</entry>
  488. </row>
  489. </tbody>
  490. </tgroup>
  491. </informaltable>
  492. <para>The <emphasis role="bold">dscal </emphasis> function scales a vector
  493. alpha.</para>
  494. <para>Example:</para>
  495. <programlisting format="linespecific">IMPORT STD;
  496. STD.BLAS.Types.matrix_t test := [1, 1, 1, 2, 2, 2, 3, 3, 3];
  497. result := STD.BLAS.dscal(9, 2.0, test, 1); // multiply each element by 2
  498. </programlisting>
  499. <para></para>
  500. <para></para>
  501. <para></para>
  502. </sect1>
  503. <sect1 id="dsyrk">
  504. <title>dsyrk</title>
  505. <para><emphasis role="bold">STD.BLAS.dsyrk<indexterm>
  506. <primary>STD.BLAS.dsyrk</primary>
  507. </indexterm><indexterm>
  508. <primary>BLAS.dsyrk</primary>
  509. </indexterm><indexterm>
  510. <primary>dsyrk</primary>
  511. </indexterm>(</emphasis> <emphasis>tri, transposeA, N, K, alpha, A,
  512. beta, C, clear);</emphasis> <emphasis></emphasis></para>
  513. <para></para>
  514. <informaltable colsep="1" frame="all" rowsep="1">
  515. <tgroup cols="2">
  516. <colspec colwidth="80.50pt" />
  517. <colspec />
  518. <tbody>
  519. <row>
  520. <entry><emphasis>tri</emphasis></entry>
  521. <entry>Indicates whether upper or lower triangle is used</entry>
  522. </row>
  523. <row>
  524. <entry><emphasis>transposeA</emphasis></entry>
  525. <entry>Transpose the A matrix to be NxK</entry>
  526. </row>
  527. <row>
  528. <entry><emphasis>N</emphasis></entry>
  529. <entry>Number of rows</entry>
  530. </row>
  531. <row>
  532. <entry><emphasis>K</emphasis></entry>
  533. <entry>Number of columns in the update matrix or transpose</entry>
  534. </row>
  535. <row>
  536. <entry><emphasis>alpha</emphasis></entry>
  537. <entry>The alpha scalar</entry>
  538. </row>
  539. <row>
  540. <entry><emphasis>A</emphasis></entry>
  541. <entry>The update matrix, either NxK or KxN</entry>
  542. </row>
  543. <row>
  544. <entry><emphasis>beta</emphasis></entry>
  545. <entry>The beta scalar</entry>
  546. </row>
  547. <row>
  548. <entry><emphasis>C</emphasis></entry>
  549. <entry>The matrix to update</entry>
  550. </row>
  551. <row>
  552. <entry><emphasis>clear</emphasis></entry>
  553. <entry>Clear the triangle that is not updated. BLAS assumes that
  554. symmetric matrices have only one of the triangles and this option
  555. lets you make that true.</entry>
  556. </row>
  557. <row>
  558. <entry>Return:<emphasis></emphasis></entry>
  559. <entry>The updated matrix</entry>
  560. </row>
  561. </tbody>
  562. </tgroup>
  563. </informaltable>
  564. <para>The <emphasis role="bold">dsyrk </emphasis> function implements a
  565. symmetric rank update C &lt;- alpha A**T A + beta C or c &lt;- alpha A
  566. A**T + beta C. C is N x N.</para>
  567. <para>Example:</para>
  568. <programlisting format="linespecific">IMPORT STD;
  569. STD.BLAS.Types.matrix_t initC := [1, 1, 1, 2, 2, 2, 3, 3, 3];
  570. STD.BLAS.Types.matrix_t initA := [1, 1, 1];
  571. Test1_mat := STD.BLAS.dsyrk(STD.BLAS.Types.Triangle.upper, FALSE, 3, 1, 1, initA, 1, initC, TRUE)
  572. </programlisting>
  573. <para></para>
  574. </sect1>
  575. <sect1 id="dtrsm">
  576. <title>dtrsm</title>
  577. <para><emphasis role="bold">STD.BLAS.dtrsm<indexterm>
  578. <primary>STD.BLAS.dtrsm</primary>
  579. </indexterm><indexterm>
  580. <primary>BLAS.dsyrk</primary>
  581. </indexterm><indexterm>
  582. <primary>dtrsm</primary>
  583. </indexterm>(</emphasis> <emphasis>side, tri, transposeA, diag, M, N,
  584. lda, alpha, A, B);</emphasis> <emphasis></emphasis></para>
  585. <para></para>
  586. <informaltable colsep="1" frame="all" rowsep="1">
  587. <tgroup cols="2">
  588. <colspec colwidth="80.50pt" />
  589. <colspec />
  590. <tbody>
  591. <row>
  592. <entry><emphasis>side</emphasis></entry>
  593. <entry>Side for A, Side.Ax is op(A) X = alpha B</entry>
  594. </row>
  595. <row>
  596. <entry><emphasis>tri</emphasis></entry>
  597. <entry>Indicates whether upper or lower triangle is used</entry>
  598. </row>
  599. <row>
  600. <entry><emphasis>transposeA</emphasis></entry>
  601. <entry>Is op(A) the transpose of A</entry>
  602. </row>
  603. <row>
  604. <entry><emphasis>diag</emphasis></entry>
  605. <entry>The diagonal (an implied unit diagonal or supplied)</entry>
  606. </row>
  607. <row>
  608. <entry><emphasis>M</emphasis></entry>
  609. <entry>Number of rows</entry>
  610. </row>
  611. <row>
  612. <entry><emphasis>N</emphasis></entry>
  613. <entry>Number of columns</entry>
  614. </row>
  615. <row>
  616. <entry><emphasis>lda </emphasis></entry>
  617. <entry>The leading dimension of the A matrix, either M or
  618. N</entry>
  619. </row>
  620. <row>
  621. <entry><emphasis>alpha</emphasis></entry>
  622. <entry>The scalar multiplier for B</entry>
  623. </row>
  624. <row>
  625. <entry><emphasis>A</emphasis></entry>
  626. <entry>A triangular matrix</entry>
  627. </row>
  628. <row>
  629. <entry><emphasis>B</emphasis></entry>
  630. <entry>The matrix of values for the solve</entry>
  631. </row>
  632. <row>
  633. <entry>Return:<emphasis></emphasis></entry>
  634. <entry>The matrix of coefficients to get B</entry>
  635. </row>
  636. </tbody>
  637. </tgroup>
  638. </informaltable>
  639. <para>The <emphasis role="bold">dtrsm </emphasis> function is a triangular
  640. matrix solver. op(A) X = alpha B or X op(A) = alpha B * where op is
  641. Transpose, X and B is MxN</para>
  642. <para>Example:</para>
  643. <programlisting format="linespecific">IMPORT STD;
  644. Side := STD.BLAS.Types.Side;
  645. Diagonal := STD.BLAS.Types.Diagonal;
  646. Triangle := STD.BLAS.Types.Triangle;
  647. STD.BLAS.Types.matrix_t left_a0 := [2, 3, 4, 0, 2, 3, 0, 0, 2];
  648. STD.BLAS.Types.matrix_t mat_b := [4, 6, 8, 6, 13, 18, 8, 18, 29];
  649. Test1_mat := STD.BLAS.dtrsm(Side.Ax, Triangle.Lower, FALSE, Diagonal.NotUnitTri,
  650. 3, 3, 3, 1.0, left_a0, mat_b);
  651. </programlisting>
  652. <para></para>
  653. <para></para>
  654. <para></para>
  655. </sect1>
  656. <sect1 id="extract_diag">
  657. <title>extract_diag</title>
  658. <para><emphasis role="bold">STD.BLAS.extract_diag <indexterm>
  659. <primary>STD.BLAS.extract_diag</primary>
  660. </indexterm><indexterm>
  661. <primary>BLAS.extract_diag</primary>
  662. </indexterm><indexterm>
  663. <primary>extract_diag</primary>
  664. </indexterm>(</emphasis> <emphasis>m.n.x);</emphasis>
  665. <emphasis></emphasis></para>
  666. <para></para>
  667. <informaltable colsep="1" frame="all" rowsep="1">
  668. <tgroup cols="2">
  669. <colspec colwidth="80.50pt" />
  670. <colspec />
  671. <tbody>
  672. <row>
  673. <entry><emphasis>m</emphasis></entry>
  674. <entry>Number of rows</entry>
  675. </row>
  676. <row>
  677. <entry><emphasis>n</emphasis></entry>
  678. <entry>Number of columns</entry>
  679. </row>
  680. <row>
  681. <entry><emphasis>x</emphasis></entry>
  682. <entry>The matrix from which to extract the diagonal</entry>
  683. </row>
  684. <row>
  685. <entry>Return:<emphasis></emphasis></entry>
  686. <entry>Diagonal matrix</entry>
  687. </row>
  688. </tbody>
  689. </tgroup>
  690. </informaltable>
  691. <para>The <emphasis role="bold">extract_diag </emphasis> function extracts
  692. the diagonal of he matrix</para>
  693. <para>Example:</para>
  694. <programlisting format="linespecific">IMPORT STD;
  695. STD.BLAS.Types.matrix_t x := [1.0, 2.0, 3.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0];
  696. diagonal_only := := STD.BLAS.extract_diag(3, 3, x);
  697. </programlisting>
  698. <para></para>
  699. <para></para>
  700. <para></para>
  701. </sect1>
  702. <sect1 id="extract_tri">
  703. <title>extract_tri</title>
  704. <para><emphasis role="bold">STD.BLAS.extract_tri <indexterm>
  705. <primary>STD.BLAS.extract_tri</primary>
  706. </indexterm><indexterm>
  707. <primary>BLAS.extract_tri</primary>
  708. </indexterm><indexterm>
  709. <primary>extract_tri</primary>
  710. </indexterm>(</emphasis> <emphasis>m, n, tri, dt, a );</emphasis>
  711. <emphasis></emphasis></para>
  712. <para></para>
  713. <informaltable colsep="1" frame="all" rowsep="1">
  714. <tgroup cols="2">
  715. <colspec colwidth="80.50pt" />
  716. <colspec />
  717. <tbody>
  718. <row>
  719. <entry><emphasis>m</emphasis></entry>
  720. <entry>Number of rows</entry>
  721. </row>
  722. <row>
  723. <entry><emphasis>n</emphasis></entry>
  724. <entry>Number of columns</entry>
  725. </row>
  726. <row>
  727. <entry><emphasis>tri</emphasis></entry>
  728. <entry>Indicates whether upper or lower triangle is used</entry>
  729. </row>
  730. <row>
  731. <entry><emphasis>dt</emphasis></entry>
  732. <entry>Use Diagonal.NotUnitTri or Diagonal.UnitTri</entry>
  733. </row>
  734. <row>
  735. <entry><emphasis>a</emphasis></entry>
  736. <entry>The matrix, usually a composite from factoring</entry>
  737. </row>
  738. <row>
  739. <entry>Return:<emphasis></emphasis></entry>
  740. <entry>Triangle</entry>
  741. </row>
  742. </tbody>
  743. </tgroup>
  744. </informaltable>
  745. <para>The <emphasis role="bold">extract_tri </emphasis> function extracts
  746. the upper or lower triangle. The diagonal can be the actual or implied
  747. unit diagonal.</para>
  748. <para>Example:</para>
  749. <programlisting format="linespecific">IMPORT STD;
  750. Diagonal := STD.BLAS.Types.Diagonal;
  751. Triangle := STD.BLAS.Types.Triangle;
  752. STD.BLAS.Types.matrix_t x := [1.0, 2.0, 3.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0];
  753. triangle := STD.BLAS.extract_tri(3, 3, Triangle.upper, Diagonal.NotUnitTri, x);
  754. </programlisting>
  755. <para></para>
  756. </sect1>
  757. <sect1 id="make_diag">
  758. <title>make_diag</title>
  759. <para><emphasis role="bold">STD.BLAS.make_diag <indexterm>
  760. <primary>STD.BLAS.make_diag</primary>
  761. </indexterm><indexterm>
  762. <primary>BLAS.make_diag</primary>
  763. </indexterm><indexterm>
  764. <primary>make_diag</primary>
  765. </indexterm>(</emphasis> <emphasis>m, v, X );</emphasis>
  766. <emphasis></emphasis></para>
  767. <para></para>
  768. <informaltable colsep="1" frame="all" rowsep="1">
  769. <tgroup cols="2">
  770. <colspec colwidth="80.50pt" />
  771. <colspec />
  772. <tbody>
  773. <row>
  774. <entry><emphasis>m</emphasis></entry>
  775. <entry>Number of diagonal entries</entry>
  776. </row>
  777. <row>
  778. <entry><emphasis>v</emphasis></entry>
  779. <entry>Option value, default is 1</entry>
  780. </row>
  781. <row>
  782. <entry><emphasis>X</emphasis></entry>
  783. <entry>Optional input of diagonal values, multiplied by v</entry>
  784. </row>
  785. <row>
  786. <entry>Return:<emphasis></emphasis></entry>
  787. <entry>A diagonal matrix</entry>
  788. </row>
  789. </tbody>
  790. </tgroup>
  791. </informaltable>
  792. <para>The <emphasis role="bold">make_diag </emphasis> function generates a
  793. diagonal matrix.</para>
  794. <para>Example:</para>
  795. <programlisting format="linespecific">IMPORT STD;
  796. STD.BLAS.Types.matrix_t init1 := [1.0, 2.0, 3.0, 4.0];
  797. Square := STD.BLAS.make_diag(4, 1, init1); //4x4 with diagonal 1, 2, 3, 4
  798. </programlisting>
  799. <para></para>
  800. </sect1>
  801. <sect1 id="make_vector">
  802. <title>make_vector</title>
  803. <para><emphasis role="bold">STD.BLAS.make_vector <indexterm>
  804. <primary>STD.BLAS.make_vector</primary>
  805. </indexterm><indexterm>
  806. <primary>BLAS.make_vector</primary>
  807. </indexterm><indexterm>
  808. <primary>make_vector</primary>
  809. </indexterm>(</emphasis> <emphasis>m, v );</emphasis>
  810. <emphasis></emphasis></para>
  811. <para></para>
  812. <informaltable colsep="1" frame="all" rowsep="1">
  813. <tgroup cols="2">
  814. <colspec colwidth="80.50pt" />
  815. <colspec />
  816. <tbody>
  817. <row>
  818. <entry><emphasis>m</emphasis></entry>
  819. <entry>Number of elements</entry>
  820. </row>
  821. <row>
  822. <entry><emphasis>v</emphasis></entry>
  823. <entry>The values, default is 1</entry>
  824. </row>
  825. <row>
  826. <entry>Return:<emphasis></emphasis></entry>
  827. <entry>The vector</entry>
  828. </row>
  829. </tbody>
  830. </tgroup>
  831. </informaltable>
  832. <para>The <emphasis role="bold">make_vector</emphasis> function generates
  833. a vector of dimension n</para>
  834. <para>Example:</para>
  835. <programlisting format="linespecific">IMPORT STD;
  836. twos_vector := STD.BLAS.make_vector(4, 2); // a vector of [2, 2, 2, 2]
  837. </programlisting>
  838. <para></para>
  839. <para></para>
  840. </sect1>
  841. <sect1 id="BLASTrace">
  842. <title>trace</title>
  843. <para><emphasis role="bold">STD.BLAS.trace <indexterm>
  844. <primary>STD.BLAS.tracer</primary>
  845. </indexterm><indexterm>
  846. <primary>BLAS.trace</primary>
  847. </indexterm><indexterm>
  848. <primary>trace</primary>
  849. </indexterm>(</emphasis> <emphasis>m, n, x );</emphasis>
  850. <emphasis></emphasis></para>
  851. <para></para>
  852. <informaltable colsep="1" frame="all" rowsep="1">
  853. <tgroup cols="2">
  854. <colspec colwidth="80.50pt" />
  855. <colspec />
  856. <tbody>
  857. <row>
  858. <entry><emphasis>m</emphasis></entry>
  859. <entry>Number of rows</entry>
  860. </row>
  861. <row>
  862. <entry><emphasis>n</emphasis></entry>
  863. <entry>Number of columns</entry>
  864. </row>
  865. <row>
  866. <entry><emphasis>x</emphasis></entry>
  867. <entry>The matrix</entry>
  868. </row>
  869. <row>
  870. <entry>Return:<emphasis></emphasis></entry>
  871. <entry>The trace (sum of the diagonal entries)</entry>
  872. </row>
  873. </tbody>
  874. </tgroup>
  875. </informaltable>
  876. <para>The <emphasis role="bold">trace</emphasis> function computes the
  877. trace of the input matrix</para>
  878. <para>Example:</para>
  879. <programlisting format="linespecific">IMPORT STD;
  880. STD.BLAS.Types.matrix_t x := [1.0, 2.0, 3.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0];
  881. trace_of_x := STD.BLAS.trace(3,3,x); // the trace is 7
  882. </programlisting>
  883. <para></para>
  884. </sect1>
  885. </chapter>