{"id":3937,"date":"2021-01-14T13:27:49","date_gmt":"2021-01-14T18:27:49","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/?p=3937"},"modified":"2021-03-16T10:21:55","modified_gmt":"2021-03-16T14:21:55","slug":"paged-matrix-functions","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2021\/01\/14\/paged-matrix-functions\/","title":{"rendered":"Paged Matrix Functions"},"content":{"rendered":"<div class=\"rtcContent\">\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Today's guest blogger is Mary Fenelon, who is the product marketing manager for Optimization and Math here at MathWorks. In today's post she describes how using the new paged matrix functions can simplify your code and improve performance.<\/div>\r\n<div style=\"margin-bottom: 20px; padding-bottom: 4px;\">\r\n<div style=\"margin: 0px; padding: 10px 0px 10px 5px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: bold; text-align: start;\"><span style=\"font-weight: bold;\">Table of Contents<\/span><\/div>\r\n<div style=\"margin: -1px 0px 0px; padding: 10px 0px 10px 7px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: start;\"><a href=\"#H_CA5A54E4\">Paged Matrix Functions\r\n<\/a> <a href=\"#H_55DA6064\">Easier\r\n<\/a> <a href=\"#H_214E3B32\">Faster\r\n<\/a> <a href=\"#H_A5E178F6\">More\r\n<\/a><a href=\"#H_8731856A\">Helper Functions<\/a><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">A batched, page-wise matrix multiply function <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/pagemtimes.html\">pagemtimes<\/a>, along with page-wise transpose <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/pagetranspose.html\">pagetranspose<\/a>, and complex conjugate transpose <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/pagectranspose.html\">pagectranspose<\/a> functions, were added to MATLAB\u00ae in R2020b. The new functions make operations where an N-D array is a container for dense matrices easier to write and faster to run.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">For example, if A and B are 3-D arrays and you want to compute the array C to be the collection of matrices formed by multiplying the matrices contained in the first two dimensions of A and B, you could do this with the statement <span style=\"font-family: monospace;\">C = pagemtimes(A,B).<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;\" src=\"https:\/\/blogs.mathworks.com\/loren\/files\/pagedMatrixFcnsBlog_1.png\" alt=\"\" width=\"445\" height=\"163\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The alternatives besides for-loops to <span style=\"font-family: monospace;\">pagemtimes<\/span> are <span style=\"font-family: monospace;\">dlmtimes<\/span> for <span style=\"font-family: monospace;\">dlarray<\/span> in the Deep Learning Toolbox and <span style=\"font-family: monospace;\">pagefun<\/span> for <span style=\"font-family: monospace;\">gpuArray<\/span> and distributed arrays in the Parallel Computing Toolbox. These are still available, but now you can use pagemtimes for regular arrays as well as <span style=\"font-family: monospace;\">dlarray<\/span> and <span style=\"font-family: monospace;\">gpuArray<\/span>.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Sometimes you only need to transpose a collection of matrices. Now you can use <span style=\"font-family: monospace;\">pagetranspose<\/span> instead of <span style=\"font-family: monospace;\">permute<\/span>.<\/div>\r\n<h3 id=\"H_55DA6064\" style=\"margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #3c3c3c; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">Easier<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">In this example, the matrices to be multiplied are stored in the first two dimensions of a 4-D array<\/div>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9; border-bottom: 0px none #000000; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">A = rand(4,5,6,7);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 1px solid #e9e9e9; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">B = rand(2,5,6,7);<\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">This doubly nested for-loop computes the matrix-matrix products.<\/div>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9; border-bottom: 0px none #000000; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">C1 = zeros(size(A,1),size(B,1),6,7);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">for <\/span>p = 1:size(A,3)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0000ff;\">for <\/span>q = 1:size(A,4)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> C1(:,:,p,q) = A(:,:,p,q)*B(:,:,p,q).';<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> <span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 1px solid #e9e9e9; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Using <span style=\"font-family: monospace;\">pagemtimes<\/span>, that code can be simplified to a single function call:<\/div>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; border: 1px solid #e9e9e9;\"><span style=\"white-space: pre;\">C2 = pagemtimes(A,<span style=\"color: #a020f0;\">'none'<\/span>,B,<span style=\"color: #a020f0;\">'transpose'<\/span>);<\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">That is certainly easier. The string options specify that the page-wise transpose of the second array should be used in the multiplication. <span style=\"font-family: monospace;\">pagemtimes<\/span> implicitly expands the dimensions beyond three to multiply all combinations of the paged matrices.<\/div>\r\n<h3 id=\"H_214E3B32\" style=\"margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #3c3c3c; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\"><span style=\"font-weight: bold;\">Faster<\/span><\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Now that I've made the case for easier, how about for faster? Does the speed-up vary with the size of the N-D arrays? The loop below runs through a set of matrices with varying row sizes of the first matrix but fixed dimensions otherwise. I plot the times and the speed-ups.<\/div>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9; border-bottom: 0px none #000000; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">rng(<span style=\"color: #a020f0;\">'default'<\/span>); <span style=\"color: #228b22;\">% for reproducibility<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">n = 100; <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">k = 2;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">p = 10000; <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">mset = 10:10:100;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">mSize = numel(mset);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">tLoop = zeros(mSize,1);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">tPage = zeros(mSize,1);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">for <\/span>i = 1:numel(mset) <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> m = mset(i);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> A = rand(m,n,p);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> B = rand(n,k);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> CPage = pagemtimes(A,B);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> f = @()pagemtimes(A,B);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> tPage(i) = timeit(f);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> CLoop = loopmtimes(A,B,m,k,p);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> f = @()loopmtimes(A,B,m,k,p);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> tLoop(i) = timeit(f); <\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper outputs\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 1px solid #e9e9e9; border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">plotTimes(mset,n,p,k,tPage,tLoop);<\/span><\/div>\r\n<div style=\"color: #404040; padding: 10px 0px 6px 17px; background: #ffffff none repeat scroll 0% 0% \/ auto padding-box border-box; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px;\">\r\n<div class=\"inlineElement eoOutputWrapper embeddedOutputsFigure\" style=\"width: 1158px;\" data-testid=\"output_0\">\r\n<div class=\"figureElement\"><img decoding=\"async\" class=\"figureImage figureContainingNode\" style=\"width: 800px;\" src=\"https:\/\/blogs.mathworks.com\/loren\/files\/pagedMatrixFcnsBlog_2.png\" \/><\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">The Times plot shows that the for-loop takes more time than <span style=\"font-family: monospace;\">pagemtimes<\/span>. The Speed-ups plot shows that the benefit of using <span style=\"font-family: monospace;\">pagemtimes<\/span> is largest when there are many small matrices but even for the larger values of <span style=\"font-family: monospace;\">m<\/span>, the speed-up is still substantial. The improvement for smaller matrices is more significant because the overhead that is being eliminated makes up a larger percentage of the overall time.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">I like to use <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/timeit.html\"><span style=\"font-family: monospace;\">timeit<\/span><\/a> instead of <span style=\"font-family: monospace;\">tic<\/span>\/<span style=\"font-family: monospace;\">toc<\/span> for timings (see a <a href=\"https:\/\/blogs.mathworks.com\/loren\/2013\/09\/22\/timing-code\/\">previous post<\/a> on <span style=\"font-family: monospace;\">timeit<\/span>) even though it requires putting the code to be timed into a function. <span style=\"font-family: monospace;\">timeit<\/span> runs the code a number of times and takes the median measurement. It's the approach recommended in <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/measure-performance-of-your-program.html\">Measure the Performance of Your Code<\/a>. Even so, with code that takes a very small amount of time to run, such as when the matrix sizes are small, <span style=\"font-family: monospace;\">timeit<\/span> will have trouble returning accurate timings. The recommendation in that case is to run the code multiple times in a loop.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">If you try different values for the dimensions of A and B, you'll see different speed-ups. For example, when the arrays are large and there are only a few pages, there won't be much since most of the work is in the actual matrix multiplication. You may also see some irregularity due to the difficulty of measuring times for small matrices and the effects of cache and threading for large matrices.<\/div>\r\n<h3 id=\"H_A5E178F6\" style=\"margin: 15px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: #3c3c3c; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;\">More<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\">Paged functions can be written for other matrix functions. Which ones should we do first and in what applications will they be used? Let us know <a href=\"#respond\">here<\/a>.<\/div>\r\n<h2 id=\"H_8731856A\" style=\"margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: #3c3c3c; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;\">Helper Functions<\/h2>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9; border-bottom: 0px none #000000; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">function <\/span>Cloop = loopmtimes(A,B,m,k,p)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">Cloop = zeros(m,k,p);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">for <\/span>i = 1:p<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"> Cloop(:,:,i) = A(:,:,i)*B;<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 1px solid #e9e9e9; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><\/div>\r\n<div style=\"background-color: #f7f7f7; margin: 10px 0 10px 0;\">\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 1px solid #e9e9e9; border-bottom: 0px none #000000; border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">function <\/span>plotTimes(mset,n,p,k,tPage,tLoop)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">figure(<span style=\"color: #a020f0;\">'Position'<\/span>,[100,100,1200,450])<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">t = tiledlayout(1,2);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">nexttile<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">plot(mset,tPage,<span style=\"color: #a020f0;\">'*'<\/span>);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">hold <span style=\"color: #a020f0;\">on<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">plot(mset,tLoop,<span style=\"color: #a020f0;\">'o'<\/span>);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">legend({<span style=\"color: #a020f0;\">'pagemtimes'<\/span>,<span style=\"color: #a020f0;\">'for-loop'<\/span>},<span style=\"color: #a020f0;\">'Location'<\/span>,<span style=\"color: #a020f0;\">'northwest'<\/span>);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">title(<span style=\"color: #a020f0;\">'Times'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">xlabel(<span style=\"color: #a020f0;\">'m'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">ylabel(<span style=\"color: #a020f0;\">'Seconds'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">hold <span style=\"color: #a020f0;\">off<\/span><\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">nexttile<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">plot(mset,tLoop.\/tPage)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">title(<span style=\"color: #a020f0;\">'Speed-ups of pagemtimes over for-loop'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">xlabel(<span style=\"color: #a020f0;\">'m'<\/span>)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">ylim([0,inf])<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">titleStr = sprintf(<span style=\"color: #a020f0;\">'Multiply A (m-by-%d-by-%d) by B (%d-by-%d)'<\/span>,n,p,n,k);<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 0px none #000000; border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\">title(t,titleStr)<\/span><\/div>\r\n<\/div>\r\n<div class=\"inlineWrapper\">\r\n<div style=\"border-left: 1px solid #e9e9e9; border-right: 1px solid #e9e9e9; border-top: 0px none #000000; border-bottom: 1px solid #e9e9e9; border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: #000000; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 14px;\"><span style=\"white-space: pre;\"><span style=\"color: #0000ff;\">end<\/span><\/span><\/div>\r\n<\/div>\r\n<\/div>\r\n<div style=\"margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: #000000; font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: 400; text-align: left;\"><span style=\"font-style: italic;\">Copyright 2021 The MathWorks, Inc.<\/span><\/div>\r\n<\/div>\r\n<script type=\"text\/javascript\">var css = ''; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); style.type = 'text\/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); }<\/script><a href=\"https:\/\/blogs.mathworks.com\/loren\/files\/pagedMatrixFcnsBlog.mlx\"><button class=\"btn btn-sm btn_color_blue pull-right add_margin_10\">Download Live Script<\/button><\/a>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/loren\/files\/pagedMatrixFcnsBlog_2.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nToday's guest blogger is Mary Fenelon, who is the product marketing manager for Optimization and Math here at MathWorks. In today's post she describes how using the new paged matrix functions can... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2021\/01\/14\/paged-matrix-functions\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[91,6,58,8],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3937"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=3937"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3937\/revisions"}],"predecessor-version":[{"id":4030,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/3937\/revisions\/4030"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=3937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=3937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=3937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}