You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dlaswp.go
    path of file: ./repos/gonum/lapack/gonum
    
    the code of the file until where you have to start completion: // Copyright Â©2015 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package gonum

import "gonum.org/v1/gonum/blas/blas64"

// Dlaswp swaps the rows k1 to k2 of a rectangular matrix A according to the
// indices in ipiv so that row k is swapped with ipiv[k].
//
// n is the number of columns of A and incX is the increment for ipiv. If incX

    
func (impl Implementation) Dlaswp(n int, a []float64, lda int, k1, k2 int, ipiv []int, incX int) {
	switch {
	case n < 0:
		panic(nLT0)
	case k1 < 0:
		panic(badK1)
	case k2 < k1:
		panic(badK2)
	case lda < max(1, n):
		panic(badLdA)
	case len(a) < k2*lda+n: // A must have at least k2+1 rows.
		panic(shortA)
	case len(ipiv) != k2+1:
		panic(badLenIpiv)
	case incX != 1 && incX != -1:
		panic(absIncNotOne)
	}

	if n == 0 {
		return
	}

	bi := blas64.Implementation()
	if incX == 1 {
		for k := k1; k <= k2; k++ {
			if k == ipiv[k] {
				continue
			}
			bi.Dswap(n, a[k*lda:], 1, a[ipiv[k]*lda:], 1)
		}
		return
	}
	for k := k2; k >= k1; k-- {
		if k == ipiv[k] {
			continue
		}
		bi.Dswap(n, a[k*lda:], 1, a[ipiv[k]*lda:], 1)
	}
}