vec-methods: Tensor Vec

Description Usage Arguments Details Value References Examples

Description

Turns the tensor into a single vector, following the convention that earlier indices vary slower than later indices.

Usage

1
2
3
4
vec(tnsr)

## S4 method for signature 'Tensor'
vec(tnsr)

Arguments

tnsr

the Tensor instance

Details

vec(tnsr)

Value

vector with length prod(x@modes)

References

T. Kolda, B. Bader, "Tensor decomposition and applications". SIAM Applied Mathematics and Applications 2009.

Examples

1
2
tnsr <- rand_tensor(c(4,5,6,7))
vec(tnsr)

Example output

  [1]  0.1468885601  0.8660261305 -1.4263919827 -0.0904116823 -0.1572761726
  [6] -0.2509106769  0.6802973868  0.1332499910  0.2347662167 -1.7660991857
 [11]  1.9607142420  0.6809311559 -2.3707738115  0.0177683547  1.0612069487
 [16] -0.0331545304 -0.6420215884  0.5791038986  0.0362232086 -0.5260945436
 [21] -1.1473532632 -0.1778455090  0.5238301185 -0.1167646741 -2.1117291197
 [26] -0.0068054622 -1.4840675321  0.1033890665 -0.5382103540  1.0369594334
 [31] -0.1277080920 -0.7952633568  0.4547398599  0.3721523877  0.4820186366
 [36] -0.9285395393 -0.7841898051 -1.1149676589 -1.0039053868 -1.6802553617
 [41]  1.6177753365  2.0349621049 -0.5452602302  0.0753582200 -0.1555923088
 [46] -0.3184345092  0.6480620914 -0.0779874590  0.0582282840  0.9742434232
 [51] -0.7370290930 -1.3248555191  1.2329874324  2.9067976481 -1.6648262778
 [56]  2.6164244328 -0.7453590737  0.0008065086  0.4866533416  1.3570392318
 [61]  0.4292099155 -0.7932329893  1.3692592518  0.6230405242 -0.0841039684
 [66] -1.1920491312  0.1449877821  1.2095097922  1.1046956424  1.0269935809
 [71]  0.0221701459 -0.9123910278 -0.7724005692 -0.5855803496 -1.2241088009
 [76]  0.1830112203  1.0450627647 -0.0220984014 -0.6721592308  0.6564124480
 [81]  0.2882613499 -0.9333087037 -0.2770442750 -0.1273258785  1.5357106948
 [86] -2.5788504428 -0.7529638670 -0.8990557675  1.7977862427 -0.1041705585
 [91]  0.0817824237 -0.7911883638 -0.4907469805 -0.0684095405 -1.1912099632
 [96]  0.3737174313  0.0003861037  2.8524072962 -1.0052646124  0.3765818816
[101] -0.1442993692  0.8086288977  1.0105258025  0.1536861305 -0.2274323480
[106] -0.6886779118  1.1887276760 -0.8436041480  0.3491601840 -0.8851237545
[111] -0.6879589687 -1.5954583615 -0.2980305243  0.3240291915 -0.2902044793
[116] -0.2689305381  0.6614324068 -0.1917926257 -0.0347566728 -0.4938411061
[121] -1.7133417410  0.0176067287  0.2043009992 -1.2218771550 -0.5972283771
[126]  0.3661053944  0.1471147939  0.1586799454 -0.9838714980 -0.3152544741
[131]  0.0091939630 -0.4848536713  1.2440933468 -0.4712698692  0.1345825237
[136] -0.4270897215 -0.0860596691  1.6902651899 -1.2160981242  1.0667245937
[141] -0.1690877833 -2.4565409295 -1.2498673241  0.0636653114  0.2448779217
[146] -1.1991977824  0.0917188682 -0.8294967732  1.1015474225 -0.0928174858
[151]  1.5580082789 -0.1443589232  2.0765568824  0.4237669727 -2.2092473237
[156] -1.5243404337 -0.2149896853 -0.1803042972 -1.0621387201 -0.0831092283
[161]  0.3817950047  0.3854685655 -2.5916531869 -0.8537964647 -0.3551342172
[166]  0.0948610940 -1.4061668854  0.0573578824  0.4985983252 -0.8978401815
[171]  1.2846365326 -1.1814074936 -2.3976551110 -0.1531769062 -1.5476953758
[176] -1.1467300739 -1.3074702743  0.2290285079 -0.4987277368  1.4425120198
[181]  0.1972791745  0.4282246909 -0.4032463124 -1.3098724525 -0.3479287990
[186]  0.4395707555  0.4983983479  0.7116476414  0.1635416845  0.1740512165
[191]  0.1576074784  0.2774246199  1.3691977479  0.2066921343 -1.3606552538
[196]  1.5328217423  1.6637446592 -0.6315130384 -1.3472931188 -0.3461565735
[201] -0.0919512735 -1.1393237570  0.3426232217 -0.8284530747 -0.9938305473
[206]  2.2429554173 -1.2202894764 -0.2721438897 -0.2956509676 -0.6969173566
[211]  0.8761448573  0.5866332038 -0.0028672063 -1.3096250083  0.3422804634
[216]  0.2453624128  0.5074102299  0.1407927032 -0.7113592878 -0.6517367235
[221]  0.7622178995 -0.3220469223 -0.4915457968  0.5885100991  0.3661088349
[226] -0.3793205566  2.0563395905 -2.0121655730 -0.8125192600  1.1689597284
[231] -0.3989504276  0.4548951567 -0.2502435143 -0.3297984988  1.1574586377
[236]  0.2498541879 -0.9137293591  1.2217402680 -0.2878960200 -0.3762098341
[241] -1.2557226527 -1.7358703456 -0.2402810362  0.6112743081 -1.3667920049
[246] -0.2609852184 -0.2478691520  1.4656593063 -0.8311309044  0.5097931799
[251] -1.1143206320 -0.1950315239  2.1443416878  0.3586494760 -1.5064350514
[256]  0.6906079449 -0.8190193865  0.5080476915  0.4760459575 -0.0067709801
[261]  0.8130342298 -0.4011074364  0.6782456693 -0.9115944417 -1.8323510132
[266] -0.1029790248  0.0495615883  0.0860721790  0.4600067739 -0.5643745709
[271] -0.6315270707  0.7222298167 -0.0453020712  0.4271062920  1.2270455883
[276] -0.1327840421  0.2590606870  0.1480715445 -1.3971110814  2.0263781557
[281] -0.9033232683  2.5834972709 -0.1132163778 -0.1464038099 -0.3573989505
[286]  0.2783639534  0.5661209907  1.3539533701 -1.2132821167  0.6648583842
[291] -0.9432012558 -1.3365923924 -0.8490994292  0.5424284274  2.5223311534
[296]  1.0314170284 -1.8009178032 -1.7654877149 -0.4193016477  1.6620119214
[301] -1.2186326467 -0.5181245512 -0.3374654794 -1.3980378233  0.1405674342
[306] -0.1446222724  0.3965456388  0.0465656870  0.1619145474  0.4956767785
[311]  1.9376492890  0.4040415259  1.2799709210 -0.6393048377 -1.1036871796
[316] -0.2530950907 -0.0201452544 -2.5472942995  0.4942312780  1.1201497745
[321] -0.1668236914  0.3087094291 -0.2724508970 -0.6542339173  1.1564876156
[326]  1.0115636349  0.9532101184  0.0807803373  1.4537554964  1.1512556893
[331]  0.4384075036  0.7622684234  2.2141480648  0.9987342046 -0.5226289325
[336]  0.1548279595 -0.7669671312 -1.8510224834  0.5870357447 -0.8788760143
[341]  1.0412707119 -0.0008099660  0.6452020636  1.8148386346 -1.2489439348
[346] -0.3254274836 -1.0852542878  1.2662724494 -0.0344467892  0.6652032660
[351]  1.2548971370  0.7781917710 -0.0820234018  0.6763485095 -1.1232463052
[356] -0.6476135861 -0.9137847333 -1.4173306719  1.7147351226 -0.1580669489
[361]  0.2648762155  0.2897269357  2.1458506966 -0.7370517948  1.2877822078
[366] -0.1535328202 -0.1485900761  0.6788214236  0.0895801353 -1.5500429587
[371]  0.1298897988  0.4540993939  1.0142486136  1.8404844236 -0.0248498505
[376]  0.8895371108 -0.8839521682  0.5552150481  0.2352360826 -1.9982614015
[381] -0.8430517260  0.2295360889 -0.0505917871 -0.4137535048 -1.4194884388
[386]  1.7456664222 -1.2317288303 -1.1978193362 -0.4567343130 -1.7207867699
[391] -0.8225712809 -0.8769211940  0.2417352253  1.5731095275  0.3698865889
[396] -1.2720777884  0.9064616616 -0.6251241905  0.5831286157 -0.4914340754
[401] -0.0490543174  0.8876677073 -0.5217098891  0.4587423231 -0.4503134394
[406]  0.2815217114  0.3000474993 -0.9284396849 -0.9593492648 -1.8818336433
[411] -0.8672193105  0.1404283488 -0.3616330629  0.5380703745  1.6371938438
[416]  2.5573232145 -1.1766515327  0.3059324642  0.0922333576 -0.4611303421
[421]  1.6800109043  1.8566471309  0.4670887284 -2.2175842818 -0.5162535709
[426]  0.3916917272 -2.5727014813  0.1638935726 -2.5061181980  0.8953078868
[431]  1.2302496576 -0.1863774885  0.2263795312  1.7587870190 -0.0548065657
[436] -0.2521223179  0.0230735734 -1.0772916808 -1.1935896318  0.4728775257
[441]  0.8382986592 -1.4978591257  1.6640229199  0.1958685870  0.9044227735
[446] -0.6633844294 -1.3308283791 -0.1093894068 -0.9474047670 -0.0443442586
[451]  0.8019830877  0.8855395665 -0.2277292295 -0.3469268022 -1.6367271142
[456]  0.0777836989 -1.1163319894  0.5611540700  2.9760622789  0.8377814836
[461]  0.0402707871 -0.1890377747  0.4146887273 -1.1732712964 -0.8186684109
[466]  0.0408763880  0.5861070601  1.6959496293 -0.9145790623 -1.7891839971
[471] -1.3744274625  0.8843206182  2.0833837784  0.2433013619  0.5062215993
[476]  1.1597483304  0.8015865865  1.4583004983 -0.4800777402  1.7711411696
[481]  0.3530315103 -0.6070299983  0.8356515994  0.1763474859  0.8048696533
[486]  0.0628356775  1.2910237796 -0.4535915635 -1.5937072991 -0.5296203895
[491]  0.1170102558 -0.9057111975  0.9158789307  1.4682705151  0.2001740143
[496]  0.6139520027  0.0351307407  0.6240684949 -1.0888926800  0.4030839096
[501]  0.4926349705 -0.6292112926 -1.1423636014  1.9415841992 -0.1068168557
[506] -0.5702439354  0.8492207189 -0.5200402758  0.3804896977  0.0510770185
[511]  0.2269612581  1.1828923302  0.5504057126  1.6855093324 -1.1495741475
[516] -1.2923856121 -0.1947022254  0.0866999375 -0.5997853050 -0.0802544931
[521]  2.6316035521 -0.1275352141 -0.1228357017 -0.6357093628 -0.4067164120
[526] -1.0171070705 -0.3279952905  0.2968500279  1.1174321109 -0.4379430870
[531] -1.0882722938  1.2440738629  0.7305394955 -0.5696146129  1.8418271607
[536]  0.7218863334  0.6647136624 -0.7145646747  0.4349523819 -0.5828406734
[541] -1.6183657705 -0.6350653060 -1.7777831642 -1.7062152090  1.7148969361
[546] -1.3621063279 -0.0539147756 -0.5378792322 -0.6195877077 -1.8209519374
[551]  0.4374696949  1.4424179973  0.7229629461  0.0555112631 -1.3560916796
[556]  0.2867866227  0.5068671604  0.5350170064  0.6262508672 -0.4518130257
[561]  0.4400248762 -0.0326126975 -0.1825930472  0.2419178278  1.0138211205
[566]  1.4292710698 -0.3772488810 -0.7490058686  0.1935978218  0.2131250891
[571]  0.8897114166 -0.5099168719  1.1807049637 -1.0510793779 -0.6493159788
[576] -1.0925345439 -0.7023798085  1.5571934270 -2.1020320949 -0.4072435070
[581] -0.9850600501  0.2117458644 -0.3769666072 -1.5485693940 -0.5843901310
[586] -0.3359013693 -1.1995771748 -1.5486343204  1.1131589890 -0.9190148393
[591]  0.9196222590  0.0221665158 -0.7106853574  0.6580611435  1.3290676539
[596] -0.7230378096  1.1230558864  1.5172868736  2.0829777908  0.9394271528
[601]  0.7393884292  0.2201827191  1.4687709499  0.7707232102  0.6458471386
[606]  0.0743163359 -1.1686171971  0.0214470079 -0.6342550750 -1.1492250589
[611]  0.1990438816  1.6461743449  1.9234040351  0.7156174926  0.3607419348
[616] -0.2137654697  0.5568257983  0.0756886976  0.6926419456 -0.1094987791
[621]  0.3606751384  0.2902307086 -2.4721858687 -0.3886608537  0.1882421586
[626]  1.0612901504 -1.2275403807  0.5235325064 -1.2159424979 -0.0649134244
[631] -0.5398078455  0.8214685400  0.8035098573 -0.2681521624  0.5170424793
[636] -0.1643334210  1.7564866083  1.7238229044  0.0186181844 -1.4588176545
[641] -0.6954598461 -0.2883075805 -0.2870492030  0.3410920820  1.8678889360
[646]  0.0233052322  0.3012564129  0.2355840473 -1.2186312583  0.0801059543
[651] -1.5887813545 -0.8088343971 -0.0212082281 -1.8544130154 -0.5122479803
[656]  0.7628147354  0.2055818653  0.0875915053  1.4958997897 -0.8019209568
[661] -0.5743290236  0.9568050148 -1.4443969146  0.3213832147 -0.6430711092
[666] -0.1328212977  1.1232673151 -2.1279745983  1.0801359614  0.9469918870
[671]  0.8610554441 -1.3412786858  0.0112240647 -0.5425017122  0.0195668067
[676]  0.1417212278  1.1091027385 -0.7207140059 -1.2043707051 -1.0098216481
[681] -0.6939512960  0.5917122683  0.4729445846 -0.6425050427  1.9426974464
[686] -0.1790199599 -0.5452736259  0.1259648818  1.4560560991  0.9580334342
[691] -0.0249454854 -0.5794550479  1.5327991061  0.8267427053  1.9431077861
[696] -2.1537137746 -0.4589379656  1.6979040725 -0.1682911882  1.0618649553
[701] -1.1202519291  0.0538081202 -0.2687203253 -0.7257462229  1.5240298566
[706]  0.2972065317  0.7880350687 -0.7460358245 -0.0633915814 -1.2056771899
[711] -0.2293122150 -0.1373075486 -1.5368320230  1.0976102360  0.9700801571
[716] -0.1751556324  1.2916561950  0.0682163410  0.6754195054  1.7311401090
[721]  1.5948819517 -1.4849281135  0.7175097709  0.3785998079 -0.8726705465
[726] -0.2080200758  0.3695963838 -0.1016198225  0.2989081320  1.8698460532
[731] -1.0269030271 -1.8977973046  0.2821990121 -1.2234459814  0.7842356368
[736]  0.0479099604  0.9630134284 -1.6329166315 -0.0092615111  2.2589793808
[741]  0.9249086176 -0.2501782401 -1.0114097878 -0.3746782928 -0.8285404451
[746]  0.4411569912 -0.9359864567 -0.7321235558 -1.6229740558 -0.1071265621
[751] -1.7047310242  0.6358457924  1.3409031409  0.7607839533 -0.7257319476
[756] -1.3179318141  2.8101578084  0.3318961801 -0.3974952038 -1.1406094941
[761]  0.7224716991  1.5108013095 -0.0372064499 -1.6273541166 -0.7625927659
[766] -1.9138617585  0.7440044021  0.6489603875 -0.6400820351 -0.0897485497
[771]  0.2964981376  0.7176357968 -1.4521393673 -0.6898949532  1.2920087119
[776]  1.0799264781  0.0679166678 -0.1367989787  0.2091256222  0.8330444531
[781]  1.7653070987 -1.1488965351 -0.3093942841  1.8698038923 -1.3855745345
[786] -0.3465901131  0.4896803274 -0.3859202030  1.0012564153 -0.7634608519
[791] -1.1585726912 -1.1668125648  0.4721701269  0.6000219899 -0.5679448099
[796]  0.0320687661 -1.3160920310  1.2024770521  1.3332058772 -1.0309223405
[801]  1.2727812257 -1.1162520005 -0.8766309675 -2.3064821118 -0.0038307579
[806]  0.8281085998  1.4100708057 -0.2193119836 -0.9281963612  0.8248878629
[811] -0.7694177479 -0.6713949205  2.0737528964  0.2175282061 -0.0046062378
[816]  0.8190470156  0.2263002241  1.6180283118  0.3086891053 -0.0981562937
[821]  0.5772578007  1.5102498374  1.2655345264  0.0642789079 -2.5948364714
[826]  1.5316738262  0.1906061573 -0.3614259830  0.3848714890  0.1078352206
[831]  0.6238777131 -1.2757428490  0.7672494898  0.1693032434  0.3658770385
[836] -0.7616216298  0.3345374258  2.0020578887 -1.0688805552 -0.2520455750

rTensor documentation built on May 15, 2021, 9:06 a.m.