@@ -15,21 +15,24 @@ uint64_t asum(uint64_t x){x=FZ(Fst(x));int32_t n=nn(x);if(tp(x)==Zt)n*=2;return
1515uint64_t imax (uint64_t x ){x = FZ (Fst (x ));int32_t n = nn (x );int32_t i = tp (x )== Ft ?cblas_idamax (n ,FK (x ),1 ):cblas_izamax (n ,FK (x ),1 );return Ki (i );}
1616uint64_t rot (uint64_t y ){double c = f0 (y ),s = f1 (y );uint64_t x = FZ (x2 (y )),q = x3 (y );dx (y );x = use (x );y = use (q );
1717 tp (x )== Zt ?cblas_zdrot (nn (x ),FK (x ),1 ,FK (y ),1 ,c ,s ):cblas_drot (nn (x ),FK (x ),1 ,FK (y ),1 ,c ,s );return l2 (x ,y );}
18- uint64_t mv (uint64_t y ){int32_t m ,n ; //todo..
19- uint64_t A = FZ (x1 (y )),x = FZ (x5 (y )),r = FZ (x6 (y ));
20- if (tp (A )== Zt ){
21- double a = f0 (y ),b = f4 (y );int32_t rA = i2 (y ),op = i3 (y );dx (y );r = use (r );dim (A ,rA ,& m ,& n );
22- cblas_dgemv (major (rA ),trans (op ),m ,n ,a ,FK (A ),n ,FK (x ),1 ,b ,FK (r ),1 );
18+ uint64_t gemv (uint64_t u ){int32_t m ,n ;
19+ // 0 1 2 3 4 5 6
20+ //y:gemm[a;A;rA;op;b;y;x]
21+ uint64_t A = FZ (x1 (u )),y = FZ (x5 (u )),x = FZ (x6 (u ));
22+ if (tp (A )== Ft ){
23+ double a = f0 (y ),b = f4 (y );int32_t rA = i2 (y ),op = i3 (y );dx (u );y = use (y );dim (A ,rA ,& m ,& n );
24+ cblas_dgemv (major (rA ),trans (op ),m ,n ,a ,FK (A ),n ,FK (x ),1 ,b ,FK (y ),1 );
2325 dx (A );dx (x );return b ;
2426 }else {
2527 printf ("todo mv complex\n" );
2628 }
2729}
2830
29- void regblas (void ){ //encode names with: https://play.golang.org/p/4ethx6OEVCR
31+ void blas (void ){ //encode names with: https://play.golang.org/p/4ethx6OEVCR
3032 reg (nrm2 ,"nrm2" ,1 ); //c-func k-name arity
3133 reg (asum ,"asum" ,1 );
3234 reg (imax ,"imax" ,1 );
3335 reg (rot , "rot" ,4 );
34- reg (mv , "mv " ,7 );
36+ reg (gemv , "gemv " ,7 );
3537}
38+ __attribute((section ("reg" )))void * rblas = blas ;
0 commit comments