Code optimization



Given:
- The size sz of a matrix A (sz=size(A))
- A dimension in this matrix d (1<=d<=length(sz))
- An index in this dimension i (1<=i<=sz(d))

My function "hyperplane" returns the indices I of elements in A that
lie in the "hyperplane" perpendicular to dimension d through the index
i. The code below is an implementation of this algorithm. My question
is how to calculate I without having to construct A.

Thank you
Christophe Lauwerys

%%%%%%%%%%%%%%%%

I = hyperplane(sz,d,i)

A = zeros(sz);
nd = length(sz); % number of dimensions
if i>sz(d), error('I must be smaller or equal to SZ(D)'); end

pm=circshift((1:nd)',-d+1);
Ap = permute(A,pm);
Ap(i,:)=1;
A=ipermute(Ap,pm);
I = find(A);

%%%%%%%%%%%%%%%%

.



Relevant Pages

  • Re: ? orthogonal hyperplane
    ... orthogonal to that given vector and they are lying on ... how about in a dimension that is higher ... maybe a hyperplane) that contains all the orthogonal ... I.N. Galidakis ...
    (sci.math)
  • Re: common point of two planes
    ... It just occured to me that I have mixed two kinds of planes in the ... For dimension 3 these two are the same. ... actually finds the intersection of a hyperplane and a 2-flat. ...
    (comp.graphics.algorithms)
  • Lie groups that are not matrix groups
    ... So in the book Representation Theory by Fulton and Harris, ... classifying Lie algebras of dimension 3 in one of their beginning ... Lie groups with some algebra, they take the quotient of G/N with N any ...
    (sci.math.research)
  • Re: Partitioning 4 space with ultraskew lines, and the three body problem.
    ... > two skew lines will lie in the same 3 space. ... > 2) In the three-body problem, ... subspaces have dimension 3, so each has a perp that meets the 3-sphere ...
    (sci.math.research)
  • Re: Douady-Hubbard Potential
    ... Kinetic of the Mandelbrot set. ... I called this "fractal field theory" about 1991 or 2 in TFTN. ... and they are generally perpendicular to each other. ... This idea gets very strange when the one of them is of fractal dimension instead of topological dimension. ...
    (sci.fractals)