Comments (7)
Alternatively, all of the interfaces could be folded into Matrix, so that all Matrixes would have to implement Col, and Row, and etc. That would be easier if goblas was always on.
This will not happen. Please see the original discussion around the API design.
from matrix.
For example, you may have a Matrix where it is possible to get individual elements, but it is not possible to store any particular Row in memory.
from matrix.
At the moment I think the most Go-like approach is to write a MakeVectorer(Matrix) Vectorer
func. This is easy to write and has minimal allocation costs. This func can then be used to wrap non-Vectorer matrices. Then either Vectorer-needing funcs can have their signatures changed or there can be a call to MakeVectorer internally (the func could be then made unexported).
from matrix.
I wonder if the package is too object-oriented at the moment, for reasons that @jonlawlor mentions. It can be hard to perform operations on abstract matrices. In some cases, this is a good idea (the signatures of Add and AddSym are different for a reason), but in other cases, like Col, it doesn't seem to be.
An alternate proposal would be the following: A specific functionality is a method if, and only if, it does one of the following:
- Implements a package-level interface (i.e. the methods of Matrix)
- Modifies the values in the receiver (many of the arithmetic operations)
- Exposes data that could modify the value of the receiver (RawRowView)
- Involves data specific to the matrix class.
If the functionality does not fit into one of those categories, it is a package-level function, taking in a Matrix (or a specific matrix class).
Here's what I see based on the current methods of dense. Number is the category under which it falls, F means will become a function. Specific other cases.
Add - 2
Apply - 2
At - 1
Augment - 2
Caps - 4
Clone - 2
Col - F
ColView - 3
Copy - 2
Dims - 1
DivElem - 2
Dot - F
Equals - F
EqualsApprox - F
Exp - 2
Grow - 2
L - Should be a method on Triangular
MarshalBinary - 4 (marshaling in general will be implementation dependent)
Max - F
Min - F
Mul - 2
MulElem - 2
Norm - F
Outer - 2
Pow - 2
RankOne - 2
RawMatrix - 3
RawRowView - 3
Reset() - 2
Row - F
RowView - 2
Scale - 2
Set* - 2
Solve* - 2
Stack - 2
Sub - 2
Sum - F
T - 1
TCopy - 2
Trace - F
U - Should be a method on Triangular
UnmarshalBinary - 4
View - 2
from matrix.
This proposal would, for example, decide #159 and help to fix #138 .
from matrix.
SGTM
from matrix.
Fixed!
from matrix.
Related Issues (20)
- Support for n-dimensional matrices HOT 5
- matrix: Repo description should not end in a "." HOT 2
- matrix/mat64: Should view follow Go slicing syntax HOT 3
- matrix/mat64: Ability to get SymDense from Dense HOT 10
- matrix/mat64: Dense.Inverse does not fail on singular matrix HOT 10
- mat64: Dense.Inverse test coverage needs improvement
- matrix/mat64: add `Exp' to TriDense HOT 10
- Update format documentation to include additional format verbs HOT 3
- matrix/mat64: question: re-use of memory for mat64.Vector pointers seems confusing HOT 8
- Failed io_tests HOT 5
- matrix/mat64: Question: add `mat64.Merge` helper function HOT 2
- mat64: rethink XFromY API for extracting matrices from decompositions HOT 2
- mat64: TestDet is flakey HOT 2
- mat64: Eigen returns 0 as values and left and right vectors
- mat64: add examples for GSVD and HOGSVD
- matrix/mat64: Formatted excerpt and prefix do not play nicely together
- matrix/mat64: remove outdated Jama comments
- Question: how add a new column/row to the beginning and end of a matrix? HOT 2
- matrix: implement random method HOT 1
- type Transpose is hard to use in some case ? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matrix.