當前位置: 首頁>>代碼示例>>Golang>>正文


Golang vec.Vectorer類代碼示例

本文整理匯總了Golang中util/vec.Vectorer的典型用法代碼示例。如果您正苦於以下問題:Golang Vectorer類的具體用法?Golang Vectorer怎麽用?Golang Vectorer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Vectorer類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewTwist

func NewTwist(w, q vec.Vectorer) Twister {
	t := new(twist)
	t.w = w // set the axis of motion of joint
	t.q = q // set the position a point on the axis of joint
	t.v = vec.Zeros(AxisLength)
	t.v.Cross(q, w) // qxw

	t.t = mesh.Gen(nil, TwistLength, 1)
	tvec := t.t.Vec().Slice()
	copy(tvec[3:], w.Slice())
	copy(tvec[:3], t.v.Slice())
	return t
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:13,代碼來源:joint.go

示例2: SetCol

// SetCol sets the c'th column of m with vector, v
func (m *mesh) SetCol(v vec.Vectorer, c int) {
	for i, e := range v.Slice() {
		m.elems.SetAt(i*m.off+c, e)
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:6,代碼來源:mesh.go

示例3: GetCol

// GetCol returns the c'th column of m into vector, v
// of length equal to no. of rows of mesh
func (m mesh) GetCol(v vec.Vectorer, c int) {
	off := m.off
	for i := range v.Slice() {
		v.SetAt(i, m.elems.GetAt(i*off+c))
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:8,代碼來源:mesh.go

示例4: SetRow

// SetRow sets the r'th column of m with vector, v
func (m *mesh) SetRow(v vec.Vectorer, r int) {
	off := r * m.off
	for j, e := range v.Slice() {
		m.elems.SetAt(off+j, e)
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:7,代碼來源:mesh.go

示例5: GetRow

// GetRow returns the r'th column of m into vector, v
// of length equal to no. of cols of mesh
func (m mesh) GetRow(v vec.Vectorer, r int) {
	off := r * m.off
	for j := range v.Slice() {
		v.SetAt(j, m.elems.GetAt(off+j))
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:8,代碼來源:mesh.go

示例6: SetDiag

// SetDiag puts the diagonal, d into the mesh
// m must be a square matrix
func (m *mesh) SetDiag(d vec.Vectorer) {
	for e := range d.Slice() {
		m.SetAtNode(d.GetAt(e), e, e)
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:7,代碼來源:mesh.go

示例7: GetDiag

// GetDiag puts the diagonal of the mesh into
// the vector, m must be a square matrix
func (m mesh) GetDiag(d vec.Vectorer) {
	for e := range d.Slice() {
		d.SetAt(e, m.GetAtNode(e, e))
	}
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:7,代碼來源:mesh.go

示例8: SolveUx

// Solve Ux = y, replace b with solution
// column oriented backward substitution
func (U mesh) SolveUx(y vec.Vectorer) {
	n := U.c
	for j := n - 1; j >= 1; j-- {
		y.SetAt(j, y.GetAt(j)/U.GetAtNode(j, j))
		for k := 0; k < j; k++ {
			y.SetAt(k, y.GetAt(k)-y.GetAt(j)*U.GetAtNode(k, j))
		}
	}
	y.SetAt(0, y.GetAt(0)/U.GetAtNode(0, 0))
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:12,代碼來源:solve.go

示例9: SolveLy

// Solve Ly = b for y, replace b with solution
// column oriented forward substitution
func (L mesh) SolveLy(b vec.Vectorer) {
	n := L.c
	for j := 0; j < n-1; j++ {
		b.SetAt(j, b.GetAt(j)/L.GetAtNode(j, j))
		for k := j + 1; k < n; k++ {
			b.SetAt(k, b.GetAt(k)-b.GetAt(j)*L.GetAtNode(k, j))
		}
	}
	b.SetAt(n-1, b.GetAt(n-1)/L.GetAtNode(n-1, n-1))
}
開發者ID:c2-akula,項目名稱:DvauKine,代碼行數:12,代碼來源:solve.go


注:本文中的util/vec.Vectorer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。