Write some Software
$10-30 USD
Paid on delivery
One problem we have had to deal with in the Singular Spectrum Analysis implementation was
Hankelization of a matrix. A Hankel matrix has constant skew diagonal values.
Objective
We would like to take any matrix and Hankelize it (i.e. convert it to a Hankel matrix). The way we do it is
by replacing each element by its diagonal average.
See the example below for a 3 x 6 matrix:
A(0,0) = 2/1
A(0,1) = (A(0,1) + A(1,0))/2 = (7 + 5)/2 = 6
A(1,0) = (A(1,0) + A(0,1))/2 = (5 + 7)/2 = 6
….
A(2,0) = (A(2,0) + A(1,1) + A(0,2))/3 = (3 + 4 – 1)/3 = 2
The solution to this is:
Instructions
1. Feel free to use one of the following languages: C, C++, or Python.
2. We recommend you use an online IDE such as
[login to view URL] There you can find coding IDEs for the
languages mentioned above. Alternatively, you can use whichever environment you prefer.
3. Please provide the code answer for the questions below.
4. Please explain your answers using comments within the code itself.
5. Please send your answer back as soon as you are done.
Questions
1. Write a program to do this (see a generic C++ example below). Initialize the matrix to the same
values as shown above, and produce the Hankelized output.
2. Ensure the implementation will work for any M X N matrix, M < N, e.g., rectangular matrix 100 X
200. Optimize to remove any redundant computations.
3. Explain what steps you might take to further optimize your solution if the dimensions M and N
were known beforehand, and you had to do this several thousands of times for changing data
within the matrix.
NOTE: For this part you don’t have to write any code. A discussion will suffice.
#include <iostream>
using namespace std;
int main()
{
double A[3][6] = {{2, 5, -1, 9, -3, 6}, {7, 4, 2, 4, 2, 10}, {3, -2, -10, 1, 4, 2}};
int M = 3;
int N = 6;
// Write code below that uses M, N and A as input so that it will work
// for any M X N matrix (M < N). Verify output is correct for the initialized A matrix
// Insert code here
return 0;
}
Project ID: #12854652
About the project
6 freelancers are bidding on average $66 for this job
Hello, I am expert in java/c/c++/python/C# and i can deliver your task in the least time and least payments. The code will be well commented and well formatted for better understanding. I believe in long term relations More
Hello, This is not copy/paste message. I read your requirements. I am interested for this job. I have expertise in Wordpress, Laravel, Magento, AngularJS, Ruby on Rails, Core PHP etc. technologies and can work o More