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 9196539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:52:20+00:00 2026-06-17T21:52:20+00:00

I have the following minimal example: program main double precision, dimension(3) :: rankone double

  • 0

I have the following minimal example:

      program main

      double precision, dimension(3)   :: rankone
      double precision, dimension(3,1) :: ranktwo

      double precision, dimension(3)   :: output

      rankone = 1
      ranktwo = 2

      output = rankone + ranktwo

      print *, 'output: ', output

      end program main

Is there a function like squeeze in Matlab that removes the singleton dimension from the variable ranktwo. I’m looking for something like

      output = rankone + squeeze(ranktwo)

If not, is there any workaround for this setting?

Are there any differences between the various versions of Fortran regarding this problem?

  • 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-17T21:52:21+00:00Added an answer on June 17, 2026 at 9:52 pm

    Try this

    output = rankone + reshape(ranktwo,[3])
    

    then look at the documentation for reshape to see what is going on. You could also write

    output = rankone + ranktwo(:,1)
    

    which slices a 1D array out of ranktwo. In my experience reshape usually causes an array copy so there may be a memory-use-efficiency argument for preferring the second version.

    No, there are no differences between Fortran versions regarding this problem, a 3×1 array is not the same shape as a 1D array of length 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following minimal example that bails out after the first command line
I have the following minimal example code in R: data.time = c(1, 4, 8,
I have following fiddle: http://jsfiddle.net/BFSH4/ As you see there are two issues: The h1
The following code is a minimal example from a larger query generated by a
In the following minimal example, I create 1-point scatter plot and later change color
Take the following minimal example: import abc class FooClass(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def
I have following JS code (stripped to minimal size where problem still exists) <html>
I've put together the following minimal example where the Xcode (4.5.2) static analyzer apparently
I have the following minmal example of a thread pool made with boost::asio. #include
I have the following minimal JavaScript fragment: var xml = '<El a:title=T a:href=H xmlns:a=http://www.w3.org/1999/xlink

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.