|
<html><head><title>dlib C++ Library - cblas_cgerc.c</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>/* |
|
* cblas_cgerc.c |
|
* The program is a C interface to cgerc. |
|
* |
|
* Keita Teranishi 5/20/98 |
|
* |
|
*/</font> |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>stdio.h<font color='#5555FF'>></font> |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>stdlib.h<font color='#5555FF'>></font> |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cblas.h.html'>cblas.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='cblas_f77.h.html'>cblas_f77.h</a>" |
|
<font color='#0000FF'><u>void</u></font> <b><a name='cblas_cgerc'></a>cblas_cgerc</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> <font color='#0000FF'>enum</font> CBLAS_ORDER order, <font color='#0000FF'>const</font> CBLAS_INT_TYPE M, <font color='#0000FF'>const</font> CBLAS_INT_TYPE N, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font> <font color='#5555FF'>*</font>alpha, <font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font> <font color='#5555FF'>*</font>X, <font color='#0000FF'>const</font> CBLAS_INT_TYPE incX, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>void</u></font> <font color='#5555FF'>*</font>Y, <font color='#0000FF'>const</font> CBLAS_INT_TYPE incY, <font color='#0000FF'><u>void</u></font> <font color='#5555FF'>*</font>A, <font color='#0000FF'>const</font> CBLAS_INT_TYPE lda<font face='Lucida Console'>)</font> |
|
<b>{</b> |
|
<font color='#0000FF'>#ifdef</font> F77_INT |
|
F77_INT F77_M<font color='#5555FF'>=</font>M, F77_N<font color='#5555FF'>=</font>N, F77_lda<font color='#5555FF'>=</font>lda, F77_incX<font color='#5555FF'>=</font>incX, F77_incY<font color='#5555FF'>=</font>incY; |
|
<font color='#0000FF'>#else</font> |
|
<font color='#0000FF'>#define</font> F77_M M |
|
<font color='#0000FF'>#define</font> F77_N N |
|
<font color='#0000FF'>#define</font> F77_incX incX |
|
<font color='#0000FF'>#define</font> F77_incY incy |
|
<font color='#0000FF'>#define</font> F77_lda lda |
|
<font color='#0000FF'>#endif</font> |
|
|
|
CBLAS_INT_TYPE n, i, tincy, incy<font color='#5555FF'>=</font>incY; |
|
<font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font>y<font color='#5555FF'>=</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font><font face='Lucida Console'>)</font>Y, <font color='#5555FF'>*</font>yy<font color='#5555FF'>=</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font><font face='Lucida Console'>)</font>Y, <font color='#5555FF'>*</font>ty, <font color='#5555FF'>*</font>st; |
|
|
|
|
|
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasColMajor<font face='Lucida Console'>)</font> |
|
<b>{</b> |
|
<font color='#BB00BB'>F77_cgerc</font><font face='Lucida Console'>(</font> <font color='#5555FF'>&</font>F77_M, <font color='#5555FF'>&</font>F77_N, alpha, X, <font color='#5555FF'>&</font>F77_incX, Y, <font color='#5555FF'>&</font>F77_incY, A, |
|
<font color='#5555FF'>&</font>F77_lda<font face='Lucida Console'>)</font>; |
|
<b>}</b> <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>order <font color='#5555FF'>=</font><font color='#5555FF'>=</font> CblasRowMajor<font face='Lucida Console'>)</font> |
|
<b>{</b> |
|
<font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>N <font color='#5555FF'>></font> <font color='#979000'>0</font><font face='Lucida Console'>)</font> |
|
<b>{</b> |
|
n <font color='#5555FF'>=</font> N <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#979000'>1</font>; |
|
y <font color='#5555FF'>=</font> <font color='#BB00BB'>malloc</font><font face='Lucida Console'>(</font>n<font color='#5555FF'>*</font><font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>; |
|
|
|
ty <font color='#5555FF'>=</font> y; |
|
<font color='#0000FF'>if</font><font face='Lucida Console'>(</font> incY <font color='#5555FF'>></font> <font color='#979000'>0</font> <font face='Lucida Console'>)</font> <b>{</b> |
|
i <font color='#5555FF'>=</font> incY <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#979000'>1</font>; |
|
tincy <font color='#5555FF'>=</font> <font color='#979000'>2</font>; |
|
st<font color='#5555FF'>=</font> y<font color='#5555FF'>+</font>n; |
|
<b>}</b> <font color='#0000FF'>else</font> <b>{</b> |
|
i <font color='#5555FF'>=</font> incY <font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font color='#5555FF'>-</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>; |
|
tincy <font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>2</font>; |
|
st <font color='#5555FF'>=</font> y<font color='#5555FF'>-</font><font color='#979000'>2</font>; |
|
y <font color='#5555FF'>+</font><font color='#5555FF'>=</font><font face='Lucida Console'>(</font>n<font color='#5555FF'>-</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>; |
|
<b>}</b> |
|
<font color='#0000FF'>do</font> |
|
<b>{</b> |
|
<font color='#5555FF'>*</font>y <font color='#5555FF'>=</font> <font color='#5555FF'>*</font>yy; |
|
y[<font color='#979000'>1</font>] <font color='#5555FF'>=</font> <font color='#5555FF'>-</font>yy[<font color='#979000'>1</font>]; |
|
y <font color='#5555FF'>+</font><font color='#5555FF'>=</font> tincy ; |
|
yy <font color='#5555FF'>+</font><font color='#5555FF'>=</font> i; |
|
<b>}</b> |
|
<font color='#0000FF'>while</font> <font face='Lucida Console'>(</font>y <font color='#5555FF'>!</font><font color='#5555FF'>=</font> st<font face='Lucida Console'>)</font>; |
|
y <font color='#5555FF'>=</font> ty; |
|
|
|
<font color='#0000FF'>#ifdef</font> F77_INT |
|
F77_incY <font color='#5555FF'>=</font> <font color='#979000'>1</font>; |
|
<font color='#0000FF'>#else</font> |
|
incy <font color='#5555FF'>=</font> <font color='#979000'>1</font>; |
|
<font color='#0000FF'>#endif</font> |
|
<b>}</b> |
|
<font color='#0000FF'>else</font> y <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font> <font color='#5555FF'>*</font><font face='Lucida Console'>)</font> Y; |
|
|
|
<font color='#BB00BB'>F77_cgeru</font><font face='Lucida Console'>(</font> <font color='#5555FF'>&</font>F77_N, <font color='#5555FF'>&</font>F77_M, alpha, y, <font color='#5555FF'>&</font>F77_incY, X, <font color='#5555FF'>&</font>F77_incX, A, |
|
<font color='#5555FF'>&</font>F77_lda<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'>if</font><font face='Lucida Console'>(</font>Y<font color='#5555FF'>!</font><font color='#5555FF'>=</font>y<font face='Lucida Console'>)</font> |
|
<font color='#BB00BB'>free</font><font face='Lucida Console'>(</font>y<font face='Lucida Console'>)</font>; |
|
|
|
<b>}</b> <font color='#0000FF'>else</font> <font color='#BB00BB'>cblas_xerbla</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, "<font color='#CC0000'>cblas_cgerc</font>", "<font color='#CC0000'>Illegal Order setting, %d\n</font>", order<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'>return</font>; |
|
<b>}</b> |
|
|
|
</pre></body></html> |