本文整理匯總了Golang中C.mvec_t類的典型用法代碼示例。如果您正苦於以下問題:Golang mvec_t類的具體用法?Golang mvec_t怎麽用?Golang mvec_t使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了mvec_t類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: vinvscal
func vinvscal(X *cmat.FloatMatrix, alpha float64, N int) {
var x C.mvec_t
xr, _ := X.Size()
x.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
x.inc = C.int(1)
if xr == 1 {
x.inc = C.int(X.Stride())
}
C.__d_vec_invscal(
(*C.mvec_t)(unsafe.Pointer(&x)), C.double(alpha), C.int(N))
return
}
示例2: axpby
func axpby(Y, X *cmat.FloatMatrix, alpha, beta float64, N int) {
var x, y C.mvec_t
xr, _ := X.Size()
x.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
x.inc = C.int(1)
if xr == 1 {
x.inc = C.int(X.Stride())
}
yr, _ := Y.Size()
y.md = (*C.double)(unsafe.Pointer(&Y.Data()[0]))
y.inc = C.int(1)
if yr == 1 {
y.inc = C.int(Y.Stride())
}
if beta == 1.0 {
C.__d_vec_axpy(
(*C.mvec_t)(unsafe.Pointer(&y)),
(*C.mvec_t)(unsafe.Pointer(&x)),
C.double(alpha), C.int(N))
} else {
C.__d_vec_axpby(
(*C.mvec_t)(unsafe.Pointer(&y)),
(*C.mvec_t)(unsafe.Pointer(&x)),
C.double(alpha), C.double(beta), C.int(N))
}
return
}
示例3: updtrmv
func updtrmv(A, X, Y *cmat.FloatMatrix, alpha float64, bits, N, M int) error {
var Am C.mdata_t
var Xm, Ym C.mvec_t
xr, _ := X.Size()
yr, _ := Y.Size()
Am.md = (*C.double)(unsafe.Pointer(&A.Data()[0]))
Am.step = C.int(A.Stride())
Xm.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
Ym.md = (*C.double)(unsafe.Pointer(&Y.Data()[0]))
Ym.inc = C.int(1)
Xm.inc = C.int(1)
// if row vectors, change increment
if xr == 1 {
Xm.inc = C.int(X.Stride())
}
if yr == 1 {
Ym.inc = C.int(Y.Stride())
}
C.__d_update_trmv_unb(
(*C.mdata_t)(unsafe.Pointer(&Am)),
(*C.mvec_t)(unsafe.Pointer(&Xm)),
(*C.mvec_t)(unsafe.Pointer(&Ym)),
C.double(alpha), C.int(bits), C.int(N), C.int(M))
return nil
}
示例4: sum
func sum(X *cmat.FloatMatrix, N int) float64 {
var x C.mvec_t
var dc C.double
xr, _ := X.Size()
x.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
x.inc = C.int(1)
if xr == 1 {
x.inc = C.int(X.Stride())
}
dc = C.__d_vec_sum_recursive(
(*C.mvec_t)(unsafe.Pointer(&x)), C.int(N))
return float64(dc)
}
示例5: DScal
// scaling: X = alpha*X
func DScal(X []float64, alpha float64, incX, N int) {
var Xv C.mvec_t
if X == nil || N <= 0 {
return
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
C.dvec_scal(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
C.double(alpha), C.int(N))
}
示例6: gemv
func gemv(Y, A, X *cmat.FloatMatrix, alpha, beta float64, bits, S, L, R, E int) {
var Am C.mdata_t
var Xm, Ym C.mvec_t
xr, _ := X.Size()
yr, _ := Y.Size()
Am.md = (*C.double)(unsafe.Pointer(&A.Data()[0]))
Am.step = C.int(A.Stride())
Xm.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
Ym.md = (*C.double)(unsafe.Pointer(&Y.Data()[0]))
Ym.inc = C.int(1)
Xm.inc = C.int(1)
// if row vectors, change increment
if xr == 1 {
Xm.inc = C.int(X.Stride())
}
if yr == 1 {
Ym.inc = C.int(Y.Stride())
}
C.__d_gemv_unb(
(*C.mvec_t)(unsafe.Pointer(&Ym)),
(*C.mdata_t)(unsafe.Pointer(&Am)),
(*C.mvec_t)(unsafe.Pointer(&Xm)),
C.double(alpha),
/*C.double(beta),*/
C.int(bits),
C.int(S), C.int(L), C.int(R), C.int(E))
}
示例7: iamax
func iamax(X *cmat.FloatMatrix, N int) int {
var x C.mvec_t
var ix C.int
xr, _ := X.Size()
x.md = (*C.double)(unsafe.Pointer(&X.Data()[0]))
x.inc = C.int(1)
if xr == 1 {
x.inc = C.int(X.Stride())
}
ix = C.__d_vec_iamax(
(*C.mvec_t)(unsafe.Pointer(&x)), C.int(N))
return int(ix)
}
示例8: DNorm2
// return: sum (abs(X[i]))^2; Euclidaen norm
func DNorm2(X []float64, incX, N int) float64 {
var nrm C.double
var Xv C.mvec_t
if X == nil || N <= 0 {
return 0.0
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
nrm = C.dvec_nrm2(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
C.int(N))
return float64(nrm)
}
示例9: DIAMax
// return: index of max absolute value
func DIAMax(X []float64, incX, N int) int {
var ix C.int
var Xv C.mvec_t
if X == nil || N <= 0 {
return -1
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
ix = C.dvec_iamax(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
C.int(N))
return int(ix)
}
示例10: DAsum
// return: sum (abs(X[i]))
func DAsum(X []float64, incX, N int) float64 {
var asum C.double
var Xv C.mvec_t
if X == nil || N <= 0 {
return 0.0
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
asum = C.dvec_asum(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
C.int(N))
return float64(asum)
}
示例11: DTrimvLowerTransA
func DTrimvLowerTransA(X, A []float64, unit bool, incX, ldA, N, NB int) {
var Xv C.mvec_t
var Am C.mdata_t
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
Am.md = (*C.double)(unsafe.Pointer(&A[0]))
Am.step = C.int(ldA)
var flags Flags = LOWER | TRANSA
if unit {
flags |= UNIT
}
C.dmvec_trid_unb(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
(*C.mdata_t)(unsafe.Pointer(&Am)),
C.int(flags), C.int(N))
}
示例12: DSolveBlkMV
// blas TSMV; blocked version
func DSolveBlkMV(X, A []float64, flags Flags, incX, ldA, N, NB int) {
var Xv C.mvec_t
var Am C.mdata_t
if A == nil || X == nil {
return
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
Am.md = (*C.double)(unsafe.Pointer(&A[0]))
Am.step = C.int(ldA)
C.dmvec_solve_blocked(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
(*C.mdata_t)(unsafe.Pointer(&Am)),
C.int(flags), C.int(N), C.int(NB))
}
示例13: DSymmRankMV
// blas SYR; blocked version
func DSymmRankMV(A, X []float64, alpha float64, flags Flags, ldA, incX, S, L, NB int) {
var Xv C.mvec_t
var Am C.mdata_t
if A == nil || X == nil {
return
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
Am.md = (*C.double)(unsafe.Pointer(&A[0]))
Am.step = C.int(ldA)
C.dmvec_symv_rank(
(*C.mdata_t)(unsafe.Pointer(&Am)),
(*C.mvec_t)(unsafe.Pointer(&Xv)),
C.double(alpha), C.int(flags),
C.int(S), C.int(L), C.int(NB))
}
示例14: DTrimvUnblkMV
// blas TRMV; unblocked
func DTrimvUnblkMV(X, A []float64, flags Flags, incX, ldA, N int) {
var Xv C.mvec_t
var Am C.mdata_t
if A == nil || X == nil {
return
}
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
Am.md = (*C.double)(unsafe.Pointer(&A[0]))
Am.step = C.int(ldA)
C.dmvec_trid_unb(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
(*C.mdata_t)(unsafe.Pointer(&Am)),
C.int(flags), C.int(N))
}
示例15: DSolveLowerBlocked
func DSolveLowerBlocked(X, A []float64, unit bool, incX, ldA, N, NB int) {
var Xv C.mvec_t
var Am C.mdata_t
Xv.md = (*C.double)(unsafe.Pointer(&X[0]))
Xv.inc = C.int(incX)
Am.md = (*C.double)(unsafe.Pointer(&A[0]))
Am.step = C.int(ldA)
var flags Flags = LOWER
if unit {
flags |= UNIT
}
C.dmvec_solve_blocked(
(*C.mvec_t)(unsafe.Pointer(&Xv)),
(*C.mdata_t)(unsafe.Pointer(&Am)),
C.int(flags), C.int(N), C.int(NB))
}