Beispiel #1
0
func (l *LTECodec) lambda_calc(alpha *matrix.DenseMatrix, beta *matrix.DenseMatrix, gamma *matrix.DenseMatrix, lambda *matrix.DenseMatrix) {
	La_0 := [][]int{{0, 0, 0}, {1, 4, 0}, {2, 5, 1}, {3, 1, 1}, {4, 2, 1}, {5, 6, 1}, {6, 7, 0}, {7, 3, 0}}
	La_1 := [][]int{{0, 4, 3}, {1, 0, 3}, {2, 1, 2}, {3, 5, 2}, {4, 6, 2}, {5, 2, 2}, {6, 3, 3}, {7, 7, 3}}
	temp_0, temp_1 := vlib.NewVectorF(8), vlib.NewVectorF(8)
	LEN := alpha.Rows() - 1

	for k := 1; k <= LEN; k++ {
		for i := 0; i < 8; i++ {
			temp_0[i] = alpha.Get(k-1, La_0[i][0]) + beta.Get(k, La_0[i][1]) + gamma.Get(k, La_0[i][2])
			temp_1[i] = alpha.Get(k-1, La_1[i][0]) + beta.Get(k, La_1[i][1]) + gamma.Get(k, La_1[i][2])
		}
		lambda.Set(k, 0, vlib.Min(temp_0))
		lambda.Set(k, 1, vlib.Min(temp_1))
	}
}
Beispiel #2
0
func (l *LTECodec) extrinsic_info(alpha *matrix.DenseMatrix, beta *matrix.DenseMatrix, parllhd []float64, le *matrix.DenseMatrix) {

	LE_0 := [][]int{{0, 0, 0}, {1, 4, 0}, {2, 5, 1}, {3, 1, 1}, {4, 2, 1}, {5, 6, 1}, {6, 7, 0}, {7, 3, 0}}
	LE_1 := [][]int{{0, 4, 1}, {1, 0, 1}, {2, 1, 0}, {3, 5, 0}, {4, 6, 0}, {5, 2, 0}, {6, 3, 1}, {7, 7, 1}}
	LEN := alpha.Rows() - 4
	temp_0, temp_1 := vlib.NewVectorF(8), vlib.NewVectorF(8)
	for k := 1; k <= LEN; k++ {
		for i := 0; i < 8; i++ {
			temp_0[i] = alpha.Get(k-1, LE_0[i][0]) + beta.Get(k, LE_0[i][1]) + float64((LE_0[i][2]+1)%2)*parllhd[k]
			temp_1[i] = alpha.Get(k-1, LE_1[i][0]) + beta.Get(k, LE_1[i][1]) + float64((LE_1[i][2]+1)%2)*parllhd[k]
		}
		le.Set(k, 0, vlib.Min(temp_0))
		le.Set(k, 1, vlib.Min(temp_1))
	}
}
Beispiel #3
0
func (l *LTECodec) forward_metric(lgr *matrix.DenseMatrix, la *matrix.DenseMatrix) {

	alpha_t := [][]int{{0, 1}, {3, 2}, {4, 5}, {7, 6}, {1, 0}, {2, 3}, {5, 4}, {6, 7}}
	br_metric := [][]int{{0, 3}, {1, 2}, {1, 2}, {0, 3}, {0, 3}, {1, 2}, {1, 2}, {0, 3}}
	xtemp := vlib.NewVectorF(2)

	var min_m float64
	LEN := lgr.Rows() - 1
	la.Set(0, 0, 0)

	for i := 1; i < 8; i++ {
		la.Set(0, i, 1e8)
	}

	for k := 1; k <= LEN; k++ {
		for i := 0; i < 8; i++ {

			for j := 0; j < 2; j++ {
				xtemp[j] = la.Get(k-1, alpha_t[i][j]) + lgr.Get(k, br_metric[i][j])

				la.Set(k, i, vlib.Min(xtemp))
			}
		}
		min_m = vlib.Min(la.GetRowVector(k).Array())
		for i := 0; i < 8; i++ {
			num := 2

			la.Set(k, i, la.Get(k, i)-min_m)
			if k > LEN-3 {

				diff := LEN - k
				if i >= (int)(num*diff) {
					la.Set(k, i, 1e8)
				}

			}
		}

	}

}
Beispiel #4
0
func (l *LTECodec) backward_metric(lgr *matrix.DenseMatrix, lb *matrix.DenseMatrix) {

	beta_t := [][]int{{0, 4}, {4, 0}, {5, 1}, {1, 5}, {2, 6}, {6, 2}, {7, 3}, {3, 7}}
	br_metric := [][]int{{0, 3}, {0, 3}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {0, 3}, {0, 3}}
	temp := vlib.NewVectorF(2)
	var min_m float64
	LEN := lgr.Rows() - 1
	var num int
	lb.Set(LEN, 0, 0)
	for i := 1; i < 8; i++ {
		lb.Set(LEN, i, 1e8)
	}
	for k := LEN - 1; k >= 0; k-- {
		for i := 0; i < 8; i++ {
			for j := 0; j < 2; j++ {
				temp[j] = lb.Get(k+1, beta_t[i][j]) + lgr.Get(k+1, br_metric[i][j])
			}
			lb.Set(k, i, vlib.Min(temp))
		}

		min_m = vlib.Min(lb.GetRowVector(k).Array())

		for i := 0; i < 8; i++ {
			num = 2
			lb.Set(k, i, lb.Get(k, i)-min_m)
			if k < 3 {
				diff := float64(2 - k)
				num = num * int(math.Pow(2, diff))
				if i%num != 0 {
					lb.Set(k, i, 1e8)
				}
			}
		}

	}
}