本文整理汇总了Golang中github.com/wiless/vlib.VectorC类的典型用法代码示例。如果您正苦于以下问题:Golang VectorC类的具体用法?Golang VectorC怎么用?Golang VectorC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VectorC类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: GoIFFT_C
func GoIFFT_C(samples vlib.VectorC, N int) vlib.VectorC {
n := runtime.GOMAXPROCS(8)
if N != samples.Size() {
samples.Resize(N)
}
// fbins := vlib.NewVectorC(N)
result := vlib.NewVectorC(N)
NChannels := make([]gocomm.Complex128Channel, N)
//bigChannel := make(gocomm.Complex128Channel, N)
for i := 0; i < N; i++ {
NChannels[i] = gocomm.NewComplex128Channel()
go GoFFTPerK(NChannels[i], samples, i, N, true)
//go GoFFTPerK(bigChannel, samples, i, N, false)
}
//for i := 0; i < N; i++ {
// result[i] = (<-bigChannel).Ch
//}
for i := 0; i < N; i++ {
result[i] = (<-NChannels[i]).Ch
}
runtime.GOMAXPROCS(n)
return result
}
开发者ID:postfix,项目名称:gocomm,代码行数:28,代码来源:fft.go
示例2: SetSpreadCode
func (m *CDMA) SetSpreadCode(spcode vlib.VectorC, doscale bool) {
m.sf = spcode.Size()
// normalize := 1.0 / float64(m.sf)
if doscale {
m.spreadSeq, _ = spcode.ToUnitEnergy() //spcode.Scale(normalize)
} else {
m.spreadSeq = spcode //;.ToUnitEnergy() //spcode.Scale(normalize)
}
// fmt.Print("\ndata", m.spreadSeq, temp, a)
}
开发者ID:postfix,项目名称:gocomm,代码行数:12,代码来源:cdmachip.go
示例3: IFFT_C
func IFFT_C(samples vlib.VectorC, N int) vlib.VectorC {
samples.Resize(N)
fbins := vlib.NewVectorC(N)
normalize := complex(math.Sqrt(1.0/float64(N)), 0)
result := vlib.NewVectorC(N)
for i := 0; i < N; i++ {
for n := 0; n < N; n++ {
scale := float64(i) * float64(n) / float64(N)
binf := complex(0, 2.0*math.Pi*scale)
fbins[n] = cmplx.Exp(binf)
}
// fbins = fbins.ScaleC(i)
// fmt.Print("\ni=", i, fbins)
result[i] = vlib.DotC(samples, fbins) * normalize
}
return result
}
开发者ID:postfix,项目名称:gocomm,代码行数:19,代码来源:fft.go
示例4: DeSpreadBlock
func (cdma *CDMA) DeSpreadBlock(expectedInputSize int, chInway gocomm.Complex128AChannel, OutCH gocomm.Complex128Channel) {
despcode := vlib.Conj(cdma.SpreadSequence)
SF := len(despcode)
despcode = despcode.Scale(1. / (float64(SF)))
if SF == 0 {
panic("Spreading Code not Set")
}
// maxSymbols := expectedInputSize / SF
// rxsymbols := vlib.NewVectorC(maxSymbols)
var recentBuffer vlib.VectorC
for cnt := 0; cnt < expectedInputSize; {
data := <-chInway
rxlen := len(data.Ch)
// log.Printf("\n Received %d samples out of %d/%d ", rxlen, cnt, expectedInputSize)
cnt += rxlen
recentBuffer = append(recentBuffer, data.Ch...)
for {
if recentBuffer.Size() < SF {
break
} else {
// log.Printf("\n Symbol %d Ready to Despread with %d", sym, cnt)
rxchips := recentBuffer[0:SF]
recentBuffer = recentBuffer[SF:]
rxsymbols := vlib.DotC(despcode, rxchips)
var chdataOut gocomm.SComplex128Obj
chdataOut.Ch = rxsymbols
OutCH <- chdataOut
}
}
}
close(chInway)
}
开发者ID:postfix,项目名称:gocomm,代码行数:41,代码来源:cdma.go
示例5: Conv
func Conv(in1, in2 vlib.VectorC) (result vlib.VectorC) {
L1 := in1.Size()
L2 := in2.Size()
N := L1 + L2 - 1
result = vlib.NewVectorC(N)
fmt.Printf("\n in1=%v", in1)
fmt.Printf("\n in2=%v", in2)
for n := 0; n < N; n++ {
for l := 0; l < L1; l++ {
indx := n - l
if indx < L2 && indx >= 0 {
result[n] += in1[l] * in2[n-l]
}
}
// result[n] = sum
}
fmt.Printf("\n result=%v", result)
return result
}
开发者ID:postfix,项目名称:gocomm,代码行数:22,代码来源:conv.go
示例6: ScatterC
func (m *MatlabSession) ScatterC(c vlib.VectorC, params ...string) int {
return m.PlotXY(c.Real(), c.Imag(), params...)
}
开发者ID:wiless,项目名称:webplot,代码行数:5,代码来源:webmatlab.go
示例7: IFFT_F
func IFFT_F(samples vlib.VectorF, N int) vlib.VectorC {
var csamples vlib.VectorC
csamples.SetVectorF(samples)
return IFFT_C(csamples, N)
}
开发者ID:postfix,项目名称:gocomm,代码行数:5,代码来源:fft.go
注:本文中的github.com/wiless/vlib.VectorC类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论