ALP User Documentation 0.7.0
Algebraic Programming User Documentation
blas_sparse.h
Go to the documentation of this file.
1
2/*
3 * Copyright 2021 Huawei Technologies Co., Ltd.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
26#ifndef _H_ALP_SPARSEBLAS_NIST
27#define _H_ALP_SPARSEBLAS_NIST
28
29#include "blas_sparse_vec.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
43 blas_no_trans = 0,
44 blas_trans,
45 blas_conj_trans
46};
47
54 blas_rowmajor,
55 blas_colmajor
56};
57
67typedef void * blas_sparse_matrix;
68
77blas_sparse_matrix BLAS_duscr_begin( const int m, const int n );
78
86 const double val,
87 const int row, const int col
88);
89
97 const int nnz,
98 const double * vals, const int * rows, const int * cols
99);
100
108 const int j, const int nnz,
109 const double * vals, const int * rows
110);
111
119 const int i, const int nnz,
120 const double * vals, const int * cols
121);
122
130
137
148 const enum blas_trans_type transa,
149 const double alpha, const blas_sparse_matrix A,
150 const double * const x, int incx,
151 double * const y, const int incy
152);
153
164 const enum blas_order_type order,
165 const enum blas_trans_type transa,
166 const int nrhs,
167 const double alpha, const blas_sparse_matrix A,
168 const double * B, const int ldb,
169 const double * C, const int ldc
170);
171
194 const enum blas_trans_type transa,
195 const double alpha, const blas_sparse_matrix A,
196 const extblas_sparse_vector x,
198);
199
224 const enum blas_trans_type transa,
225 const double alpha, const blas_sparse_matrix A,
226 const enum blas_trans_type transb, const blas_sparse_matrix B,
228);
229
242int EXTBLAS_dusm_nz( const blas_sparse_matrix A, int * nz );
243
260
291 const blas_sparse_matrix A,
292 double * value, int * row, int * col
293);
294
307
320
331
332#ifdef __cplusplus
333} // end extern "C"
334#endif
335
336#endif // end _H_ALP_SPARSEBLAS_NIST
337
int EXTBLAS_dusm_close(const blas_sparse_matrix A)
Closes a sparse matrix read-out.
blas_sparse_matrix BLAS_duscr_begin(const int m, const int n)
Creates a handle to a new / empty sparse matrix.
int EXTBLAS_dusmsm(const enum blas_trans_type transa, const double alpha, const blas_sparse_matrix A, const enum blas_trans_type transb, const blas_sparse_matrix B, blas_sparse_matrix C)
Performs sparse matrix–sparse matrix multiplication.
blas_trans_type
The possible transposition types.
Definition: blas_sparse.h:42
int EXTBLAS_dusm_nz(const blas_sparse_matrix A, int *nz)
Retrieves the number of nonzeroes in a given, finalised, sparse matrix.
int EXTBLAS_dusm_get(const blas_sparse_matrix A, double *value, int *row, int *col)
Retrieves a sparse matrix entry.
int EXTBLAS_free()
This function is an implementation-specific extension of SparseBLAS that clears any buffer memory tha...
int EXTBLAS_dusm_open(const blas_sparse_matrix A)
Opens a given sparse matrix for read-out.
int EXTBLAS_dusmsv(const enum blas_trans_type transa, const double alpha, const blas_sparse_matrix A, const extblas_sparse_vector x, extblas_sparse_vector y)
Performs sparse matrix–sparse vector multiplication.
int BLAS_duscr_end(blas_sparse_matrix A)
Signals that the matrix A can now be finalised – all contents have been added.
int BLAS_dusmm(const enum blas_order_type order, const enum blas_trans_type transa, const int nrhs, const double alpha, const blas_sparse_matrix A, const double *B, const int ldb, const double *C, const int ldc)
Sparse matrix–dense matrix multiplication.
int BLAS_duscr_insert_entry(blas_sparse_matrix A, const double val, const int row, const int col)
Inserts a single nonzero entry into A.
int EXTBLAS_dusm_clear(blas_sparse_matrix A)
Removes all entries from a finalised sparse matrix.
int BLAS_duscr_insert_row(blas_sparse_matrix A, const int i, const int nnz, const double *vals, const int *cols)
Inserts a row into A.
int BLAS_usds(blas_sparse_matrix A)
Frees a given matrix.
int BLAS_duscr_insert_entries(blas_sparse_matrix A, const int nnz, const double *vals, const int *rows, const int *cols)
Inserts a block of entries into A.
blas_order_type
The supported dense storages.
Definition: blas_sparse.h:53
int BLAS_dusmv(const enum blas_trans_type transa, const double alpha, const blas_sparse_matrix A, const double *const x, int incx, double *const y, const int incy)
Sparse matrix–dense vector multiplication.
void * blas_sparse_matrix
A sparse matrix.
Definition: blas_sparse.h:67
int BLAS_duscr_insert_col(blas_sparse_matrix A, const int j, const int nnz, const double *vals, const int *rows)
Inserts a column into A.
This is an ALP-specific extension to the NIST Sparse BLAS standard, which the ALP libsparseblas trans...
void * extblas_sparse_vector
A sparse vector.
Definition: blas_sparse_vec.h:34
size_t nnz(const Vector< DataType, backend, Coords > &x) noexcept
Request the number of nonzeroes in a given vector.
Definition: io.hpp:479