Learn R Programming

gmatrix (version 0.3)

gident: Create an identity matrix on the GPU.

Description

Create an identity matrix on the GPU size

Usage

gident(n,val=1, type="d")

Arguments

n
Integer specifying the dimensions of the matrix.
val
The constant number to put on the diagonal. 1 leads to an identity matrix
type
The type of matrix to return

Value

Returns and n x n matrix with zeros on the of diagonals.

See Also

as.gmatrix and as.numeric

Examples

Run this code
ga = gident(40)
da = diag(40)
sum(h(ga) ==  da)

Run the code above in your browser using DataLab