Method: NMatrix::BLAS.rotg

Defined in:
lib/nmatrix/blas.rb

.rotg(ab) ⇒ Object

call-seq:

rotg(ab) -> [Numeric, Numeric]

Apply givens plane rotation to the coordinates (a,b),

returning the cosine and sine of the angle theta.

Since the givens rotation includes a square root,

integers are disallowed.
  • Arguments :

    • ab -> NMatrix with two elements

  • Returns :

    • Array with the results, in the format [cos(theta), sin(theta)]

  • Raises :

    • ArgumentError -> Expected dense NMatrix of size 2

Raises:

  • (ArgumentError)


269
270
271
272
273
274
# File 'lib/nmatrix/blas.rb', line 269

def rotg(ab)
  raise(ArgumentError, "Expected dense NMatrix of shape [2,1] or [1,2]") \
   unless ab.is_a?(NMatrix) && ab.stype == :dense && ab.size == 2

  ::NMatrix::BLAS.cblas_rotg(ab)
end