How to Apply the norm() Function in R (Example Code)

In this article, I’ll illustrate how to compute the norm of a matrix using the norm() function in R.

Creation of Example Data

x <- matrix(1:12, ncol = 3)        # Example matrix
x
#      [,1] [,2] [,3]
# [1,]    1    5    9
# [2,]    2    6   10
# [3,]    3    7   11
# [4,]    4    8   12

Example: Calculate Norm of Matrix

norm(x)                            # Compute one norm of matrix
# [1] 42

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top