Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:06:49+00:00 2026-06-17T23:06:49+00:00

suppose I have a matrix like this: a = 1 2 3 4 I

  • 0

suppose I have a matrix like this:

a = 
    1    2
    3    4

I want to double the size of matrix and create something like this:

aa = 
     1    1    2    2
     1    1    2    2
     3    3    4    4
     3    3    4    4

in this way, each element in the first matrix propagates to four elements in the bigger matrix.

a(i,j) == aa(2*i-1, 2*j-1)
       == aa(2*i  , 2*j-1)
       == aa(2*i-1, 2*j)
       == aa(2*i  , 2*j)

is there any predefined functions to do that?

definitely I can do that by two loops, but I want the easiest and cleanest way!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:06:50+00:00Added an answer on June 17, 2026 at 11:06 pm

    use kron – Kronecker tensor product:

    kron(a,ones(2))
    
    
    ans =
     1     1     2     2
     1     1     2     2
     3     3     4     4
     3     3     4     4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that I have a 2D array (matrix) in Java like this... int[][] MyMat
Suppose i have a matrix like this table = [ # grid: 4 by
I want to build a square matrix. Let's suppose We have this matrix called
Supose I have a matrix. This matrix is blank except some points that create
HI, suppose i have given input numbers like this 1,2,3,4,5,6,7,8,9,0 i should form it
Suppose I have an n*n matrix of distances between n users. I'd like to
This bothers me a bit: Suppose you have a matrix with three layers. Is
Suppose I have this matrix 8 3 1 1 2 2 1 1 1
Suppose I have a simple multidimensional structure, like this one: somestr<-array(sample.int(2, 120, replace=TRUE), dim=c(4,5,6))
Suppose I have a large matrix: M <- matrix(rnorm(1e7),nrow=20) Further suppose that each column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.