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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:52:07+00:00 2026-05-27T06:52:07+00:00

I am aware that numpy arrays are pointer arrays. And I know that is

  • 0

I am aware that numpy arrays are pointer arrays. And I know that is possible to define pointers in python. But I am wondering, if I make a variable equal to an element in a numpy vector, is it still a pointer or is it de-referenced? Is there a way I can find out or test this?

Example

    import scipy
    vec = scipy.randn(10)
    vecptr = vec # vecptr is a pointer to vec
    vecval = scipy.copy(vec) # vecval is not a pointer.

    var = vec[3] # is var pointer or is it copied by value ???

    print(type(var)) # returns numpy.float64.  does this mean its a 1x1 numpy vec and therefore  a pointer ?

The reason I ask is, what I really want to know is; will the code below this double up my memory? I am trying to create more meaningful variable names to my vector that is returned

    v = self.viewCoefs[sz][sv][sa]

    gw = v[0]
    G0 = v[1]
    G1 = v[2]
    G2 = v[3]
    alpha0 = v[4]
    alpha1 = v[5]
    alpha2 = v[6]
    beta0 = v[7]
    beta1 = v[8]
    beta2 = v[9]
    beta3 = v[10]
    gamma0 = v[11]
    gamma1 = v[12]
    gamma2 = v[12]
    gamma3 = v[12]
    gamma4 = v[13]
    delta0 = v[14]
    delta1 = v[15]
    delta2 = v[16]
    delta3 = v[17]
    delta4 = v[18]
    delta5 = v[19]
    zeta_prime_0 = v[20]
    zeta_prime_1 = v[21]
    zeta_prime_2 = v[22]
    Gamma_prime_0 = v[23]
    Gamma_prime_1 = v[24]
    Gamma_prime_2 = v[25]
    Gamma_prime_3 = v[26]

Because I have lots of these to follow

    p0 = alpha0 + alpha1*scipy.log(bfrac) + alpha2*scipy.log(bfrac)**2
    p1 = beta0 + beta1*scipy.log(bfrac) + beta2*scipy.log(bfrac)**2 + beta3*scipy.log(bfrac)**3
    p2 = gamma0 + gamma1*scipy.log(bfrac) + gamma2*scipy.log(bfrac)**2 + gamma3*scipy.log(bfrac)**3 + gamma4*scipy.log(bfrac)**4
    p3 = delta0 + delta1*scipy.log(bfrac) + delta2*scipy.log(bfrac)**2 + delta3*scipy.log(bfrac)**3 + delta4*scipy.log(bfrac)**4 + delta5*scipy.log(bfrac)**5

    subSurfRrs = g*(p0*u + p1*u**2 + p2*u**3 + p3*u**4)
    ## and lots more

So I would like meaningful variable names without doubling my memory foot print.

#

Okay, If I got it right, the solution to NOT double up my memory is :

    v = self.veiwCoefs[sz][sv][sa]

    gw = v[0:1]
    G0 = v[1:2]
    G1 = v[2:1]
    alpha0 = v[3:4]
    alpha1 = v[4:5]
    alpha2 = v[5:6]
    beta0 = v[6:7]
    beta1 = v[7:8]
    beta2 = v[8:9]
    beta3 = v[9:10]
    ## etc 

    p0 = alpha0[0] + alpha1*scipy.log(bfrac) + alpha2[0]*scipy.log(bfrac)**2
    p1 = beta0[0] + beta1[0]*scipy.log(bfrac) + beta2[0]*scipy.log(bfrac)**2 + beta3[0]*scipy.log(bfrac)**3

    ## etc
  • 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-05-27T06:52:08+00:00Added an answer on May 27, 2026 at 6:52 am

    You almost have it, but here is how to create a view of a single element:

    In [1]: import numpy as np
    
    In [23]: v = np.arange(10)
    
    In [24]: a = v[3:4]
    
    In [25]: a[0] = 100
    
    In [26]: v
    Out[26]: array([  0,   1,   2, 100,   4,   5,   6,   7,   8,   9])
    

    Here a is a view of the fourth element of v, so when you change a you change the corresponding position in v.

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

Sidebar

Related Questions

I aware that this will be a less programming question, but still... How can
I am aware that you can lock an object in c# using lock but
I'm aware that Python 3 fixes a lot of UTF issues, I am not
I am aware that force killing an app is very bad, but the client
I'm aware that you can create a unique column in your MySQL table, but
I'm pretty aware that Visual Studio 2010 works with C# 4.0. But now I
I am aware that System.Threading.Timer exists, but I already have a Thread. This thread
I'm aware that you can get session variables using request.session['variable_name'] , but there doesn't
I am aware that this is a more subjective question than is preferred, but
I'm aware that I could use something called std::vector , but I'm afraid it's

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.