Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
Functions

Interface to BLAS routines. More...

Functions

template<typename ArrayType >
int cusp::blas::amax (const ArrayType &x)
 index of the largest element in a array More...
 
template<typename ArrayType >
cusp::norm_type< typename
ArrayType::value_type >::type 
cusp::blas::asum (const ArrayType &x)
 sum of absolute value of all entries in array More...
 
template<typename ArrayType1 , typename ArrayType2 , typename ScalarType >
void cusp::blas::axpy (const ArrayType1 &x, ArrayType2 &y, const ScalarType alpha)
 scaled vector addition (y = alpha * x + y) More...
 
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 , typename ScalarType1 , typename ScalarType2 >
void cusp::blas::axpby (const ArrayType1 &x, const ArrayType2 &y, ArrayType3 &z, ScalarType1 alpha, ScalarType2 beta)
 compute linear combination of two vectors (z = alpha * x + beta * y) More...
 
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 , typename ArrayType4 , typename ScalarType1 , typename ScalarType2 , typename ScalarType3 >
void cusp::blas::axpbypcz (const ArrayType1 &x, const ArrayType2 &y, const ArrayType3 &z, ArrayType4 &w, ScalarType1 alpha, ScalarType2 beta, ScalarType3 gamma)
 compute linear combination of three vectors (output = alpha * x + beta * y + gamma * z) More...
 
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 >
void cusp::blas::xmy (const ArrayType1 &x, const ArrayType2 &y, ArrayType3 &z)
 elementwise multiplication of two vectors (z[i] = x[i] * y[i]) More...
 
template<typename ArrayType1 , typename ArrayType2 >
void cusp::blas::copy (const ArrayType1 &x, ArrayType2 &y)
 vector copy (y = x) More...
 
template<typename ArrayType1 , typename ArrayType2 >
ArrayType1::value_type cusp::blas::dot (const ArrayType1 &x, const ArrayType2 &y)
 dot product (x^T * y) More...
 
template<typename ArrayType1 , typename ArrayType2 >
ArrayType1::value_type cusp::blas::dotc (const ArrayType1 &x, const ArrayType2 &y)
 conjugate dot product (conjugate(x)^T * y) More...
 
template<typename ArrayType , typename ScalarType >
void cusp::blas::fill (ArrayType &x, const ScalarType alpha)
 vector fill (x[i] = alpha) More...
 
template<typename ArrayType >
cusp::norm_type< typename
ArrayType::value_type >::type 
cusp::blas::nrm1 (const ArrayType &x)
 vector 1-norm (sum abs(x[i])) More...
 
template<typename ArrayType >
cusp::norm_type< typename
ArrayType::value_type >::type 
cusp::blas::nrm2 (const ArrayType &x)
 vector 2-norm (sqrt(sum x[i] * x[i] ) More...
 
template<typename ArrayType >
cusp::norm_type< typename
ArrayType::value_type >::type 
cusp::blas::nrmmax (const ArrayType &x)
 vector infinity norm More...
 
template<typename ArrayType , typename ScalarType >
void cusp::blas::scal (ArrayType &x, const ScalarType alpha)
 scale vector (x[i] = alpha * x[i]) More...
 
template<typename Array2d1 , typename Array1d1 , typename Array1d2 >
void cusp::blas::gemv (const Array2d1 &A, const Array1d1 &x, Array1d2 &y)
 Computes a matrix-vector product using a general matrix. More...
 
template<typename Array1d1 , typename Array1d2 , typename Array2d1 >
void cusp::blas::ger (const Array1d1 &x, const Array1d2 &y, Array2d1 &A)
 Performs a rank-1 update of a general matrix. More...
 
template<typename Array2d1 , typename Array1d1 , typename Array1d2 >
void cusp::blas::symv (const Array2d1 &A, const Array1d1 &x, Array1d2 &y)
 Computes a matrix-vector product using a symmetric matrix. More...
 
template<typename Array1d , typename Array2d >
void cusp::blas::syr (const Array1d &x, Array2d &A)
 Performs a rank-1 update of a symmetric matrix. More...
 
template<typename Array2d , typename Array1d >
void cusp::blas::trmv (const Array2d &A, Array1d &x)
 Computes a matrix-vector product using a triangular matrix. More...
 
template<typename Array2d , typename Array1d >
void cusp::blas::trsv (const Array2d &A, Array1d &x)
 Solve a triangular matrix equation. More...
 
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::gemm (const Array2d1 &A, const Array2d2 &B, Array2d3 &C)
 Computes a matrix-matrix product with general matrices. More...
 
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::symm (const Array2d1 &A, const Array2d2 &B, Array2d3 &C)
 Computes a matrix-matrix product where one input matrix is symmetric. More...
 
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::syrk (const Array2d1 &A, Array2d2 &B)
 Performs a symmetric rank-k update. More...
 
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::syr2k (const Array2d1 &A, const Array2d2 &B, Array2d3 &C)
 Performs a symmetric rank-2k update. More...
 
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::trmm (const Array2d1 &A, Array2d2 &B)
 Computes a matrix-matrix product where one input matrix is triangular. More...
 
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::trsm (const Array2d1 &A, Array2d2 &B)
 Solve a triangular matrix equation. More...
 

Function Documentation

template<typename ArrayType >
int cusp::blas::amax ( const ArrayType &  x)

index of the largest element in a array

Template Parameters
ArrayTypeType of the input array
Parameters
xThe input array to find max value
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array
// fill x array with random values
// find index of max absolute value in x
int index = cusp::blas::amax(x);
std::cout << "Max value at pos: " << index << std::endl;
return 0;
}
template<typename ArrayType >
cusp::norm_type<typename ArrayType::value_type>::type cusp::blas::asum ( const ArrayType &  x)

sum of absolute value of all entries in array

Template Parameters
ArrayTypeType of the input array
Parameters
xThe input array to compute sum of absolute values
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array
// fill x array with random values
// find index of max absolute value in x
float sum = cusp::blas::asum(x);
std::cout << "asum(x) =" << sum << std::endl;
return 0;
}
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 , typename ScalarType1 , typename ScalarType2 >
void cusp::blas::axpby ( const ArrayType1 &  x,
const ArrayType2 &  y,
ArrayType3 &  z,
ScalarType1  alpha,
ScalarType2  beta 
)

compute linear combination of two vectors (z = alpha * x + beta * y)

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
ArrayType3Type of the third input array
ScalarType1Type of the first scale factor
ScalarType2Type of the second scale factor
Parameters
xThe first input array
yThe second input array
zThe output array to store the result
alphaThe scale factor applied to array x
betaThe scale factor applied to array y
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create two empty source arrays
// create a destination array
// fill x array with random values
cusp::blas::copy(rand1, x);
// fill y array with random values
cusp::blas::copy(rand2, y);
// compute z = 1.5*x + 2.0*y
cusp::blas::axpby(x, y, z, 1.5, 2.0);
return 0;
}
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 , typename ArrayType4 , typename ScalarType1 , typename ScalarType2 , typename ScalarType3 >
void cusp::blas::axpbypcz ( const ArrayType1 &  x,
const ArrayType2 &  y,
const ArrayType3 &  z,
ArrayType4 &  w,
ScalarType1  alpha,
ScalarType2  beta,
ScalarType3  gamma 
)

compute linear combination of three vectors (output = alpha * x + beta * y + gamma * z)

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
ArrayType3Type of the third input array
ArrayType4Type of the input/output array
ScalarType1Type of the first scale factor
ScalarType2Type of the second scale factor
ScalarType3Type of the third scale factor
Parameters
xThe first input array
yThe second input array
zThe third input array
wThe output array to store the result
alphaThe scale factor applied to array x
betaThe scale factor applied to array y
gammaThe scale factor applied to array z
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create two empty source arrays
// create a destination array
// fill x array with random values
cusp::blas::copy(rand1, x);
// fill y array with random values
cusp::blas::copy(rand2, y);
// fill z array with random values
cusp::blas::copy(rand3, z);
// compute w = 1.5*x + 2.0*y + 2.1*z
cusp::blas::axpbypcz(x, y, z, w, 1.5, 2.0, 2.1);
return 0;
}
template<typename ArrayType1 , typename ArrayType2 , typename ScalarType >
void cusp::blas::axpy ( const ArrayType1 &  x,
ArrayType2 &  y,
const ScalarType  alpha 
)

scaled vector addition (y = alpha * x + y)

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
ScalarTypeType of the scale factor
Parameters
xThe input array
yThe output array to store the result
alphaThe scale factor applied to array x
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty source array
// create a destination array filled with 1s
// fill x array with random values
cusp::blas::copy(rand, x);
// compute y += 1.5*x
cusp::blas::axpy(x, y, 1.5);
return 0;
}
Examples:
blas.cu.
template<typename ArrayType1 , typename ArrayType2 >
void cusp::blas::copy ( const ArrayType1 &  x,
ArrayType2 &  y 
)

vector copy (y = x)

Template Parameters
ArrayType1Type of the input array
ArrayType2Type of the output array
Parameters
xThe input array
yThe output array
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array filled with 2s
// create an empty array
// copy array x into y
return 0;
}
template<typename ArrayType1 , typename ArrayType2 >
ArrayType1::value_type cusp::blas::dot ( const ArrayType1 &  x,
const ArrayType2 &  y 
)

dot product (x^T * y)

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
Parameters
xThe first input array
yThe second input array
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array filled with 2s
// create an array filled with 3s
// compute dot product of array x into y
float value = cusp::blas::dot(x, y);
return 0;
}
template<typename ArrayType1 , typename ArrayType2 >
ArrayType1::value_type cusp::blas::dotc ( const ArrayType1 &  x,
const ArrayType2 &  y 
)

conjugate dot product (conjugate(x)^T * y)

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
Parameters
xThe first input array
yThe second input array
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array filled with 2s
// create an array filled with 3s
// compute dot product of array x into y
float value = cusp::blas::dotc(x, y);
return 0;
}
Examples:
blas.cu.
template<typename ArrayType , typename ScalarType >
void cusp::blas::fill ( ArrayType &  x,
const ScalarType  alpha 
)

vector fill (x[i] = alpha)

Template Parameters
ArrayTypeType of the input array
ScalarTypeType of the fill value
Parameters
xThe input array to fill
alphaValue to fill array x
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array
// fill x array with 1s
return 0;
}
Examples:
array1d.cu, and gmres.cu.
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::gemm ( const Array2d1 &  A,
const Array2d2 &  B,
Array2d3 &  C 
)

Computes a matrix-matrix product with general matrices.

Template Parameters
Array2d1Type of the first input matrix
Array2d2Type of the second input matrix
Array2d3Type of the output matrix
Parameters
AFirst input matrix
BSecond input matrix
COutput matrix
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// allocate space for output matrix
cusp::array2d<float,cusp::host_memory> B(A.num_rows, A.num_cols);
// compute output matrix
cusp::blas::gemm(A, A, B);
// print the contents of B
return 0;
}
template<typename Array2d1 , typename Array1d1 , typename Array1d2 >
void cusp::blas::gemv ( const Array2d1 &  A,
const Array1d1 &  x,
Array1d2 &  y 
)

Computes a matrix-vector product using a general matrix.

Template Parameters
Array2d1Type of the input matrix
Array1d1Type of the input vector
Array1d2Type of the output vector
Parameters
AGeneral matrix
xInput vector
xOutput vector
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// create an random dense array
cusp::random_array<float> rand(A.num_rows);
// create an empty output array
// multiply A and x to produce y
cusp::blas::gemv(A, x, y);
// print the contents of y
return 0;
}
template<typename Array1d1 , typename Array1d2 , typename Array2d1 >
void cusp::blas::ger ( const Array1d1 &  x,
const Array1d2 &  y,
Array2d1 &  A 
)

Performs a rank-1 update of a general matrix.

Template Parameters
Array1d1Type of the first input array
Array1d2Type of the second input array
Array2d1Type of the output matrix
Parameters
xFirst n-element array
ySecond n-element array
AAn n-by-n general matrix
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create 2 random dense arrays
// create an empty dense matrix structure
// compute n-by-n general update
cusp::blas::ger(x, y, A);
// print the contents of A
return 0;
}
template<typename ArrayType >
cusp::norm_type<typename ArrayType::value_type>::type cusp::blas::nrm1 ( const ArrayType &  x)

vector 1-norm (sum abs(x[i]))

Template Parameters
ArrayTypeType of the input array
Parameters
xThe input array to find 2-norm
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array initially filled with random values
cusp::blas::copy(rand, x);
// compute and print 1-norm
float nrm_x = cusp::blas::nrm1(x);
std::cout << "nrm1(x) = " << nrm_x << std::endl;
return 0;
}
Examples:
blas.cu.
template<typename ArrayType >
cusp::norm_type<typename ArrayType::value_type>::type cusp::blas::nrm2 ( const ArrayType &  x)

vector 2-norm (sqrt(sum x[i] * x[i] )

Template Parameters
ArrayTypeType of the input array
Parameters
xThe input array to find 2-norm
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array initially filled with random values
cusp::blas::copy(rand, x);
// compute and print 2-norm
float nrm_x = cusp::blas::nrm2(x);
std::cout << "nrm2(x) = " << nrm_x << std::endl;
return 0;
}
Examples:
blas.cu.
template<typename ArrayType >
cusp::norm_type<typename ArrayType::value_type>::type cusp::blas::nrmmax ( const ArrayType &  x)

vector infinity norm

Template Parameters
ArrayTypeType of the input array
Parameters
xThe input array to find infinity norm
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array initially filled with random values
cusp::blas::copy(rand, x);
// compute and print infinity norm
float nrm_x = cusp::blas::nrmmax(x);
std::cout << "nrmmax(x) = " << nrm_x << std::endl;
return 0;
}
Examples:
blas.cu.
template<typename ArrayType , typename ScalarType >
void cusp::blas::scal ( ArrayType &  x,
const ScalarType  alpha 
)

scale vector (x[i] = alpha * x[i])

Template Parameters
ArrayTypeType of the input array
ScalarTypeType of the scalar value
Parameters
xThe input array to scale
alphaThe scale factor
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array initially filled with 2s
// scal x by 2
// print the scaled vector
return 0;
}
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::symm ( const Array2d1 &  A,
const Array2d2 &  B,
Array2d3 &  C 
)

Computes a matrix-matrix product where one input matrix is symmetric.

Template Parameters
Array2d1Type of the first symmetric input matrix
Array2d2Type of the second input matrix
Array2d3Type of the output matrix
Parameters
AFirst symmetric input matrix
BSecond input matrix
COutput matrix
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// allocate space for output matrix
cusp::array2d<float,cusp::host_memory> B(A.num_rows, A.num_cols);
// compute output matrix
cusp::blas::symm(A, A, B);
// print the contents of B
return 0;
}
template<typename Array2d1 , typename Array1d1 , typename Array1d2 >
void cusp::blas::symv ( const Array2d1 &  A,
const Array1d1 &  x,
Array1d2 &  y 
)

Computes a matrix-vector product using a symmetric matrix.

Template Parameters
Array2d1Type of the input matrix
Array1d1Type of the input vector
Array1d2Type of the output vector
Parameters
ASymmetric matrix
xInput vector
xOutput vector
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// create an random dense array
cusp::random_array<float> rand(A.num_rows);
// create an empty output array
// multiply A and x to produce y
cusp::blas::symv(A, x, y);
// print the contents of y
return 0;
}
template<typename Array1d , typename Array2d >
void cusp::blas::syr ( const Array1d &  x,
Array2d &  A 
)

Performs a rank-1 update of a symmetric matrix.

Template Parameters
Array1dType of the input array
Array2dType of the output matrix
Parameters
xAn n-element array
AAn n-by-n symmetric matrix
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an random dense array
// create an empty dense matrix structure
// compute rank-1 update
// print the contents of A
return 0;
}
template<typename Array2d1 , typename Array2d2 , typename Array2d3 >
void cusp::blas::syr2k ( const Array2d1 &  A,
const Array2d2 &  B,
Array2d3 &  C 
)

Performs a symmetric rank-2k update.

Template Parameters
Array2d1Type of the first input matrix
Array2d2Type of the second input matrix
Array2d3Type of the output matrix
Parameters
AFirst input matrix
BSecond input matrix
COutput matrix
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// allocate space for output matrix
cusp::array2d<float,cusp::host_memory> B(A.num_rows, A.num_cols);
// compute rank-2 update
// print the contents of B
return 0;
}
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::syrk ( const Array2d1 &  A,
Array2d2 &  B 
)

Performs a symmetric rank-k update.

Template Parameters
Array2d1Type of the first input matrix
Array2d2Type of the second input matrix
Array2d3Type of the output matrix
Parameters
AFirst input matrix
BSecond input matrix
COutput matrix
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// allocate space for output matrix
cusp::array2d<float,cusp::host_memory> B(A.num_rows, A.num_cols);
// compute rank-k update
// print the contents of B
return 0;
}
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::trmm ( const Array2d1 &  A,
Array2d2 &  B 
)

Computes a matrix-matrix product where one input matrix is triangular.

Template Parameters
Array2d1Type of the first triangular input matrix
Array2d2Type of the second input matrix
Array2d3Type of the output matrix
Parameters
AFirst triangular input matrix
BSecond input matrix
COutput matrix
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// allocate space for output matrix
cusp::array2d<float,cusp::host_memory> B(A.num_rows, A.num_cols);
// compute output matrix
cusp::blas::trmm(A, A, B);
// print the contents of B
return 0;
}
template<typename Array2d , typename Array1d >
void cusp::blas::trmv ( const Array2d &  A,
Array1d &  x 
)

Computes a matrix-vector product using a triangular matrix.

Template Parameters
Array2d1Type of the input matrix
Array1d1Type of the input vector
Array1d2Type of the output vector
Parameters
ATriangular matrix
xInput vector
xOutput vector
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// create an random dense array
cusp::random_array<float> rand(A.num_rows);
// create an empty output array
// multiply A and x to produce y
cusp::blas::trmv(A, x, y);
// print the contents of y
return 0;
}
template<typename Array2d1 , typename Array2d2 >
void cusp::blas::trsm ( const Array2d1 &  A,
Array2d2 &  B 
)

Solve a triangular matrix equation.

Template Parameters
Array2d1Type of the first input matrix
Array2d2Type of the output matrix
Parameters
AContains the upper or lower triangle of a symmetric matrix
BContains block of right-hand side vectors
Example
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// create a set of random RHS vectors
// fill B with random values
cusp::random_array<float> rand(B.num_entries);
cusp::blas::copy(rand, B.values);
// solve multiple RHS vectors
// print the contents of B
return 0;
}
template<typename Array2d , typename Array1d >
void cusp::blas::trsv ( const Array2d &  A,
Array1d &  x 
)

Solve a triangular matrix equation.

Template Parameters
Array2dType of the symmetric input matrix
Array1dType of the input right-hand side
Parameters
AUpper or lower triangle of a symmetric matrix
xRight-hand side vector
Example
#include <cusp/array1d.h>
#include <cusp/array2d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an empty dense matrix structure
// create 2D Poisson problem
// create an random dense array
cusp::random_array<float> rand(A.num_rows);
// solve for RHS vector
// print the contents of x
return 0;
}
template<typename ArrayType1 , typename ArrayType2 , typename ArrayType3 >
void cusp::blas::xmy ( const ArrayType1 &  x,
const ArrayType2 &  y,
ArrayType3 &  z 
)

elementwise multiplication of two vectors (z[i] = x[i] * y[i])

Template Parameters
ArrayType1Type of the first input array
ArrayType2Type of the second input array
ArrayType3Type of the output array
Parameters
xThe first input array
yThe second input array
zThe output array
Example
#include <cusp/array1d.h>
#include <cusp/print.h>
// include cusp blas header file
#include <cusp/blas/blas.h>
int main()
{
// create an array filled with 2s
// create an array filled with 3s
// create an empty array
// multiply arrays x and y
cusp::blas::xmy(x, y, z);
return 0;
}
Examples:
blas.cu.