本文整理匯總了Golang中github.com/henrylee2cn/algorithm/matrix.FloatMatrix.GetRow方法的典型用法代碼示例。如果您正苦於以下問題:Golang FloatMatrix.GetRow方法的具體用法?Golang FloatMatrix.GetRow怎麽用?Golang FloatMatrix.GetRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/henrylee2cn/algorithm/matrix.FloatMatrix
的用法示例。
在下文中一共展示了FloatMatrix.GetRow方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: pack2
// In-place version of pack(), which also accepts matrix arguments x.
// The columns of x are elements of S, with the 's' components stored
// in unpacked storage. On return, the 's' components are stored in
// packed storage and the off-diagonal entries are scaled by sqrt(2).
//
func pack2(x *matrix.FloatMatrix, dims *sets.DimensionSet, mnl int) (err error) {
if len(dims.At("s")) == 0 {
return nil
}
const sqrt2 = 1.41421356237309504880
iu := mnl + dims.Sum("l", "q")
ip := iu
row := matrix.FloatZeros(1, x.Cols())
//fmt.Printf("x.size = %d %d\n", x.Rows(), x.Cols())
for _, n := range dims.At("s") {
for k := 0; k < n; k++ {
cnt := n - k
row = x.GetRow(iu+(n+1)*k, row)
//fmt.Printf("%02d: %v\n", iu+(n+1)*k, x.FloatArray())
x.SetRow(ip, row)
for i := 1; i < n-k; i++ {
row = x.GetRow(iu+(n+1)*k+i, row)
//fmt.Printf("%02d: %v\n", iu+(n+1)*k+i, x.FloatArray())
x.SetRow(ip+i, row.Scale(sqrt2))
}
ip += cnt
}
iu += n * n
}
return nil
}