Main Content

comm.gpu.LDPCDecoder

Decode binary low-density parity-check (LDPC) code with GPU

To use this object, you must install Parallel Computing Toolbox™ and have access to an appropriate GPU. For more about GPUs, seeGPU Computing(Parallel Computing Toolbox).

Description

A GPU-based System object™ accepts typical MATLAB®arrays or objects created using thegpuArrayclass. A GPU-based System object supports input signals with double- or single-precision data types. The output signal inherits its data type from the input signal.

  • If the input signal is a MATLAB array, the System object handles data transfer between the CPU and the GPU. The output signal is a MATLAB array.

  • If the input signal is agpuArray, the data remains on the GPU. The output signal is agpuArray. When the object is given agpuArray, calculations take place entirely on the GPU, and no data transfer occurs. PassinggpuArrayarguments provides increased performance by reducing simulation time. For more information, seeEstablish Arrays on a GPU(Parallel Computing Toolbox).

Thecomm.gpu.LDPCDecoderSystem object uses the belief propagation algorithm to decode a binary LDPC code, which is input to the object as the soft-decision output (log-likelihood ratio of received bits) from demodulation. The object decodes generic binary LDPC codes where no patterns in the parity-check matrix are assumed. For more information, seeBelief Propagation Decoding.

To decode an LDPC-encoded signal:

  1. Create thecomm.gpu.LDPCDecoderobject and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, seeWhat Are System Objects?

Creation

Description

example

gpu_ldpcdecoder= comm.gpu.LDPCDecodercreates a GPU-based binary LDPC decoder System object. This object performs LDPC decoding based on the specified parity-check matrix.

gpu_ldpcdecoder= comm.gpu.LDPCDecoder(parity)sets theParityCheckMatrixproperty toparityand creates a GPU-based LDPC decoder System object. Theparityinput must be specified as described by theParityCheckMatrixproperty.

gpu_ldpcdecoder= comm.gpu.LDPCDecoder(___,Name,Value)sets properties using one or more name-value pairs, in addition to inputs from any of the prior syntaxes. For example,comm.LDPCDecoder('DecisionMethod','Soft decision')configures an LDPC decoder System object to decode data using the soft-decision method and output log-likelihood ratios of data typedouble. Enclose each property name in quotes.

Properties

expand all

Unless otherwise indicated, properties arenontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and thereleasefunction unlocks them.

If a property istunable, you can change its value at any time.

For more information on changing property values, seeSystem Design in MATLAB Using System Objects.

Parity-check matrix, specified as a sparse (NK)-by-Nbinary-valued matrix.Nis the length of the received signal and must be in the range (0, 231).Kis the length of the uncoded message and must be less thanN. The last (NK) columns in the parity-check matrix must be an invertible matrix in the Galois field of order 2,gf(2).

You can also specify the parity-check matrix as a two-column nonsparse index matrix,I, that defines the row and column indices of the1s in the parity-check matrix such thatsparse(I(:,1),I(:,2),1).

This property accepts numeric data types. When you set this property to a sparse binary matrix, this property also accepts thelogicaldata type.

The default value uses thedvbs2ldpcfunction to configure a sparse parity-check matrix for half-rate LDPC coding, as specified in the DVB-S.2 standard.

Example:dvbs2ldpc(R,'indices')configures the index matrix for the DVB-S.2 standard, whereRis the code rate, and'indices'specifies the output format ofdvbs2ldpcas a two-column double-precision matrix that defines the row and column indices of the1s in the parity-check matrix.

Data Types:double|logical

Output value format, specified as one of these values:

  • 'Information part'— The object outputs aK-by-1 column vector containing only the information-part of the received log-likelihood ratio vector.Kis the length of the uncoded message.

  • 'Whole codeword'— The object outputs anN-by-1 column vector containing the whole log-likelihood ratio vector.Nis the length of the received signal.

    NandKmust align with the dimension of the (NK)-by-Kparity-check matrix.

Data Types:char

Decision method used for decoding, specified as one of these values:

  • 'Hard decision'— The object outputs decoded data of data typelogical.

  • 'Soft decision'— The object outputs log-likelihood ratios of data typedouble.

Data Types:char

Condition for iteration termination, specified as one of these values:

  • 'Maximum iteration count'— Decoding terminates after the number of iterations specified by theMaximumIterationCountproperty.

  • 'Parity check satisfied'— Decoding terminates after all parity checks are satisfied. If not all parity checks are satisfied, decoding terminates after the number of iterations specified by theMaximumIterationCountproperty.

Data Types:char

最大数量的解码迭代, specified as a positive integer.

Data Types:double

Output number of iterations executed, specified asfalseortrue. To output the number of iterations executed, set this property totrue.

Data Types:logical

Output final parity checks, specified asfalseortrue. To output the final calculated parity checks, set this property totrue.

Data Types:logical

Usage

Description

example

y= gpu_ldpcdecoder(x)decodes input data using an LDPC code based on the default parity-check matrix.

[y,numiter] = gpu_ldpcdecoder(x)returns the decoded data,y, and number of iterations performed,numiter. To use this syntax, set theNumIterationsOutputPortproperty totrue.

[y,parity] = gpu_ldpcdecoder(x)returns the decoded data,y, and final parity checks,parity. To use this syntax, set theFinalParityChecksOutputPortproperty totrue.

[y,numiter,parity] = gpu_ldpcdecoder(x)returns the decoded data, number of iterations performed, and final parity checks. To use this syntax, set theNumIterationsOutputPortandFinalParityChecksOutputPortproperties totrue.

Input Arguments

expand all

Log-likelihood ratios, specified as anN-by-1 column vector containing the soft-decision output from demodulation.Nis the number of bits in the LDPC codeword before modulation. Each element is the log-likelihood ratio for a received bit. Element values are more likely to be0if the log-likelihood ratio is positive. The firstKelements correspond to the information-part of the input message.

Data Types:double

Output Arguments

expand all

Decoded data, returned as a column vector. TheDecisionMethodproperty specifies whether the object outputs hard decisions or soft decisions (log-likelihood ratios).

  • If theOutputValueproperty is set to'Information part', the output includes only the information-part of the received log-likelihood ratio vector.

  • If theOutputValueproperty is set to'Whole codeword', the output includes the whole log-likelihood ratio vector.

Data Types:double|logical

Number of executed decoding iterations, returned as a positive integer.

Dependencies

To enable this output, set theNumIterationsOutputPortproperty totrue.

Final parity checks after decoding the input LDPC code, returned as an (N-K)-by-1 column vector.Nis the number of bits in the LDPC codeword before modulation.Kis the length of the uncoded message.

Dependencies

To enable this output, set theFinalParityChecksOutputPortproperty totrue.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object namedobj, use this syntax:

release(obj)

expand all

step RunSystem objectalgorithm
release Release resources and allow changes toSystem objectproperty values and input characteristics
reset Reset internal states ofSystem object

Examples

collapse all

Using acomm.gpu.LDPCDecoderSystem Object™ to decode the signal, transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel. After adding AWGN, demodulate and decode the received signal. Compute the error statistics for the reception of uncoded and LDPC-coded signals. For more information, seeSimulation Acceleration Using GPUs.

Define simulation variables. Create an LDPC encoder configuration object and System objects for the LDPC decoder, QPSK modulator, and QPSK demodulators.

M = 4;% Modulation order (QPSK)snr = [0.25,0.5,0.75,1.0,1.25]; numFrames = 10; gpuldpcDecoder = comm.gpu.LDPCDecoder; encoderCfg = ldpcEncoderConfig(gpuldpcDecoder.ParityCheckMatrix); pskMod = comm.PSKModulator(M,'BitInput',true); pskDemod = comm.PSKDemodulator(M,'BitOutput',true,...'DecisionMethod','Approximate log-likelihood ratio');pskuDemod = comm.PSKDemodulator(M,'BitOutput',true,...'DecisionMethod','Hard decision');errRate = zeros(1,length(snr)); uncErrRate = zeros(1,length(snr));

对于每一个信噪比设置和所有的帧,计算error statistics for uncoded and LDPC-coded signals.

forii = 1:length(snr) ttlErr = 0; ttlErrUnc = 0; pskDemod.Variance = 1/10^(snr(ii)/10);% Set variance using current SNRforcounter = 1:numFrames data = logical(randi([0 1],32400,1));% Transmit and receiver uncoded signal datamod_uncSig = pskMod(data); rx_uncSig = awgn(mod_uncSig,snr(ii),'measured');demod_uncSig = pskuDemod (rx_uncSig);numErrUnc= biterr(data,demod_uncSig); ttlErrUnc = ttlErrUnc + numErrUnc;% Transmit and receive LDPC coded signal dataencData = ldpcEncode(data,encoderCfg); modSig = pskMod(encData); rxSig = awgn(modSig,snr(ii),'measured');demodSig = pskDemod(rxSig); rxBits = gpuldpcDecoder(demodSig); numErr = biterr(data,rxBits); ttlErr = ttlErr + numErr;endttlBits = numFrames*length(rxBits); uncErrRate(ii) = ttlErrUnc/ttlBits; errRate(ii) = ttlErr/ttlBits;end

Plot the error statistics for uncoded and LDPC-coded data.

plot(snr,uncErrRate,snr,errRate) legend('Uncoded','LDPC coded') xlabel('SNR (dB)') ylabel('BER')

Algorithms

expand all

This object performs LDPC decoding using the belief propagation algorithm, also known as a message-passing algorithm.

References

[1]Gallager, Robert G.Low-Density Parity-Check Codes. Cambridge, MA: MIT Press, 1963.

Extended Capabilities

Version History

Introduced in R2012a