This question is related to Zero-dimensional matrices, in particular to the answer https://mathematica.stackexchange.com/a/39543/42722.
In Mathematica $0 \times n$-matrices are not well-defined, so I extended the definitions of Dimensions
, Dot
, Transpose
,Join
, ... to a function emptyMatrix[n]
, which should represent an $0 \times n$-matrix for $n\geq 0$.
For example, we have Transpose[emptyMatrix[n]]=ConstantArray[{},n]
and so on. This works all quite well, except that Transpose[ConstantArray[{},n]]
in Mathematica gives {}
, so in this case I need to redefine (instead of simply extending) the function Transpose
on $n \times 0$-matrices.
Is this possible?
transpose[expr_] := Transpose[expr]; transpose[list : {{} ..}] := emptyMatrix[Length[list]];
$\endgroup$Unprotect
and use the same definition onTranspose
. I won't make any promise on that not introducing weird bugs though =) $\endgroup$