コード例 #1
0
ファイル: fff_blas.c プロジェクト: FNNDSC/nipy
/* 
Compute the symmetric rank-1 update A = \alpha x x^T + A of the
symmetric matrix A. Since the matrix A is symmetric only its upper
half or lower half need to be stored. When Uplo is CblasUpper then the
upper triangle and diagonal of A are used, and when Uplo is CblasLower
then the lower triangle and diagonal of A are used.
*/
int fff_blas_dsyr (CBLAS_UPLO_t Uplo, double alpha, const fff_vector * x, fff_matrix * A)
{
  char* uplo = SWAP_UPLO(Uplo); 
  int incx = (int) x->stride; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 

  return( FNAME(dsyr)(uplo, &n, 
		      &alpha, 
		      x->data, &incx, 
		      A->data, &lda ) ); 
}
コード例 #2
0
ファイル: fff_blas.c プロジェクト: FNNDSC/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; 

  return( FNAME(dtrsv)(uplo, trans, diag, &n, 
		       A->data, &lda, 
		       x->data, &incx) ); 
}
コード例 #3
0
ファイル: fff_blas.c プロジェクト: Lx37/nipy
/* 
Compute the symmetric rank-1 update A = \alpha x x^T + A of the
symmetric matrix A. Since the matrix A is symmetric only its upper
half or lower half need to be stored. When Uplo is CblasUpper then the
upper triangle and diagonal of A are used, and when Uplo is CblasLower
then the lower triangle and diagonal of A are used.
*/
int fff_blas_dsyr (CBLAS_UPLO_t Uplo, double alpha, const fff_vector * x, fff_matrix * A)
{
  char* uplo = SWAP_UPLO(Uplo); 
  int incx = (int) x->stride; 
  int n = (int) A->size1; 
  int lda = (int) A->tda; 
  int (*dsyr)(char *uplo, int* n, double* alpha,
	      double* x, int* incx, double* a, int* lda); 

  dsyr = fff_blas_func[FFF_BLAS_DSYR];

  return( (*dsyr)(uplo, &n, 
		  &alpha, 
		  x->data, &incx, 
		  A->data, &lda ) ); 
}
コード例 #4
0
ファイル: fff_blas.c プロジェクト: FNNDSC/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; 
  
  return( FNAME(dsyrk)(uplo, trans, &n, &k,
		       &alpha, 
		       A->data, &lda, 
		       &beta,
		       C->data, &ldc) ); 
}
コード例 #5
0
ファイル: fff_blas.c プロジェクト: FNNDSC/nipy
int fff_blas_dsymv (CBLAS_UPLO_t Uplo, 
		    double alpha, const fff_matrix * A, 
		    const fff_vector * x, double beta, fff_vector * y)
{
  char* uplo = SWAP_UPLO(Uplo); 
  int incx = (int) x->stride; 
  int incy = (int) y->stride;
  int n = (int) A->size1; 
  int lda = (int) A->tda; 

  return( FNAME(dsymv)(uplo, &n, 
		       &alpha, 
		       A->data, &lda, 
		       x->data, &incx, 
		       &beta, 
		       y->data, &incy) ); 
}
コード例 #6
0
ファイル: fff_blas.c プロジェクト: 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) ); 
}
コード例 #7
0
ファイル: fff_blas.c プロジェクト: FNNDSC/nipy
/*
Compute the inverse-matrix matrix product B = \alpha op(inv(A))B for
Side is CblasLeft and B = \alpha B op(inv(A)) for Side is
CblasRight. The matrix A is triangular and 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 A 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_dtrsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 
		    double alpha, const fff_matrix * A, fff_matrix * B)
{
  char* side = SWAP_SIDE(Side); 
  char* uplo = SWAP_UPLO(Uplo); 
  char* transa = TRANS(TransA); 
  char* diag = DIAG(Diag); 
  int m = B->size2; 
  int n = B->size1;
  int lda = (int) A->tda; 
  int ldb = (int) B->tda; 

  return( FNAME(dtrsm)(side, uplo, transa, diag, &m, &n, 
		       &alpha, 
		       A->data, &lda, 
		       B->data, &ldb) ); 
  
}
コード例 #8
0
ファイル: fff_blas.c プロジェクト: FNNDSC/nipy
/*
Compute the matrix-matrix product and sum C = \alpha A B + \beta C for
Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight,
where the matrix A is symmetric. When Uplo is CblasUpper then the
upper triangle and diagonal of A are used, and when Uplo is CblasLower
then the lower triangle and diagonal of A are used.
*/
int fff_blas_dsymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, 
		    double alpha, const fff_matrix * A, const fff_matrix * B, double beta, fff_matrix * C)
{
  char* side = SWAP_SIDE(Side); 
  char* uplo = SWAP_UPLO(Uplo); 
  int m = C->size2; 
  int n = C->size1;
  int lda = (int) A->tda; 
  int ldb = (int) B->tda; 
  int ldc = (int) C->tda; 

  return ( FNAME(dsymm)(side, uplo, &m, &n,
			&alpha, 
			A->data, &lda, 
			B->data, &ldb,
			&beta, 
			C->data, &ldc) ); 
}
コード例 #9
0
ファイル: fff_blas.c プロジェクト: 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) ); 
}
コード例 #10
0
ファイル: fff_blas.c プロジェクト: Lx37/nipy
/* 
Compute the matrix-vector product and sum y = \alpha A x + \beta y for
the symmetric matrix A. Since the matrix A is symmetric only its upper
half or lower half need to be stored. When Uplo is CblasUpper then the
upper triangle and diagonal of A are used, and when Uplo is CblasLower
then the lower triangle and diagonal of A are used.
*/
int fff_blas_dsymv (CBLAS_UPLO_t Uplo, 
		    double alpha, const fff_matrix * A, 
		    const fff_vector * x, double beta, fff_vector * y)
{
  char* uplo = SWAP_UPLO(Uplo); 
  int incx = (int) x->stride; 
  int incy = (int) y->stride;
  int n = (int) A->size1; 
  int lda = (int) A->tda; 
  int (*dsymv)(char *uplo, int* n, double* alpha,
	       double* a, int* lda, double* x, int* incx, double
	       *beta, double* y, int* incy);

  dsymv = fff_blas_func[FFF_BLAS_DSYMV];
  
  return( (*dsymv)(uplo, &n, 
		   &alpha, 
		   A->data, &lda, 
		   x->data, &incx, 
		   &beta, 
		   y->data, &incy) ); 
}
コード例 #11
0
ファイル: fff_blas.c プロジェクト: Lx37/nipy
/*
Compute the inverse-matrix matrix product B = \alpha op(inv(A))B for
Side is CblasLeft and B = \alpha B op(inv(A)) for Side is
CblasRight. The matrix A is triangular and 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 A 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_dtrsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 
		    double alpha, const fff_matrix * A, fff_matrix * B)
{
  char* side = SWAP_SIDE(Side); 
  char* uplo = SWAP_UPLO(Uplo); 
  char* transa = TRANS(TransA); 
  char* diag = DIAG(Diag); 
  int m = B->size2; 
  int n = B->size1;
  int lda = (int) A->tda; 
  int ldb = (int) B->tda; 
  int (*dtrsm)(char *side, char *uplo, char *transa, char *diag,
	       int* m, int* n, double* alpha, double* a, int* 
	       lda, double* b, int* ldb); 
  
  dtrsm = fff_blas_func[FFF_BLAS_DTRSM];

  return( (*dtrsm)(side, uplo, transa, diag, &m, &n, 
		   &alpha, 
		   A->data, &lda, 
		   B->data, &ldb) ); 
  
}
コード例 #12
0
ファイル: fff_blas.c プロジェクト: Lx37/nipy
/*
Compute the matrix-matrix product and sum C = \alpha A B + \beta C for
Side is CblasLeft and C = \alpha B A + \beta C for Side is CblasRight,
where the matrix A is symmetric. When Uplo is CblasUpper then the
upper triangle and diagonal of A are used, and when Uplo is CblasLower
then the lower triangle and diagonal of A are used.
*/
int fff_blas_dsymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, 
		    double alpha, const fff_matrix * A, const fff_matrix * B, double beta, fff_matrix * C)
{
  char* side = SWAP_SIDE(Side); 
  char* uplo = SWAP_UPLO(Uplo); 
  int m = C->size2; 
  int n = C->size1;
  int lda = (int) A->tda; 
  int ldb = (int) B->tda; 
  int ldc = (int) C->tda; 
  int (*dsymm)(char *side, char *uplo, int* m, int* n,
	       double* alpha, double* a, int* lda, double* b,
	       int* ldb, double* beta, double* c__, int* ldc); 
  
  dsymm = fff_blas_func[FFF_BLAS_DSYMM];

  return ( (*dsymm)(side, uplo, &m, &n,
		    &alpha, 
		    A->data, &lda, 
		    B->data, &ldb,
		    &beta, 
		    C->data, &ldc) ); 
}