function q2 = q8_conjugate ( q )

%*****************************************************************************80
%
%% Q8_CONJUGATE conjugates a quaternion.
%
%  Discussion:
%
%    A quaternion is a quadruplet (A,B,C,D) of real numbers, which
%    may be written as
%
%      Q = A + Bi + Cj + Dk.
%
%    The conjugate of Q is
%
%      conj ( Q ) = A - Bi - Cj - Dk.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    22 July 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real Q(4), the quaternion to be conjugated.
%
%    Output, real Q2(4), the conjugated quaternion.
%
  q2 = zeros ( 4, 1 );

  q2(1)   =   q(1);
  q2(2:4) = - q(2:4);

  return
end
