Producing a matrix with minimal condition number

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












This code below produces a 42 by 21 matrix called ohms_law_matrix given as input a random 6 by 7 matrix called u_matrix (last column is zeros).



How can I find an u_matrix which gives the smallest possible condition number for the ohms_law_matrix produced? Trying a gradient descent type algorithm I found one which gave condition number of 2.77, is there expected to exist a matrix which gives much smaller condition number then this? (1 would be nice).



index_matrix = [ 0, 1, 2, 3, 4, 5, 6; ...
1, 0, 7, 8, 9,10,11; ...
2, 7, 0,12,13,14,15; ...
3, 8,12, 0,16,17,18; ...
4, 9,13,16, 0,19,20; ...
5,10,14,17,19, 0,21; ...
6,11,15,18,20,21, 0];




u_matrix=[(rand(6,6)),[0,0,0,0,0,0]'];
ohms_law_matrix = zeros(42,21);




%Looping over rows in input.
for meas_row=1:6
%Looping over columns in input.
for el_col=1:7
current_index = el_col + (meas_row-1)*7;
for voltage_index=1:7
%Go from matrix form to vector form.
i = index_matrix(el_col, voltage_index);
if i %this m)eans (el_col ~= voltage_index)
ohms_law_matrix(current_index, i) = ...
u_matrix(meas_row, el_col)...
- u_matrix(meas_row, voltage_index);
end
end
end
end






share|cite|improve this question















  • 2




    If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
    – Paul Sinclair
    Jul 31 at 23:23














up vote
0
down vote

favorite












This code below produces a 42 by 21 matrix called ohms_law_matrix given as input a random 6 by 7 matrix called u_matrix (last column is zeros).



How can I find an u_matrix which gives the smallest possible condition number for the ohms_law_matrix produced? Trying a gradient descent type algorithm I found one which gave condition number of 2.77, is there expected to exist a matrix which gives much smaller condition number then this? (1 would be nice).



index_matrix = [ 0, 1, 2, 3, 4, 5, 6; ...
1, 0, 7, 8, 9,10,11; ...
2, 7, 0,12,13,14,15; ...
3, 8,12, 0,16,17,18; ...
4, 9,13,16, 0,19,20; ...
5,10,14,17,19, 0,21; ...
6,11,15,18,20,21, 0];




u_matrix=[(rand(6,6)),[0,0,0,0,0,0]'];
ohms_law_matrix = zeros(42,21);




%Looping over rows in input.
for meas_row=1:6
%Looping over columns in input.
for el_col=1:7
current_index = el_col + (meas_row-1)*7;
for voltage_index=1:7
%Go from matrix form to vector form.
i = index_matrix(el_col, voltage_index);
if i %this m)eans (el_col ~= voltage_index)
ohms_law_matrix(current_index, i) = ...
u_matrix(meas_row, el_col)...
- u_matrix(meas_row, voltage_index);
end
end
end
end






share|cite|improve this question















  • 2




    If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
    – Paul Sinclair
    Jul 31 at 23:23












up vote
0
down vote

favorite









up vote
0
down vote

favorite











This code below produces a 42 by 21 matrix called ohms_law_matrix given as input a random 6 by 7 matrix called u_matrix (last column is zeros).



How can I find an u_matrix which gives the smallest possible condition number for the ohms_law_matrix produced? Trying a gradient descent type algorithm I found one which gave condition number of 2.77, is there expected to exist a matrix which gives much smaller condition number then this? (1 would be nice).



index_matrix = [ 0, 1, 2, 3, 4, 5, 6; ...
1, 0, 7, 8, 9,10,11; ...
2, 7, 0,12,13,14,15; ...
3, 8,12, 0,16,17,18; ...
4, 9,13,16, 0,19,20; ...
5,10,14,17,19, 0,21; ...
6,11,15,18,20,21, 0];




u_matrix=[(rand(6,6)),[0,0,0,0,0,0]'];
ohms_law_matrix = zeros(42,21);




%Looping over rows in input.
for meas_row=1:6
%Looping over columns in input.
for el_col=1:7
current_index = el_col + (meas_row-1)*7;
for voltage_index=1:7
%Go from matrix form to vector form.
i = index_matrix(el_col, voltage_index);
if i %this m)eans (el_col ~= voltage_index)
ohms_law_matrix(current_index, i) = ...
u_matrix(meas_row, el_col)...
- u_matrix(meas_row, voltage_index);
end
end
end
end






share|cite|improve this question











This code below produces a 42 by 21 matrix called ohms_law_matrix given as input a random 6 by 7 matrix called u_matrix (last column is zeros).



How can I find an u_matrix which gives the smallest possible condition number for the ohms_law_matrix produced? Trying a gradient descent type algorithm I found one which gave condition number of 2.77, is there expected to exist a matrix which gives much smaller condition number then this? (1 would be nice).



index_matrix = [ 0, 1, 2, 3, 4, 5, 6; ...
1, 0, 7, 8, 9,10,11; ...
2, 7, 0,12,13,14,15; ...
3, 8,12, 0,16,17,18; ...
4, 9,13,16, 0,19,20; ...
5,10,14,17,19, 0,21; ...
6,11,15,18,20,21, 0];




u_matrix=[(rand(6,6)),[0,0,0,0,0,0]'];
ohms_law_matrix = zeros(42,21);




%Looping over rows in input.
for meas_row=1:6
%Looping over columns in input.
for el_col=1:7
current_index = el_col + (meas_row-1)*7;
for voltage_index=1:7
%Go from matrix form to vector form.
i = index_matrix(el_col, voltage_index);
if i %this m)eans (el_col ~= voltage_index)
ohms_law_matrix(current_index, i) = ...
u_matrix(meas_row, el_col)...
- u_matrix(meas_row, voltage_index);
end
end
end
end








share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked Jul 31 at 13:30









KALLE THE BAWSMAN

109113




109113







  • 2




    If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
    – Paul Sinclair
    Jul 31 at 23:23












  • 2




    If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
    – Paul Sinclair
    Jul 31 at 23:23







2




2




If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
– Paul Sinclair
Jul 31 at 23:23




If you could express this in mathematical notation instead of requiring people to decipher what you are doing in that code, you'll be much more likely to get useful response.
– Paul Sinclair
Jul 31 at 23:23















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "69"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2868043%2fproducing-a-matrix-with-minimal-condition-number%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2868043%2fproducing-a-matrix-with-minimal-condition-number%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Relationship between determinant of matrix and determinant of adjoint?

Color the edges and diagonals of a regular polygon