GithubHelp home page GithubHelp logo

Comments (9)

mikera avatar mikera commented on August 23, 2024

Do you mean dimensionality or dimensions?

For a 3x3 matrix, dimensionality is 2 (it's a 2D matrix) and dimensions are [3 3]

Apart from that I like the word size in principle but the only main I was cautious about size was ambiguity: it might get confused with the total number of items in the matrix. That it what it means in NumPy at least.....

Any examples of what other matrix libraries use?

from core.matrix.

ejackson avatar ejackson commented on August 23, 2024

Sorry, yes, I mean dimensions. For this R uses dim, MATLAB uses size, mathematica uses Dimensions. So no consensus there :)

For the total number of elements matlab provides numel (i think its a bit ugly). How about count, or card ?

from core.matrix.

mjwillson avatar mjwillson commented on August 23, 2024

numpy uses "ndim" for the number of array dimensions, and "shape" for the tuple of sizes along those dimensions.

It also uses the term "axis" a lot in its API for a specific dimension of an ndarray

from core.matrix.

mikera avatar mikera commented on August 23, 2024

I quite like "shape" as an alternative to "dimensions"

ecount might be good as a reasonably concise term for the total number of elements - it would be consistent with ereduce, emap etc, for the other element-by-element operations.

ndim feels unidiomatic to me in Clojure for some reason. Though I recognise I have a general bias against use of abbreviations....

from core.matrix.

ejackson avatar ejackson commented on August 23, 2024

Yes, shape is nice, sounds like quorum to me :)

ecount I think is a problem. The e_verb_ convention is to apply verb to each element of the matrix, thus wouldn't ecount imply: apply the function count to each element ? The count we want is not an elementwise op, but a collectionwise op. Admittedly, this might be inferring too much from the convention.

I still think count or card are better.

from core.matrix.

mikera avatar mikera commented on August 23, 2024

OK sounds agreed dimensions -> shape

OTOH I don't think e*verb* does currently mean apply *verb* to each element at present - ereduce for example isn't applying reduce to each element, it is applying reduce to a hypothetical sequence of all elements. Likewise for emap. e+ works as shorthand for emap + in this sense.

ecount would be consistent with that, the sense that (count seq) returns the count of all elements in a seq.

Without having a specific formal definition in mind, I was interpreting e_something_ as "version of something that works over the array seen as a collection of elements". Rather like areduce for Java arrays in clojure.core. I imagine clojure.core would have acount as well were it not for the fact that count already works fine on Java arrays.

This is good discussion though - let's keep pushing this, naming is so important for any API.

from core.matrix.

mikera avatar mikera commented on August 23, 2024

Anyone want to do a patch for dimensions -> shape?

Happy to do it myself, but I'm conscious that other people may want to get involved with hacking the API and this is probably a good one to start with.....

from core.matrix.

ejackson avatar ejackson commented on August 23, 2024

e_verb_. I see your point. I need to think about this a bit.

from core.matrix.

mikera avatar mikera commented on August 23, 2024

Seems like we can close this one.

from core.matrix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.