Sponsored Content
Full Discussion: column to matrix
Top Forums Shell Programming and Scripting column to matrix Post 302702429 by Fredrick on Tuesday 18th of September 2012 10:06:37 AM
Old 09-18-2012
Hi Rudi,

Thanks for your reply. I just tried with only two columns (for testing). here is the input:

Code:
 
    1  2
     2  3
     3  3
     4  3
     5  3
     6  3
     7  2
     8  3
     9  3
    10  3
    11  2
    12  2
    13  3
    14  2
    15  2
    16  2
    17  2
    18  2
    19  2
    20  2
    21  2
    22  2
    23  7
    24  2
    25  3
    26  3
    27  2
    28  2
    29  2
    30  2
    31  2
    32  2
    33  3
    34  2

and I got the following output

Code:
        4       5       6       7       8       9       0       1       2       3
780     0       0       0       0       0       1       0       0       0       0
781     0       0       0       0       0       0       0       1       0       0
740     0       0       0       0       0       0       0       1       0       0
782     0       0       0       0       0       0       0       1       0       0
741     0       0       0       0       0       0       0       0       0       1
700     0       0       0       0       0       0       0       1       0       0
80      0       0       0       0       0       0       0       0       1       0
783     0       0       0       0       0       1       0       0       0       0
742     0       0       0       0       0       0       0       0       0       1
701     0       0       0       0       0       1       0       0       0       0
81      0       0       0       0       0       0       0       0       1       0
40      0       0       0       0       0       0       0       0       0       1
784     0       0       0       0       0       0       0       1       0       0
743     0       0       0       0       0       0       0       1       0       0
702     0       0       0       0       0       0       0       0       0       1
82      0       0       0       0       0       0       0       0       1       0
41      0       0       0       0       0       0       0       0       0       1
785     0       0       0       0       0       1       0       0       0       0

In the output, row numbers are not in an order, as well as column numbers.

Warm regards
Fredrick.

Warm regards
Fredrick.

Last edited by Franklin52; 09-18-2012 at 11:18 AM.. Reason: fixed code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

processing matrix column wise

I have a m X n matrix written out to file, say like this: 1,2,3,4,5,6 2,6,3,10,34,67 1,45,6,7,8,8 I want to calculate the column averages in the MINIMUM amount of code or processing possible. I would have liked to use my favorite tool, "AWK" but since it processes rowwise, getting the... (5 Replies)
Discussion started by: Abhishek Ghose
5 Replies

2. Shell Programming and Scripting

diagonal matrix to square matrix

Hello, all! I am struggling with a short script to read a diagonal matrix for later retrieval. 1.000 0.234 0.435 0.123 0.012 0.102 0.325 0.412 0.087 0.098 1.000 0.111 0.412 0.115 0.058 0.091 0.190 0.045 0.058 1.000 0.205 0.542 0.335 0.054 0.117 0.203 0.125 1.000 0.587 0.159 0.357... (11 Replies)
Discussion started by: yifangt
11 Replies

3. Shell Programming and Scripting

two-column data to matrix in AWK

Howdy, I need to convert an association data matrix, currently in a two-column format, into a matrix with numbers indicating the number of associations. I've been looking around for AWK code in the list, but could not find anything. Here's an example of what I want to perform: original... (10 Replies)
Discussion started by: sramirez
10 Replies

4. Shell Programming and Scripting

Extracting columns from a matrix and storing each column in a separate file

Hi All, I have a huge matrix file consisting some some millions rows and 6000 columns. The contents are just floating point numbers in the matrix. I want to extract each column (i.e. 6000 of them) and store each column in a separate file. For example, 1.dat will consist of elements from column... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

5. Ubuntu

How to convert full data matrix to linearised left data matrix?

Hi all, Is there a way to convert full data matrix to linearised left data matrix? e.g full data matrix Bh1 Bh2 Bh3 Bh4 Bh5 Bh6 Bh7 Bh1 0 0.241058 0.236129 0.244397 0.237479 0.240767 0.245245 Bh2 0.241058 0 0.240594 0.241931 0.241975 ... (8 Replies)
Discussion started by: evoll
8 Replies

6. Shell Programming and Scripting

3 column .csv --> correlation matrix; awk, perl?

Greetings, salutations. I have a 3 column csv file with ~13 million rows and I would like to generate a correlation matrix. Interestingly, you all previously provided a solution to the inverse of this problem. Thread title: "awk? adjacency matrix to adjacency list / correlation matrix to list"... (6 Replies)
Discussion started by: R3353
6 Replies

7. Shell Programming and Scripting

Adding or substracting from a Matrix column

Hello! I'm new to linux programming. It would be great if you could help me out. I have a matrix of kind: 10 30.0 20 190.5 40 180. 50 320.5 I would like to substract 180 from column 2 If the value is >180 to add 180 for column 2 If the value is <180 nothing if it is equal to... (3 Replies)
Discussion started by: lovelinux
3 Replies

8. Shell Programming and Scripting

Perl- creating a matrix from a 3 column file

Dear all, I'm new in perl scripting and I'm trying to creating a matrix from a 3 column file sorting data in a particular manner. In the final matrix I need to have the first column "IDs" on the header of the columns and the second column values on the header of each row. And the value fo the... (2 Replies)
Discussion started by: gabrysfe
2 Replies

9. Shell Programming and Scripting

Convert a 3 column tab delimited file to a matrix

Hi all, I have a 3 columns input file like this: CPLX9PC-4943 CPLX9PC-4943 1 CPLX9PC-4943 CpxID123 0 CPLX9PC-4943 CpxID126 0 CPLX9PC-4943 CPLX9PC-5763 0.5 CPLX9PC-4943 CpxID13 0 CPLX9PC-4943 CPLX9PC-6163 0 CPLX9PC-4943 CPLX9PC-6164 0.04... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

10. Shell Programming and Scripting

Transpose matrix based on second column using awk

Hi, Is it possible to transpose the matrix like this using awk ? Many thanks in advance Input abc Name_1 0 abc Name_2 1 abc Name_3 2 abc Name_4 0.4 def Name_1 0 def Name_2 9 def Name_3 78 def Name_4 1 Output abc def Name_1 0 ... (4 Replies)
Discussion started by: quincyjones
4 Replies
DLAQPS(l)								 )								 DLAQPS(l)

NAME
DLAQPS - compute a step of QR factorization with column pivoting of a real M-by-N matrix A by using Blas-3 SYNOPSIS
SUBROUTINE DLAQPS( M, N, OFFSET, NB, KB, A, LDA, JPVT, TAU, VN1, VN2, AUXV, F, LDF ) INTEGER KB, LDA, LDF, M, N, NB, OFFSET INTEGER JPVT( * ) DOUBLE PRECISION A( LDA, * ), AUXV( * ), F( LDF, * ), TAU( * ), VN1( * ), VN2( * ) PURPOSE
DLAQPS computes a step of QR factorization with column pivoting of a real M-by-N matrix A by using Blas-3. It tries to factorize NB columns from A starting from the row OFFSET+1, and updates all of the matrix with Blas-3 xGEMM. In some cases, due to catastrophic cancellations, it cannot factorize NB columns. Hence, the actual number of factorized columns is returned in KB. Block A(1:OFFSET,1:N) is accordingly pivoted, but not factorized. ARGUMENTS
M (input) INTEGER The number of rows of the matrix A. M >= 0. N (input) INTEGER The number of columns of the matrix A. N >= 0 OFFSET (input) INTEGER The number of rows of A that have been factorized in previous steps. NB (input) INTEGER The number of columns to factorize. KB (output) INTEGER The number of columns actually factorized. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the M-by-N matrix A. On exit, block A(OFFSET+1:M,1:KB) is the triangular factor obtained and block A(1:OFFSET,1:N) has been accordingly pivoted, but no factorized. The rest of the matrix, block A(OFF- SET+1:M,KB+1:N) has been updated. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(1,M). JPVT (input/output) INTEGER array, dimension (N) JPVT(I) = K <==> Column K of the full matrix A has been permuted into position I in AP. TAU (output) DOUBLE PRECISION array, dimension (KB) The scalar factors of the elementary reflectors. VN1 (input/output) DOUBLE PRECISION array, dimension (N) The vector with the partial column norms. VN2 (input/output) DOUBLE PRECISION array, dimension (N) The vector with the exact column norms. AUXV (input/output) DOUBLE PRECISION array, dimension (NB) Auxiliar vector. F (input/output) DOUBLE PRECISION array, dimension (LDF,NB) Matrix F' = L*Y'*A. LDF (input) INTEGER The leading dimension of the array F. LDF >= max(1,N). FURTHER DETAILS
Based on contributions by G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain X. Sun, Computer Science Dept., Duke University, USA LAPACK version 3.0 15 June 2000 DLAQPS(l)
All times are GMT -4. The time now is 10:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy