/*---------------------------------------------------------------------------* * IT++ * *---------------------------------------------------------------------------* * Copyright (c) 1995-2003 by Tony Ottosson, Thomas Eriksson, Pål Frenger, * * Tobias Ringström, and Jonas Samuelsson. * * * * Permission to use, copy, modify, and distribute this software and its * * documentation under the terms of the GNU General Public License is hereby * * granted. No representations are made about the suitability of this * * software for any purpose. It is provided "as is" without expressed or * * implied warranty. See the GNU General Public License for more details. * *---------------------------------------------------------------------------*/ /*! \file \brief Implementation of Class for the Extended Golay Code (24,12,8). \author Tony Ottosson 1.4 2003/05/22 08:55:20 */ #include "base/specmat.h" #include "comm/egolay.h" #include "comm/commfunc.h" #include namespace itpp { Extended_Golay::Extended_Golay(void) { B="0 1 1 1 1 1 1 1 1 1 1 1;1 1 1 0 1 1 1 0 0 0 1 0;1 1 0 1 1 1 0 0 0 1 0 1;1 0 1 1 1 0 0 0 1 0 1 1;1 1 1 1 0 0 0 1 0 1 1 0;1 1 1 0 0 0 1 0 1 1 0 1;1 1 0 0 0 1 0 1 1 0 1 1;1 0 0 0 1 0 1 1 0 1 1 1;1 0 0 1 0 1 1 0 1 1 1 0;1 0 1 0 1 1 0 1 1 1 0 0;1 1 0 1 1 0 1 1 1 0 0 0;1 0 1 1 0 1 1 1 0 0 0 1"; G = concat_horizontal(eye_b(12), B); } bvec Extended_Golay::encode(const bvec &uncoded_bits) { int no_bits = uncoded_bits.length(); int no_blocks = (int)floor((double)no_bits/12); bvec output(24*no_blocks); bmat Gt = G.T(); int i; for (i=0; i