Calculation with three dimensional matrices
Show older comments
I want to calculate a vector
, with each element
defined as follows
, with each element
defined as follows
, where
is the set of N dimensional vector, and
is also the set of N dimensional vector, c is a constant. The superscript T is denoted as the transpose operation.In my matlab code,
is stored as a three dimensional matrix G, its dimension is
(where
).
is stored as a three dimensional matrix G, its dimension is
).
is also stored as a three dimensional matrix W, its dimension is
). c is a scalar.I know i can use multiple for loop to calculate this vector Y, but it is too inefficient. Is there any some fast way to calculate it, maybe use three-dimensional matrix calculation method?
9 Comments
Matt J
on 18 Jan 2025
Isn't
supposed to represent a scalar product? If so, why do you have a subscript of 2 in
as if you are taking l2-norm of a vector?
Hancheng Zhu
on 19 Jan 2025
Torsten
on 21 Jan 2025
It's just a formal mathematical description of what should be coded. In the code, g_(k,j) and w_(k,i) must be of size (N,1).
埃博拉酱
on 21 Jan 2025
@Torsten I've always felt that mathematical formulas are far less expressive than program code. Many of the symbolic representations are rudimentary, crude, and ambiguous. Shortness is perhaps its only "advantage" - which is often criticized in program code for sacrificing readability.
Torsten
on 21 Jan 2025
I've made the opposite experience.
Imagine you have code for the computation of Y_i. I would be really surprised if it were easier to read than the mathematical formula from above.
Paul
on 21 Jan 2025
Perhaps you should post the code that you have along with sample input data.
Accepted Answer
More Answers (1)
Divyanshu
on 21 Jan 2025
0 votes
You can try using 'pagetimes' function of MATLAB. For more details about 'pagetimes' refer the following documentation link:
Additionally, you can take reference from following MATLAB answer thread as well:
Hope it helps!
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!