Exemplo n.º 1
0
/* 
Compute inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA =
CblasNoTrans, CblasTrans, CblasConjTrans. When Uplo is CblasUpper then
the upper triangle of A is used, and when Uplo is CblasLower then the
lower triangle of A is used. If Diag is CblasNonUnit then the diagonal
of the matrix is used, but if Diag is CblasUnit then the diagonal
elements of the matrix A are taken as unity and are not referenced.
*/
int fff_blas_dtrsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
		    const fff_matrix * A, fff_vector * x)
{
  char* uplo = SWAP_UPLO(Uplo); 
  char* trans = SWAP_TRANS(TransA); 
  char* diag = DIAG(Diag); 
  int incx = (int) x->stride; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 

  return( FNAME(dtrsv)(uplo, trans, diag, &n, 
		       A->data, &lda, 
		       x->data, &incx) ); 
}
Exemplo n.º 2
0
/*
Compute a rank-k update of the symmetric matrix C, C = \alpha A A^T +
\beta C when Trans is CblasNoTrans and C = \alpha A^T A + \beta C when
Trans is CblasTrans. Since the matrix C is symmetric only its upper
half or lower half need to be stored. When Uplo is CblasUpper then the
upper triangle and diagonal of C are used, and when Uplo is CblasLower
then the lower triangle and diagonal of C are used.
*/
int fff_blas_dsyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, 
		    double alpha, const fff_matrix * A, double beta, fff_matrix * C)
{
  char* uplo = SWAP_UPLO(Uplo); 
  char* trans = SWAP_TRANS(Trans); 
  int n = C->size1;
  int k = (Trans == CblasNoTrans) ? (int)A->size1 : (int)A->size2;
  int lda = (int) A->tda; 
  int ldc = (int) C->tda; 
  
  return( FNAME(dsyrk)(uplo, trans, &n, &k,
		       &alpha, 
		       A->data, &lda, 
		       &beta,
		       C->data, &ldc) ); 
}
Exemplo n.º 3
0
/* Compute the matrix-vector product and sum y = \alpha op(A) x +
   \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans,
   CblasTrans, CblasConjTrans. */ 
int fff_blas_dgemv (CBLAS_TRANSPOSE_t TransA, double alpha, 
		    const fff_matrix * A, const fff_vector * x, double beta, fff_vector * y)
{
  char* trans = SWAP_TRANS(TransA); 
  int incx = (int) x->stride; 
  int incy = (int) y->stride;
  int m = (int) A->size2; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 

  return( FNAME(dgemv)(trans, &m, &n, 
		       &alpha, 
		       A->data, &lda, 
		       x->data, &incx, 
		       &beta, 
		       y->data, &incy) ); 
}
Exemplo n.º 4
0
Arquivo: fff_blas.c Projeto: Lx37/nipy
/* 
Compute inv(op(A)) x for x, where op(A) = A, A^T, A^H for TransA =
CblasNoTrans, CblasTrans, CblasConjTrans. When Uplo is CblasUpper then
the upper triangle of A is used, and when Uplo is CblasLower then the
lower triangle of A is used. If Diag is CblasNonUnit then the diagonal
of the matrix is used, but if Diag is CblasUnit then the diagonal
elements of the matrix A are taken as unity and are not referenced.
*/
int fff_blas_dtrsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag,
		    const fff_matrix * A, fff_vector * x)
{
  char* uplo = SWAP_UPLO(Uplo); 
  char* trans = SWAP_TRANS(TransA); 
  char* diag = DIAG(Diag); 
  int incx = (int) x->stride; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 
  int (*dtrsv)(char *uplo, char *trans, char *diag, int* n,
	       double* a, int* lda, double* x, int* incx); 

  dtrsv = fff_blas_func[FFF_BLAS_DTRSV];

  return( (*dtrsv)(uplo, trans, diag, &n, 
		   A->data, &lda, 
		   x->data, &incx) ); 
}
Exemplo n.º 5
0
Arquivo: fff_blas.c Projeto: Lx37/nipy
/*
Compute a rank-k update of the symmetric matrix C, C = \alpha A A^T +
\beta C when Trans is CblasNoTrans and C = \alpha A^T A + \beta C when
Trans is CblasTrans. Since the matrix C is symmetric only its upper
half or lower half need to be stored. When Uplo is CblasUpper then the
upper triangle and diagonal of C are used, and when Uplo is CblasLower
then the lower triangle and diagonal of C are used.
*/
int fff_blas_dsyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, 
		    double alpha, const fff_matrix * A, double beta, fff_matrix * C)
{
  char* uplo = SWAP_UPLO(Uplo); 
  char* trans = SWAP_TRANS(Trans); 
  int n = C->size1;
  int k = (Trans == CblasNoTrans) ? (int)A->size1 : (int)A->size2;
  int lda = (int) A->tda; 
  int ldc = (int) C->tda; 
  int (*dsyrk)(char *uplo, char *trans, int* n, int* k,
	       double* alpha, double* a, int* lda, double* beta,
	       double* c__, int* ldc); 
  
  dsyrk = fff_blas_func[FFF_BLAS_DSYRK];

  return( (*dsyrk)(uplo, trans, &n, &k,
		   &alpha, 
		   A->data, &lda, 
		   &beta,
		   C->data, &ldc) ); 
}
Exemplo n.º 6
0
Arquivo: fff_blas.c Projeto: Lx37/nipy
/* Compute the matrix-vector product and sum y = \alpha op(A) x +
   \beta y, where op(A) = A, A^T, A^H for TransA = CblasNoTrans,
   CblasTrans, CblasConjTrans. */ 
int fff_blas_dgemv (CBLAS_TRANSPOSE_t TransA, double alpha, 
		    const fff_matrix * A, const fff_vector * x, double beta, fff_vector * y)
{
  char* trans = SWAP_TRANS(TransA); 
  int incx = (int) x->stride; 
  int incy = (int) y->stride;
  int m = (int) A->size2; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 
  int (*dgemv)(char *trans, int* m, int* n, double* 
	       alpha, double* a, int* lda, double* x, int* incx,
	       double* beta, double* y, int* incy);

  dgemv = fff_blas_func[FFF_BLAS_DGEMV];

  return( (*dgemv)(trans, &m, &n, 
		   &alpha, 
		   A->data, &lda, 
		   x->data, &incx, 
		   &beta, 
		   y->data, &incy) ); 
}