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


Golang matrix.ComplexMatrix類代碼示例

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


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

示例1: ApplyConstValues

// Makes a copy of A and for all elements pointed by the element of the indexes array
// calculates fn(A[k], values[i]) where k is the i'th value in the indexes array.
func ApplyConstValues(A *matrix.ComplexMatrix, values []complex128, fn func(complex128, complex128) complex128, indexes []int) *matrix.ComplexMatrix {
	if A == nil {
		return A
	}
	C := A.Copy()
	return C.ApplyConstValues(values, fn, indexes)
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:9,代碼來源:math.go

示例2: ApplyConst

// Make a copy C of A and apply function fn element wise to C.
// For indexes is not empty then  C[indexes[i]] = fn(C[indexes[i]], x).
// Returns a new matrix.
func ApplyConst(A *matrix.ComplexMatrix, x complex128, fn func(complex128, complex128) complex128, indexes ...int) *matrix.ComplexMatrix {
	if A == nil {
		return nil
	}
	C := A.Copy()
	return C.ApplyConst(x, fn, indexes...)
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:10,代碼來源:math.go

示例3: Imag

// Return Imag(A).
func Imag(A *matrix.ComplexMatrix) *matrix.FloatMatrix {
	C := matrix.FloatZeros(A.Size())
	Ar := A.ComplexArray()
	Cr := C.FloatArray()
	for i, v := range Ar {
		Cr[i] = imag(v)
	}
	return C
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:10,代碼來源:math.go

示例4: AddAt

// Make copy C of A and compute  C[indexes[i]] +=  values[i]. Indexes are in column-major order.
// Returns a new matrix.
func AddAt(A *matrix.ComplexMatrix, values []complex128, indexes []int) *matrix.ComplexMatrix {
	C := A.Copy()
	if len(indexes) == 0 {
		return C
	}
	Cr := C.ComplexArray()
	N := A.NumElements()
	for i, k := range indexes {
		if i >= len(values) {
			return C
		}
		if k < 0 {
			k = N + k
		}
		Cr[k] += values[i]
	}
	return C
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:20,代碼來源:math.go

示例5: Mul

// Compute element-wise product C[i,j] = A[i,j] * B[i,j]. Returns new matrix.
func Mul(A, B *matrix.ComplexMatrix) *matrix.ComplexMatrix {
	if !A.SizeMatch(B.Size()) {
		return nil
	}
	C := A.Copy()
	return C.Mul(B)
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:8,代碼來源:math.go

示例6: Abs

// Compute Abs(A), Returns a new float valued matrix.
func Abs(A *matrix.ComplexMatrix) *matrix.FloatMatrix {
	C := matrix.FloatZeros(A.Rows(), A.Cols())
	Cr := C.FloatArray()
	Ar := A.ComplexArray()
	for k, v := range Ar {
		Cr[k] = cmplx.Abs(v)
	}
	return C
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:10,代碼來源:math.go

示例7: Add

// Make a copy C of A and compute C += alpha for all elements in the matrix if list of indexes
// is empty. Otherwise compute C[i] += alpha for indexes in column-major order.
func Add(A *matrix.ComplexMatrix, alpha complex128, indexes ...int) *matrix.ComplexMatrix {
	C := A.Copy()
	return C.Add(alpha, indexes...)
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:6,代碼來源:math.go

示例8: Inv

// Make a copy C of A and compute inverse C[i] = 1.0/C[i]. If indexes is empty calculates for
// all elements. Returns a new matrix.
func Inv(A *matrix.ComplexMatrix, indexes ...int) *matrix.ComplexMatrix {
	C := A.Copy()
	return C.Inv()
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:6,代碼來源:math.go

示例9: Times

// Compute matrix product C = A * B where A is m*p and B is p*n.
// Returns a new m*n matrix.
func Times(A, B *matrix.ComplexMatrix) *matrix.ComplexMatrix {
	if A.Cols() != B.Rows() {
		return nil
	}
	return A.Times(B)
}
開發者ID:sguzwf,項目名稱:algorithm,代碼行數:8,代碼來源:math.go


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