
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

281 Views
To return the Norm of the matrix or vector in Linear Algebra, use the LA.norm() method in Python Numpy. The 1st parameter, x is an input array. If axis is None, x must be 1-D or 2-D, unless ord is None. If both axis and ord are None, the 2-norm of x.ravel will be returned. The 2nd parameter, ord is the order of the norm. The inf means numpy’s inf object. The default is None.The 3rd parameter axis, if an integer, specifies the axis of x along which to compute the vector norms. If axis is a 2-tuple, it specifies ... Read More

1K+ Views
To compute the eigenvalues of a complex Hermitian or real symmetric matrix, use the numpy.eigvalsh() method. The method returns the eigenvalues in ascending order, each repeated according to its multiplicity.The 1st parameter, a is a complex- or real-valued matrix whose eigenvalues are to be computed. The 2nd parameter, UPLO specifies whether the calculation is done with the lower triangular part of a (‘L’, default) or the upper triangular part (‘U’). Irrespective of this value only the real parts of the diagonal will be considered in the computation to preserve the notion of a Hermitian matrix. It therefore follows that the ... Read More

506 Views
To return the Cholesky decomposition, use the numpy.linalg.cholesky() method. Return the Cholesky decomposition, L * L.H, of the square matrix a, where L is lower-triangular and .H is the conjugate transpose operator. The a must be Hermitian and positive-definite. No checking is performed to verify whether a is Hermitian or not. In addition, only the lower-triangular and diagonal elements of a are used. Only L is actually returned.Then parameter a, is the Hermitian (symmetric if all elements are real), positive-definite input matrix. The method returns the Upper or lower-triangular Cholesky factor of a. Returns a matrix object if a is ... Read More

278 Views
To get the Kronecker product of a 4D and a 3D dimension array, use the numpy.kron() method in Python Numpy. Compute the Kronecker product, a composite array made of blocks of the second array scaled by the firstThe function assumes that the number of dimensions of a and b are the same, if necessary prepending the smallest with ones. If a.shape = (r0, r1, .., rN) and b.shape = (s0, s1, ..., sN), the Kronecker product has shape (r0*s0, r1*s1, ..., rN*SN). The elements are products of elements from a and b, organized explicitly by −kron(a, b)[k0, k1, ..., kN] ... Read More

196 Views
To determine if the type in the first argument is a subclass of second, use the numpy.issubsctype() method in Python numpy. The 1st and the 2nd argument are datatypes.StepsAt first, import the required library −import numpy as npUsing the issubsctype() method in Numpy. Checking whether the first argument is a subclass of the second argument −print("Result...", np.issubsctype(np.float16, np.float32)) print("Result...", np.issubsctype(np.int32, np.signedinteger)) print("Result...", np.issubsctype('i4', np.signedinteger)) print("Result...", np.issubsctype('S8', str)) print("Result...", np.issubsctype(np.array([45, 89]), int)) print("Result...", np.issubsctype(np.array([5., 25., 40.]), float))Exampleimport numpy as np # To determine if the type in the first argument is a subclass of second, use the numpy.issubsctype() method in ... Read More

99 Views
To check whether float data types of different sizes are not subdtypes of each other, use the numpy.issubdtype() method in Python Numpy. The parameters are the dtype or object coercible to one.StepsAt first, import the required library −import numpy as npUsing the issubdtype() method in Numpy. Checking for float datatype with different sizes −print("Result...", np.issubdtype(np.float16, np.float32)) print("Result...", np.issubdtype(np.float32, np.float16)) print("Result...", np.issubdtype(np.float64, np.float32)) print("Result...", np.issubdtype(np.float32, np.float64)) print("Result...", np.issubdtype(np.float16, np.float64)) print("Result...", np.issubdtype(np.float64, np.float16))Exampleimport numpy as np # To check whether float data types of different sizes are not subdtypes of each other, use the numpy.issubdtype() method in Python Numpy. # The ... Read More

129 Views
# To check whether int data types of different sizes are not subdtypes of each other, use the numpy.issubdtype() method in Python Numpy.# The parameters are the dtype or object coercible to oneStepsAt first, import the required library −import numpy as npUsing the issubdtype() method in Numpy. Checking for int datatype with different sizes −print("Result...", np.issubdtype(np.int16, np.int32)) print("Result...", np.issubdtype(np.int32, np.int16)) print("Result...", np.issubdtype(np.int64, np.int32)) print("Result...", np.issubdtype(np.int32, np.int64)) print("Result...", np.issubdtype(np.int16, np.int64)) print("Result...", np.issubdtype(np.int64, np.int16))Exampleimport numpy as np # To check whether int data types of different sizes are not subdtypes of each other, use the numpy.issubdtype() method in Python Numpy. # ... Read More

110 Views
To check whether similar data types of different sizes are not subdtypes of each other, use the numpy.issubdtype() method in Python Numpy. The parameters are the dtype or object coercible to one.StepsAt first, import the required library −import numpy as npUsing the issubdtype() method in Nump to check for similar datatypes with different sizes. Checking for float datatype with different sizes −print("Result...", np.issubdtype(np.float32, np.float64)) print("Result...", np.issubdtype(np.float64, np.float32))Checking for int datatype with different sizes −print("Result...", np.issubdtype(np.int16, np.int32)) print("Result...", np.issubdtype(np.int32, np.int16)) print("Result...", np.issubdtype(np.int64, np.int32)) print("Result...", np.issubdtype(np.int32, np.int64))Exampleimport numpy as np # To check whether similar data types of different sizes are ... Read More

169 Views
The gradient is computed using second order accurate central differences in the interior points and either first or second order accurate one-sides (forward or backwards) differences at the boundaries. The returned gradient hence has the same shape as the input array. The 1st parameter, f is an Ndimensional array containing samples of a scalar function. The 2nd parameter is the varargs i.e. the spacing between f values. Default unitary spacing for all dimensions.The 3rd parameter is the edge_order{1, 2} i.e. the Gradient is calculated using N-th order accurate differences at the boundaries. Default − 1. The 4th parameter is the ... Read More

970 Views
To determine whether the given object represents a scalar data-type, use the numpy.issctype() method. The method returns Boolean result of check whether rep is a scalar dtype. The first parameter is the rep. If rep is an instance of a scalar dtype, True is returned.If not, False is returned.StepsAt first, import the required library −import numpy as npUsing the issctype() method in Numpy −print("Result...", np.issctype(np.int32)) print("Result...", np.issctype(np.int64)) print("Result...", np.issctype(np.dtype('str'))) print("Result...", np.issctype(100)) print("Result...", np.issctype(25.9)) print("Result...", np.issctype(np.float32(22.3)))Exampleimport numpy as np # To determine whether the given object represents a scalar datatype, use the numpy.issctype() method # The method returns Boolean result ... Read More