Method: NMatrix::LAPACK.laswp

Defined in:
lib/nmatrix/lapack_core.rb

.laswp(matrix, ipiv) ⇒ Object

laswp(matrix, ipiv) -> NMatrix

Permute the columns of a matrix (in-place) according to the Array ipiv.

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
# File 'lib/nmatrix/lapack_core.rb', line 69

def laswp(matrix, ipiv)
  raise(ArgumentError, "expected NMatrix for argument 0") unless matrix.is_a?(NMatrix)
  raise(StorageTypeError, "LAPACK functions only work on :dense NMatrix instances") unless matrix.stype == :dense
  raise(ArgumentError, "expected Array ipiv to have no more entries than NMatrix a has columns") if ipiv.size > matrix.shape[1]

  clapack_laswp(matrix.shape[0], matrix, matrix.shape[1], 0, ipiv.size-1, ipiv, 1)
end