本文整理汇总了Golang中github.com/wiless/gocomm.SComplex128AObj类的典型用法代码示例。如果您正苦于以下问题:Golang SComplex128AObj类的具体用法?Golang SComplex128AObj怎么用?Golang SComplex128AObj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SComplex128AObj类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
N := 2048
begin := time.Now()
var ofdm customchips.OFDM
ofdm.InitializeChip()
ofdm.NPoint = N
// fmt.Printf("\n OFDM = %v", ofdm)
/// Input
inCHA := gocomm.NewComplex128AChannel()
// inCH := gocomm.NewComplex128Channel()
var dataArray gocomm.SComplex128AObj
x := sources.RandNCVec(N, 1)
dataArray.Ch = x
dataArray.MaxExpected = 1
inCHA <- dataArray
go ofdm.Ifft(inCHA)
go ofdm.Fft(ofdm.PinByName("outputPin0").Channel.(gocomm.Complex128AChannel))
outCHA := ofdm.PinByName("outputPin1").Channel.(gocomm.Complex128AChannel)
data := <-outCHA
/// Analyse
fmt.Printf("\nX=%f", x[0:16])
fmt.Printf("\nOutput=%f", data.Ch[0:16])
// xcap := dsp.ExtFFT_C(data.Ch, N)
// fmt.Printf("\nXcap=%f", xcap[0:16])
fmt.Printf("\nTime Elapsed : %v\n", time.Since(begin))
}
开发者ID:postfix,项目名称:gocomm,代码行数:30,代码来源:ofdmlink.go
示例2: Spread
func (cdma *CDMA) Spread(chInway gocomm.Complex128Channel, OutCH gocomm.Complex128AChannel) {
indata := <-chInway
insymbol := indata.Ch
spcode := cdma.SpreadSequence
var result = make([]complex128, len(spcode))
for i := 0; i < len(spcode); i++ {
result[i] = insymbol * spcode[i]
}
var chdataOut gocomm.SComplex128AObj
chdataOut.Ch = result
chdataOut.MaxExpected = indata.MaxExpected / len(spcode)
// chdataOut.MaxExpected = int(math.Floor(float64(indata.MaxExpected) / float64(len(spcode))))
OutCH <- chdataOut
}
开发者ID:postfix,项目名称:gocomm,代码行数:15,代码来源:cdma.go
示例3: ChannelFn
func (m *MPChannel) ChannelFn(sample gocomm.SComplex128Obj) (result gocomm.SComplex128Obj) {
/// Read your data from Input channel(s) [inputPin0]
/// And write it to OutputChannels [outputPin0]
// fmt.Printf("\n Channel Param %#v \n input = %v", m.ChannelParam, sample)
if m.Ts == -1 {
m.Coeff.Resize(m.pdp.Size())
for i := 0; i < m.pdp.Size(); i++ {
m.Coeff[i] = sources.RandNC(m.pdp[i])
}
if m.FeedbackCH != nil {
var chdata gocomm.SComplex128AObj
chdata.Ch = m.Coeff
chdata.TimeStamp = m.TimeStamp
chdata.MaxExpected = sample.MaxExpected
chdata.Ts = m.Ts
fmt.Printf("\n FAST IID generated for [email protected]%v with %[email protected]%v", sample.TimeStamp, m.TimeStamp, cmplx.Abs(m.Coeff[0])*cmplx.Abs(m.Coeff[0]))
m.FeedbackCH <- chdata
}
} else {
m.updateCoeff(sample.TimeStamp)
}
if m.FilterMemory.Size() != m.Coeff.Size() {
m.FilterMemory.Resize(m.Coeff.Size())
}
result = sample /// Carefull if not same ChType
// m.TimeStamp = sample.TimeStamp
m.FilterMemory = m.FilterMemory.ShiftLeft(sample.Ch)
//dummy := vlib.ElemMultC(m.Coeff, vlib.Conj(m.Coeff))
foutput := vlib.DotC(m.Coeff, m.FilterMemory)
// fmt.Printf("\n CHANNEL @%v: I/P %v - Gain : %v : O/p : %v", sample.TimeStamp, sample.Ch, cmplx.Abs(m.Coeff[0])*cmplx.Abs(m.Coeff[0]), foutput)
result.Ch = foutput
result.Message = sample.Message + " Filter"
result.Ts = sample.Ts
result.TimeStamp = sample.TimeStamp
result.MaxExpected = sample.MaxExpected
// fmt.Printf("\n I/O (hn =%v) : %#v --> %#v", m.Coeff, sample, result)
return result
}
开发者ID:postfix,项目名称:gocomm,代码行数:46,代码来源:mpchannel.go
示例4: SpreadBlock
func (cdma *CDMA) SpreadBlock(expectedInputSymbols int, chInway gocomm.Complex128Channel, OutCH gocomm.Complex128AChannel) {
spcode := cdma.SpreadSequence
if len(spcode) == 0 {
panic("Spreading Code not Set")
}
for i := 0; i < expectedInputSymbols; i++ {
indata := <-chInway
insymbol := indata.Ch
var result = make([]complex128, len(spcode))
for i := 0; i < len(spcode); i++ {
result[i] = insymbol * spcode[i]
}
var chdataOut gocomm.SComplex128AObj
chdataOut.Ch = result
OutCH <- chdataOut
}
close(chInway)
}
开发者ID:postfix,项目名称:gocomm,代码行数:20,代码来源:cdma.go
示例5: Fft
func (m *OFDM) Fft(inputPin1 gocomm.Complex128AChannel) {
/// Read your data from Input channel(s) [inputPin1]
/// And write it to OutputChannels [outputPin1]
outputPin1 := m.Pins["outputPin1"].Channel.(gocomm.Complex128AChannel)
iters := 1
for i := 0; i < iters; i++ {
chData := <-inputPin1
iters = chData.MaxExpected
tsamples := chData.Ch
/// Do process here with chData
var outData gocomm.SComplex128AObj
outData.Ch = dsp.ExtFFT_C(tsamples, m.NPoint)
/// copy meta
outData.MaxExpected = chData.MaxExpected
outData.Ts = chData.Ts
outData.TimeStamp = chData.TimeStamp
outData.Message = chData.Message
outputPin1 <- outData
iters = chData.MaxExpected
}
}
开发者ID:postfix,项目名称:gocomm,代码行数:26,代码来源:ofdm.go
示例6: updateCoeff
func (m *MPChannel) updateCoeff(timestamp float64) {
/// first time
generated := false
if m.TimeStamp == -1 {
m.Coeff.Resize(m.pdp.Size())
for i := 0; i < m.pdp.Size(); i++ {
m.Coeff[i] = sources.RandNC(m.pdp[i])
}
generated = true
m.TimeStamp = 0 /// Unusuall if inbetween the MPchannel timestamp has got RESET !!
} else {
/// Existing channel-coeff is valid till m.Timestamp+m.TS,
valid := timestamp < (m.TimeStamp + m.Ts)
if !valid {
/// TRIGGER NEW COEFF
m.Coeff = vlib.NewVectorC(m.pdp.Size())
for i := 0; i < m.pdp.Size(); i++ {
m.Coeff[i] = sources.RandNC(m.pdp[i])
}
m.TimeStamp = timestamp
generated = true
}
}
/// Write new coeff to feedback channel if new was generated
if m.FeedbackCH != nil && generated {
var chdata gocomm.SComplex128AObj
chdata.Ch = m.Coeff
chdata.TimeStamp = m.TimeStamp
chdata.Ts = m.Ts
// fmt.Printf("\n CH:GENERATED @ %v with Coeff : %v, Gain : %v ", timestamp, m.Coeff[0], cmplx.Abs(m.Coeff[0])*cmplx.Abs(m.Coeff[0]))
m.FeedbackCH <- chdata
}
}
开发者ID:postfix,项目名称:gocomm,代码行数:40,代码来源:mpchannel.go
示例7: Channel
func (m *MPChannel) Channel(inputPin0 gocomm.Complex128Channel) {
/// Read your data from Input channel(s) [inputPin0]
/// And write it to OutputChannels [outputPin0]
outputPin0 := chipset.ToComplexCH(m.Pins["outputPin0"])
var IdealChObj gocomm.SComplex128AObj
iters := 1
for i := 0; i < iters; i++ {
chData := <-inputPin0
iters = chData.MaxExpected
/// Do process here with chData
outData := m.ChannelFn(chData)
/// coeff attempt to send
IdealChObj.Ch = m.Coeff
IdealChObj.Ts = chData.Ts
IdealChObj.TimeStamp = chData.TimeStamp
IdealChObj.Message = chData.Message
IdealChObj.MaxExpected = chData.MaxExpected
//fmt.Printf("\n Want to broadcast %#v to %#v", IdealChObj, coeffPin)
///
// select {
// case coeffPin <- IdealChObj:
// // fmt.Printf("\n%f : sent message %v", IdealChObj.TimeStamp, IdealChObj.Ch)
// default:
// // fmt.Printf("\n%f: no message sent", IdealChObj.TimeStamp)
// }
outputPin0 <- outData
}
}
开发者ID:postfix,项目名称:gocomm,代码行数:33,代码来源:mpchannel.go
注:本文中的github.com/wiless/gocomm.SComplex128AObj类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论