Skip to content
This repository was archived by the owner on Dec 10, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mat64/dense.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (m *Dense) SetRow(i int, src []float64) {
panic(matrix.ErrRowLength)
}

copy(m.rowView(i), src)
copy(m.rawRowView(i), src)
}

// RowView returns row i of the matrix data represented as a column vector,
Expand All @@ -213,7 +213,7 @@ func (m *Dense) RowView(i int) *Vector {
return &Vector{
mat: blas64.Vector{
Inc: 1,
Data: m.mat.Data[i*m.mat.Stride : i*m.mat.Stride+m.mat.Cols],
Data: m.rawRowView(i),
},
n: m.mat.Cols,
}
Expand All @@ -225,11 +225,11 @@ func (m *Dense) RawRowView(i int) []float64 {
if i >= m.mat.Rows || i < 0 {
panic(matrix.ErrRowAccess)
}
return m.rowView(i)
return m.rawRowView(i)
}

func (m *Dense) rowView(r int) []float64 {
return m.mat.Data[r*m.mat.Stride : r*m.mat.Stride+m.mat.Cols]
func (m *Dense) rawRowView(i int) []float64 {
return m.mat.Data[i*m.mat.Stride : i*m.mat.Stride+m.mat.Cols]
}

// View returns a new Matrix that shares backing data with the receiver.
Expand Down
14 changes: 7 additions & 7 deletions mat64/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,27 @@ type Mutable interface {
}

// A RowViewer can return a Vector reflecting a row that is backed by the matrix
// data. The Vector returned will have Len() == nCols.
// data. The Vector returned will have length equal to the number of columns.
type RowViewer interface {
RowView(r int) *Vector
RowView(i int) *Vector
}

// A RawRowViewer can return a slice of float64 reflecting a row that is backed by the matrix
// data.
type RawRowViewer interface {
RawRowView(r int) []float64
RawRowView(i int) []float64
}

// A ColViewer can return a Vector reflecting a row that is backed by the matrix
// data. The Vector returned will have Len() == nRows.
// A ColViewer can return a Vector reflecting a column that is backed by the matrix
// data. The Vector returned will have length equal to the number of rows.
type ColViewer interface {
ColView(c int) *Vector
ColView(j int) *Vector
}

// A RawColViewer can return a slice of float64 reflecting a column that is backed by the matrix
// data.
type RawColViewer interface {
RawColView(c int) []float64
RawColView(j int) []float64
}

// A Cloner can make a copy of a into the receiver, overwriting the previous value of the
Expand Down