From 5d9a6b9939a5d9a3fea8cfb1f6d9b0b2691829b3 Mon Sep 17 00:00:00 2001 From: Daniel Falbel Date: Mon, 2 Feb 2026 15:57:45 -0300 Subject: [PATCH] Export torch_ldexp function Add documentation and export for the ldexp function which multiplies input by 2^other, useful for constructing floating point numbers from mantissas and exponents. Co-Authored-By: Claude Opus 4.5 --- NAMESPACE | 1 + R/gen-namespace-docs.R | 22 ++++++++++++++++++++++ man/torch_ldexp.Rd | 29 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 man/torch_ldexp.Rd diff --git a/NAMESPACE b/NAMESPACE index 4296a688b3..300f85e5a6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -691,6 +691,7 @@ export(torch_kaiser_window) export(torch_kron) export(torch_kthvalue) export(torch_lcm) +export(torch_ldexp) export(torch_le) export(torch_lerp) export(torch_less) diff --git a/R/gen-namespace-docs.R b/R/gen-namespace-docs.R index 85889971b2..9e2fdf9da8 100644 --- a/R/gen-namespace-docs.R +++ b/R/gen-namespace-docs.R @@ -6368,6 +6368,28 @@ NULL NULL +#' Ldexp +#' +#' @section ldexp(input, other, out=NULL) -> Tensor : +#' +#' Multiplies `input` by \eqn{2^{other}}. +#' +#' \deqn{ +#' \text{out}_i = \text{input}_i * 2^{\text{other}_i} +#' } +#' +#' Typically this function is used to construct floating point numbers by multiplying +#' mantissas in `input` with integral powers of two created from the exponents in `other`. +#' +#' @param self (Tensor) the tensor of mantissas +#' @param other (Tensor) the tensor of exponents, must be an integer dtype +#' +#' @name torch_ldexp +#' +#' @export +NULL + + #' Kaiser_window #' #' @section kaiser_window(window_length, periodic=TRUE, beta=12.0, *, dtype=None, layout=torch.strided, device=None, requires_grad=FALSE) -> Tensor : diff --git a/man/torch_ldexp.Rd b/man/torch_ldexp.Rd new file mode 100644 index 0000000000..523990578d --- /dev/null +++ b/man/torch_ldexp.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/gen-namespace-docs.R, R/gen-namespace.R +\name{torch_ldexp} +\alias{torch_ldexp} +\title{Ldexp} +\usage{ +torch_ldexp(self, other) +} +\arguments{ +\item{self}{(Tensor) the tensor of mantissas} + +\item{other}{(Tensor) the tensor of exponents, must be an integer dtype} +} +\description{ +Ldexp +} +\section{ldexp(input, other, out=NULL) -> Tensor }{ + + +Multiplies \code{input} by \eqn{2^{other}}. + +\deqn{ + \text{out}_i = \text{input}_i * 2^{\text{other}_i} +} + +Typically this function is used to construct floating point numbers by multiplying +mantissas in \code{input} with integral powers of two created from the exponents in \code{other}. +} +