# Why is the gradient a double vector

## Julia: Take vector transpositions seriously

For example, vector vectors that give a vector (# 2472, # 2936), vector 'that gives a matrix, and vector' that gives a matrix (# 2686) are all bad math.

The double-dual of a finite dimensional vector space is isomorphic to it, not identical. So I'm not sure how bad math is. It's more that we tend to gloss over the distinction between things that are isomorphic in math because the human brain is good at handling this kind of slippery ambiguity and just doing the right thing. Even so, I agree that this should be improved, not because it's mathematically wrong, but because it's annoying.

How can but? Does it make more sense than we thought its own operator is?

The double-dual of a finite dimensional vector space is isomorphic to it, not identical.

(I speak like me now) Not only is it isomorphic, it is naturally isomorphic, meaning the isomorphism is independent of the choice of base. I cannot think of any practical application for which it is worth distinguishing between this type of isomorphism and an identity. IMO the annoyance factor comes from this type of distinction.

Does it make more sense than we thought that is a separate operator?

That was the impression I got from talking to @alanedelman this afternoon.

I think what Jeff is asking matches the money ... it looks like x'_y and x_y 'are doing more
Meaning than ever.

I agree with @stefan. Bad math shouldn't mean wrong math was
meant annoying math. There are many things that are technically correct but not very nice ...

If we follow this logic, we have two options

x_x remains an error ..... maybe with a suggestion "you might want to use period"
or x_x is the dot product (I don't love this choice)

If and are the same, then if you want that, it means that too. There is no way out of this. We could do another operation, but I'm not sure it's a great idea. People want to be able to parenthesize this in an obvious way and still make it work.

I want to point out that there is basically no going back if we allow the dot product to mean. It's going to be included in people's code everywhere and it will be a nightmare to root it out. Natural isomorphism or not is not pure math, and we have to deal with the fact that different things are different in a computer.

Another reason for differentiating between and is that our sending behavior currently allows this very convenient behavior: is column-stochastic and is line-stochastic. The same thing could be done for normalization if we had "fixed" the function to make it easy to use across rows and columns. Of course, we could still have and return matrices instead of up and down vectors, but that seems a bit different.

I like the idea of ​​up and down vectors. The problem is to generalize it to higher dimensions in a way that isn't completely insane. Or you can just make vectors a special case. But that also feels wrong.

It is true that up / down can be a separate theory. The approach to generalizing them seems like a nested structure that steers things in a different direction. Very likely there is a reason they don't call them vectors.

Also would not make associative, as in vs.. I really hope we can avoid that.

Yes. For me this is completely unacceptable. I mean, technically floating point is not associative, but it's almost associative while that would just be obviously not associative.

We all agree that shouldn't be the dot product.

The question remains whether we can imagine and as the dot product -
I really like it when it works like that.

@ JeffBezanson and me

One suggestion is the following:

is a bug for vectors (this is what Mathematica does)
and is a point product (result = scalar)
is an outer product matrix (result = matrix)

There is no difference between row and column vectors. I liked that anyway
and was glad to see Mathematica's precedent
From mathematica: http://reference.wolfram.com/mathematica/tutorial/VectorsAndMatrices.html
Because of the way Mathematica uses lists to represent vectors and matrices, you never need to distinguish between "row" and "column" vectors

Users need to be aware that there are no row vectors .... period.

So if there is a matrix

is a mistake ..... (assuming we go with is a scalar
The warning could indicate or or try

or is a vector of length 1 (this is Julia's current behavior anyway)

Regarding the closely related problem in https://groups.google.com/forum/#!topic/julia -users / L3vPeZ7kews

Mathematica compresses scalar-like array sections:

[Edit: Code Formatting - @StefanKarpinski]

@ Alanedelman

Suppose we go with M [1 ,:] is a scalar

do you mean M [1,:] is just a vector?

Yes I'm sorry. In my opinion, M [1 ,:] processed the scalar 1 :-)

Mathematica uses the period instead of the star
and then goes the whole 9 yards and makes (vector. vector) a scalar, which is exactly what we're avoiding
with the asterisk.

There are undoubtedly many problems with your period, one of which is that it just doesn't
look like the "dot" in a dot product, and another of these is that it collides with
the "pointwise op" reading of the point,

Unicode does a very good job of providing a character called "the dot operator".
that we can imagine offering

So we could be synonymous with

In summary, a current proposal is the subject of debate

1. Scalar indexing ends the dimension in this way
is a vector, as well as
2. The vector indexing is thick
or returns a matrix with one row
3. or is the dot product for vectors (similar for the outer product)
4. is undefined for vectors (point user ????)
5. returns a vector if A is a matrix
6. also decreases the point product (but does not go as far as mathematics by working on matrices
7. is not defined for vectors, but a warning can provide the user with good suggestions, including

Those are the consequences

a. If you stick to the fact that all vectors are column vectors, everything will work
b. If you make everything into a matrix then surely everything will work, and making everything into a matrix is ​​easy
c. If your mind can't distinguish a row vector from a single row matrix, you are probably literate
polite and graceful
d. This dot notation is easy on the eye

Suggestion 5) looks very strange to me. I prefer, in order for it to be explicitly stated, that you use the double vector. This is especially important in complex vector spaces where the dual is not just a "shape" transformation.

I would like @StefanKarpinski repeat, that it would be pretty unfortunate to lose our incisive broadcast behavior in all of this. After this change, what is the concise syntax to normalize a vector and the columns of the matrix by these values? Currently you can. This is very good for data manipulation.

Good questions

My scheme does not preclude taking the complex conjugate of v and multiplying by A.
and all the various other cases that I haven't specifically mentioned, but could easily

we could eliminate 5
Maybe that's desirable
It doesn't conform to my column vector rule

This approach to broadcasting is cute and clunky
One solution is now

It has the advantage of documenting which dimension is being sent
and generalized to higher dimensional arrays

Oh, and the solution has the virtue of NOT taking the complex conjugate
That's probably what the user intended .....

I like these two examples because the first is a LINEAR ALGEBRA example
where a complex conjugate is very often desired, but the second example is
A MULTIDIMENSIONAL DATA EXAMPLE in which things are supposed to work in all dimensions
not just for matrices, and we most likely don't want a complex conjugate

requires # 552. This is the third time in the last two weeks.

Another reason for the distinction between M [1 ,:] and M [:, 1] is that our sending behavior currently allows this very convenient behavior: M./sum(M,1) is column-stochastic and M./sum(M , 2) is line stochastic. The same thing could be done for normalization if we had "corrected" the norm function to allow easy application across rows and columns. Of course, we could still have sum (M, 1) and sum (M, 2) return matrices instead of up and down vectors, but that seems a bit different.

It seems to me that the sending behavior is nice at times, but you have to squeeze those extra chunks out just as often. So it's okay to do the opposite sometimes when the rest of the system is better (and I think removing scalar dimensions makes the system more beautiful). So you need a function like

This enables code like or (see example @blakejohnson above).

M [:, 0 ,:] and v [:, 0] ?????

I am more with @blakejohnson on the reduction question; Personally, I think it's clearer dimensions than them. I suspect I would keep checking the documents to see if the dimension inserts on or after the specified index, and the numbering gets a little more complex when you want to expand multiple dimensions at once. (What makes for a vector?) Neither of these problems is for.

Regardless of whether we'd expand or push by default, I think Julia should follow numpy's lead when it comes to expanding, and should allow something like. But I believe that I prefer to keep dimensions rather than discarding them. It is more difficult to find a bug where you accidentally broadened the wrong path than when you pressed the wrong path (which usually leads to an error).

In @alanedelman's list
I feel that

v * A returns a vector if A is a matrix

is not good.

v_A should be an error if A is not 1x1 (index range mismatch)
v'_A should be the right way to do this.

One way to fix this problem is to automatically convert the vector v to the nx1 matrix (if necessary).
and always treat v 'as a 1xn matrix (never convert that to a vector or an nx1 matrix)
Also, we can automatically convert the 1x1 matrix to a scaling number (if necessary).

I believe this is a consistent and uniform way of thinking about linear algebra. (good math)

A common way to handle all of these problems is to enable automatic (type?) Conversion (if necessary).
between arrays of size (n), (n, 1), (n, 1,1), (n, 1,1,1) etc. (but not between arrays of size (n, 1) and (1, n ))
(Just like we automatically convert real numbers to complex numbers when needed)

In this case an array of size (1,1) can (if necessary) be converted into a number (see # 4797).

Xiao Gang (a physicist)

However, this leaves v'_A ... I really want v'_A * w to work

My impression of linear algebra in Julia is that it is very well organized like matrix algebra, although scalars and true vectors exist (which I think is good!).

Let's consider how with a product like, where each factor can be a scalar, a vector, or a matrix, possibly with a transpose on it. The matrix algebra defines the product of matrices, where a matrix is ​​the size. One approach would be to expand this definition in such a way that or by what acts as a value of one for the computation of the product, but is used to distinguish scalar and vectors from matrices:

• A scalar would be
• A (column) vector would be
• A line vector would be

Ideally, we would like to arrange things so that we never have to represent row vectors, but it would be enough to implement operations like and. I feel like this is the flavor of the scheme many of us are looking for.

But I am beginning to suspect that banning row vectors in this type of scheme will come at a high cost. Example: Think about how we would have to put a product in brackets in order to avoid that a line vector is formed in an intermediate step: (is a scalar, and are vectors)

To evaluate a product and avoid creating row vectors in the process, we would need to know the types of factors before choosing the order of multiplication! If the user were to do this by themselves, it would appear to be an obstacle to generic programming. And I'm not sure how Julia could reasonably do it automatically.

Another reason not to pre-set the multiplication order: I remember the idea of ​​using dynamic programming to choose the optimal evaluation order of to minimize the number of operations required. Anything we do to avoid row vectors from forming is likely to upset this.

At the moment, the introduction of a transposed vector type seems to me to be the most sensible alternative. Doing this or all as now except deleting subsequent singleton dimensions if they are kept would result in an error.

Transposition is just a special way of permuting modes. If you allow, where is a vector, it should return exactly the same thing. Either they both return a special type of row vector or they introduce a new dimension.

Having a special type for row vectors doesn't seem like a good solution to me because what are you going to do with other types of mode-n vectors e.g. B.? I urge you to also consider multilinear algebra before making a decision.

@toivoh mentioned that

"One approach would be to expand this definition in such a way that n or m could be replaced by absent, which acts like a value of one for the calculation of the product, but is used to differentiate between scalar and vectors of matrices:

1. a scalar would be missing x missing
2. a (column) vector would be missing nx
3. a line vector would be missing xn "

In multilinear algebra (or for high-margin tensors), the above suggestion is equivalent to using absence for representation
Many of the range 1 indices, i.e. the size (m, n, absent), can correspond to (m, n), (m, n, 1), (m, n, 1,1), and so on.

Using this interpretation of absent, 1st and 2nd are fine and nice to have, but 3rd may be wrong.
We don't want to mix arrays of size (1, n) and (1,1, n).

I'm not a specialist in tensor theory, but I've used all of the above systems (with no additional packages) for extensive linear algebra projects.

Here are the most common scenarios I've found that handling arrays needs to be more general than common matrix vector operations:

(1) Functional Analysis: As soon as you use the Hessian of a vector valued function, for example, you need higher order tensors to work. If you do a lot of math, it would be a huge pain to have to use special syntax for these cases.

(2) Evaluation control: For example, for every product that can be calculated, one should be able to calculate each sub-unit of that product separately, as one may wish to combine it with several different sub-units to form different products. Therefore, Toivo's concern that for example being banned is not just a compilation problem, but a programming problem. An even more common variant is the pre-calculation of square shapes,, ... (whereby these must be carried out one after the other).

(3) Simplifying the code: When dealing with arithmetic operations that are mapped over multidimensional data sets, I have found several times that 6-7 lines of unfathomable loop or function mapping codes in systems can be replaced by one or two short array operations the one provide adequate generality. Much more readable and much faster.

Here are my general experiences with the above systems:

MATLAB: The core language is limited beyond the usual matrix-vector operations, so that loops are usually written with indexing.

NumPy: More general functions than MATLAB, but messy and complicated. For almost every nontrivial instance of a problem, I had to refer to the documentation, and even then I sometimes found that I had to implement an array operation myself that I thought should have been defined intuitively. It seems that there are so many different ideas in the system that every user and developer will have trouble automatically guessing how the other will think about something. It is usually possible to find a short, efficient route, but that route is not always obvious to the author or reader. In particular, I feel that the need for extension and singleton dimensions only reflects a lack of generality in the implementation for using operators (although some may find this more intuitive).

Mathematica: Clean and very general - in particular, all relevant operators are designed for higher-order tensor behavior. See next to Dot, for example, the documents on transposing, collapsing / partitioning and inner / outer. If you just combine these operations, you can already cover most array juggling use cases. Version 9 even adds additional tensor algebra operations to the core language. The downside is that while the Mathematica method is clean and meaningful (if you know the language), it may not conform to common math notation. And of course, it makes it difficult for the general public to know how the code works.

scmutils: For functional analysis, it is clean, general, and offers the most mathematically intuitive operations (both writing and reading) of the above. The up / down tuple idea is actually just a more consistent and general extension of what people often do in written mathematics with transposition symbols, differentiation conventions, and other semi-standardized terms. but everything just works. (To write my PhD thesis, I developed a consistent and unambiguous notation that is similar to traditional math notation, but isomorphic to Sussman & Wisdom's SICM syntax.) They also used it for an implementation with differential geometry  inspired one Port to SymPy . I didn't use it for data analysis, but I would expect that in a generic array context where you only wanted one type of tuple (like Mathematica's list) you can only select one ("up") by convention. Again, the general public obscures the performance aspects from the programmer, but I would hope this is an area where Julia can excel.

SUMMARY

I think the proposed transposed vector type should be characterized as the more general "down" tuple in scmutils, while regular vectors are the "up" tuples. Calling them something like "vector" and "transposed vector" would probably make more sense to humans than calling them "up" and "down" (at the expense of brevity). This would support three categories of use:

(1) for data analysis, people who want only nested arrays need only "vector";
(2) for linear matrix vector algebra, humans can use "vector" and "transposed vector" in direct accordance with mathematical convention ("matrix" would be equivalent to a "transposed vector" of "vector");
(3) For higher order tensor operations (where there is less standardization and people usually have to think anyway) the implementation should support the full generality of the two-kind tuple arithmetic system.

I believe this approach reflects the emerging consensus about the outcomes of various operations, except that the cases where previous posts considered errors (and actually make sense (and often useful) outcomes.

 http://dspace.mit.edu/handle/1721.1/30520
 http://krastanov.wordpress.com/diff-geometry-in-python/

@thomasmcoffee sounds like you're advocating an explicit distinction between co- and contravariant vectors.

I would consider this a common application, but too specific for what I advocate: to me this has a geometric meaning that implies a restriction to rectangular number tensors (for coordinate representations). Since I envision (with no expertise in this area) that a suitable library of tensor algebra functions with standard arrays would normally be sufficient for this purpose, I agree with Alan's argument that this alone is not compelling enough to introduce a two-way system the core language.

I am mainly thinking of other applications that depend on a more general nested structure, for example computing functions of multiple arguments of mixed dimensionality, which would later be more difficult to develop as "add-ons" if the core language did not support this distinction. Maybe we mean the same thing.

The problem with up and down vectors is that you have to extend the idea to general arrays. Otherwise, vectors will be separated into something special and separated from arrays, rather than just the one-dimensional case of an array, which would create a whole mess of terrible problems. I've thought a lot about how to do this, but haven't found any acceptable ones. If you have any good ideas on how to generalize up and down vectors to arrays, I'd love to hear them.

I'm just trying to extrapolate this idea. As far as I know, for each dimension you need to indicate whether it is pointing up or down in order to calculate with an array of up and down vectors. In general, this could be achieved by wrapping an array in something like this

This would be a bit mask to indicate which dimensions are active. Operations on non-enclosed arrays could then be implemented by providing a default value of as a function of: vectors would by default be a single Up, matrices would be the first Up and the second Down; then I'm not sure how it would reasonably continue.

Some random thoughts:

• Would quadratic / bilinear shapes be better represented by two downward dimensions?
• If transposing were just about flipping the up / down movement of each dimension, we would likely also get a transposed matrix type with the first dimension down and the second up.
• Standard upward patterns can be represented directly by the underlying array rather than packaging it.

Well, this is certainly a generalization of the type, and it certainly has some advantages. I am not sure if it is doable.

I think Toivo's proposal is a reasonable take on what I advocated above. For me, it makes the most sense to continue the changes in direction at higher orders: for example, if someone provided the components of a power series as non-enveloped arrays, this would be the right thing to do.

However, on further reflection, I think it could be very effective to combine both ideas: (1) distinctions between up and down vectors, and (2) distinctions between arrays and vectors. Then you could have objects with some dimensions higher, some lower, and others "neutral". The reason for differentiating between arrays and vectors is that arrays are used semantically for organization (collecting several things of the same kind), while vectors are used for coordination (representing multidimensional spaces). The ability to combine both distinctions in one object consists in the fact that both purposes can be fulfilled at the same time. The neutral dimensions would be handled according to the broadcast rules, while the up / down dimensions would be handled according to the tensor arithmetic rules.

Back to an earlier example of mine, let's say you compute a series of square shapes for different vectors. According to SICM, denote tuples (column vectors) with and tuples (row vectors) with. If you want to do all of this at once and only deal with up / down, the traditional method is to use a down tuple (from) to a matrix, which puts the results in a down tuple. But what if you want to multiply each of these results by a (column) vector? You can't just as you get a contraction (dot product). You can convert to an up-tuple and then multiply, which will get your results in an up-tuple (of up-tuples). But let's say you need a down tuple for the next step? Semantically, you have a dimension that your computation goes through which is just a collection of things that you always want to send. However, to do this in the strictly up / down world, you still need to do arbitrary contextual conversions to get the correct behavior.

Suppose you also have neutral tuples (arrays) labeled. Then of course you write as an array (of up to tuples) so that is an array and is also an array (of up to tuples). Everything makes sense and no arbitrary conversions are required.

Stefan suggests that distinguishing 1-D arrays from up / down vectors is catastrophic, but I think this problem is solved by the fact that most functions make sense when vectors are _or_ on arrays but NOT _ehrner_ operated become. (Or on matrices _or_ on arrays of vectors _or_ on vectors of arrays _or_ on arrays of arrays, but NOT _either_. And so on.) With appropriate conversion rules, I have not imagined a common case that would not do the right thing automatically. Maybe someone can?

On a closer look  I found that scmutils actually distinguishes what they call "vectors" from up and down tuples under the hood. Currently, however, the conversion rules are set up in such a way that these "vectors" are mapped to up tuples each time the up / down world is entered (as I had previously suggested), with the restriction that "we reserve the right to use these Implementation to distinguish between changing schema vectors from up-tuples. "(Perhaps someone on campus can ask GJS if he has certain ideas.) The Sage system  largely separates the handling of arrays from vectors and matrices (currently no core support for tensors) and the only problems I had with this has to do with the lack of built-in conversion between them in cases that would obviously make sense.

 http://groups.csail.mit.edu/mac/users/gjs/6946/refman.txt --- starting with "Structured Objects"
 http://www.sagemath.org/

I talked to @jiahao at the lunch table and he mentioned that the Julia team was trying to figure out how to get linear

For the moment, let's just look at the product between two arrays. Other operations have a similar generalization. The three most common types of products when dealing with arrays are the outer product, the inner product, and the element-wise product. We usually think of doing such operations between two objects, such as B. or. However, when these operations are performed on higher dimensional arrays, they are not performed between the arrays as a whole, but rather between specific dimensions of the arrays. Multiple outer / inner / element-wise sub-operations occur in a single operation between two arrays, and each dimension of each array must be assigned to exactly one sub-operation (either explicitly or a default setting). For the inner and element-wise products, a dimension on the left must be paired with an equally large dimension on the right. The outer product dimensions do not need to be paired. Most of the time, the user makes either an inner product or an element-wise product between a pair of dimensions and an outer product for all others. The outer product is a good default setting because it is the most used and does not need to be paired.

I usually think the dimensions are named rather than ordered, much like the x, y, and z axes of a chart. However, if you want users to actually access the arrays through ordered indexing (for example, instead of), you must have a consistent procedure in place for ordering the results of an operation. I propose to order the result by listing all the dimensions of the first array followed by listing all the dimensions of the second array. All dimensions that were involved in an inner product are pushed out, and for dimensions that were involved in an element-wise product, only the dimension is pushed out of the second array.

I'll come up with a notation for it. Feel free to Juliafy it. Let be an array that of from and be an array that of. Let us assume that the inner product between the dimensions and, the element-wise product between and and the outer product of. The result would be an array that times.

It should be clear that no binary or unary operator will have much meaning in the context of arrays with higher dimensions. You need more than two arguments to indicate what to do with each dimension. However, you can regain the ease of linear algebra by shortening the Matlab operators for array operations in only the first two dimensions:

Matlabs is.

Matlabs is where permute leaves all dimensions above the number of the third argument unchanged.

You can choose whether to return errors if the dimensionality of the arrays is greater than 2 or even not equal to 2, as Mathematica does with vector transpositions. If you're just using the general array computations, you don't have to decide whether you the suggestion of want to interpret all (n, m) arrays as (n, m, 1) and (n, m, 1) 1). Only when using the linear algebra operators or other operators expecting an array or a certain dimensionality do you need to make this decision. I like the suggestion from @wenxgwen because a dynamically typed language has few disadvantages.

I've written a more detailed description of my system that includes addition, exponentiation, and differentiation along with the chain rule and the product rule for array computation.

Thanks for the perspective! I found this pretty insightful in understanding what a beast a generic Array * Array product really is.

It may be interesting to refer to the proposals for multidimensional array multiplication with the semantics proposed in PEP 0465 for a matrix multiplication operator

1d vector inputs are promoted to 2d by prepending or appending a '1' to the shape, the operation is performed, and then the added dimension is removed from the output. The 1 is always added to the "outside" of the form: prepended for left arguments and appended for right arguments. The result is that matrix @ vector and vector @ matrix are both legal (assuming compatible forms) and both return 1d vectors; vector @ vector returns a scalar ... An infelicity of this definition for 1d vectors is that @ is not associative in some cases ((Mat1 @ vec) @ Mat2! = Mat1 @ (vec @ Mat2)). However, this seems to be a case where practicality outperforms purity

Typing in Python causes a particular problem. Of course, arrays and matrices should be interchangeable (the same underlying data). However, because Python does not recommend checking a type, matrices at the beginning of a function expecting an array are not converted to the correct interface, and vice versa. For this reason, they must have different operator characters. Julia with run-time type checking and methods does not suffer from this ambiguity.

From PEP 0465:

One infelicity of this definition for 1d vectors is that @ is not associative in some cases ((Mat1 @ vec) @ Mat2! = Mat1 @ (vec @ Mat2)).

In particular, this type of definition in Mathematica can lead to incorrect results, since () in symbolic evaluation (as in) is assumed to be associative () below, but not with):

Of @drhagen :

Julia with run-time type checking and methods does not suffer from this ambiguity.

For this reason, I think the right solution for Julia is to let the data itself distinguish between array-like semantics (for universal broadcasting) and tensor-like semantics (for possible contraction).

I'm by no means an authority here, but I don't think the general arbitrary dimensional collection type () should support an operator that does dot products. This operator simply cannot be meaningfully defined for this type, since the dot product can lie between any two dimensions and additional arguments are required that cannot be provided to a binary operator. The same is true for all linear algebra operations, etc.

In order to be able to work in the mathematical realm of linear algebra, there should be three other types:, and, on which all normal linear algebra operators and functions work as usual.

Now that the type structure is well defined, you can make it easier for the user to add an implicit conversion for to. and until (not sure), until and until.

My suggestion above (https://github.com/JuliaLang/julia/issues/4774#issuecomment-32705055) allows each dimension of a multidimensional structure to be differentiated, whether it is neutral ("collection" / "array"), up ( "Column") or downward semantics ("Row"). I think what you are describing is a special case.

The advantage of this general approach is that even with calculations involving many dimensions of data or space, you can get operators to do exactly the right thing without explicitly specifying which dimensions to work on. I think we agree that in Julia at least it is much more intuitive and readable for a user to specify the meaning of the input data by selecting type parameters than having to specify the meaning of each operation by calling each instance with additional arguments for dimension indices . Implicit or explicit conversions can still be used with full dimensional generality if the meaning needs to be changed in unusual ways in the midstream.

@ Thomasmcoffee I really like your suggestion. I implemented something vaguely similar into a DSL (long time ago, far away) with a few guiding principles (aka personal opinions):

1. The concept of the duals as different is of crucial importance for any reasonably self-consistent semantics.
2. Ad hoc enforcement of tensor algebra with parameterized operators (or anything outside of the data) is aesthetically very uncomfortable.

The biggest complaints I got at the time (and which were loud) were about the very kind of inconveniences your trivalent semantics (adding a neutral collection term) solve. Kind! That idea never crossed my mind, but it makes so much sense now that you are posting it there. I would really like to use a system like this, and I mean for real work. It would be nice if Julia could record this!

What you seem to be describing are regular tensors. I doubt this is a widely used use case to warrant inclusion in the standard library, as the other two use cases (collections and linear algebra) are far more common. However, if it could be integrated seamlessly, I would support it. Can you give some examples of what some common operations would look like under this system, such as: B. vector matrix multiplication, scalar array multiplication, distributing the addition of an array to an array of arrays, etc.?

I think you are right David. We're really talking about two use cases.

The linear algebra subset is the most needed by most people like you
say. There, too, I advocate the distinction between v and v '.

What I would really like to have (insert disclosure of greed here) is tensor with
first class (or closed) status ... close to native speed (in borderline cases,
compared to linear algebra performance) with simple syntax, not revised
Typing problems in which co / contravariance is coded in the data are not imposed
the operators. Once I've defined the data semantics, the operations
just work. Tensoral Duck Typing.

Maybe tensors and TDT belong in one package and not in the core, just on
Reasons of relative popularity. But like the Julia explanation from
Independence says Julia was born out of greed. And as Gordon Gecko says:
Greed is good. :) :)
On March 21, 2014, 3:14 am, "David Hagen" wrote